Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoValue = errors.New("no text nor filter 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 Filter ¶ added in v1.3.2
type Filter struct {
MaxLength int // content (title line included) of at most that many characters; 0: any length
Untagged bool // notes with no tag
UpdatedBefore time.Time // notes last changed (or created, never changed) before it, the oldest first without a text; zero: any date
}
Filter keeps the notes of a search, with or without a text: what an agent sorting the account reads first.
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, maxLength, 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, and whose content has at most maxLength characters when it is not 0: limit of them from offset, every one when limit is 0. No text nor maxLength: 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 (none with maxLength: all are opened, so the total is exact), 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.