Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoValue = errors.New("no text to search")
Functions ¶
func Candidates ¶
Candidates indexes the notes written since the last search, then gives the condition on mn (metadata_notes) that keeps the notes holding every gram of text, and those grams for mn.headings: a few more share them, the caller checks the text once opened. None for a single letter: every note, and no grams. TODO: a 2-letter text ("go") opens about a note in 30 more than hold it (16-bit blinds), fine at 50,000 notes.
Types ¶
type Match ¶
type Match struct {
ID string `json:"id"`
Title string `json:"title"`
Path string `json:"path"`
Snippet string `json:"snippet"`
Readonly bool `json:"readonly,omitempty" binding:"optional"`
}
Match is a note containing the text, with the content line where it was found.
func Matches ¶
func Matches(ctx context.Context, db bun.IDB, tree domain.Tree, ids []string, text string, limit, offset int) ([]Match, int, error)
Matches opens the notes of ids, in their order, and keeps those holding text in their title or content whatever its case: limit of them from offset, every one when limit is 0. No text: every note, none opened for its content. The index gives a few notes that do not hold the text, so they are opened until the page is full, not all of them: the total counts the matches met and the notes left unopened, and a page costs the ones before it. TODO: the last pages of a search with tens of thousands of matches open them all (1 s at 50,000 notes), as every page did; a cursor instead of an offset if they are ever read.