Documentation
¶
Overview ¶
Package searchtext turns text into the words a search index keeps and a query into the words it looks for: folded (lowercase, "ё" as "е") and stemmed in a language (Snowball), so "cats" finds "cat".
Index ¶
Constants ¶
const MaxQueryWords = 8
MaxQueryWords - the words of a query looked for; the rest are ignored.
const MaxWordLen = 64
MaxWordLen - the longest word kept, in bytes (the index column's size); a longer one is cut at a letter.
Variables ¶
This section is empty.
Functions ¶
func Stem ¶
Stem - the stem of the folded word in the language lang ("pt-BR" - Portuguese); the word as it is in a language without a stemmer.
Types ¶
type Query ¶
type Query struct {
Phrase string
// Words - per word of the query (Tokens, each once, at most
// MaxQueryWords) its forms: the word and its stems in the languages.
Words [][]string
}
Query - a search query: the phrase (folded, single spaces) and its words, each as the forms an indexed word may have.
func ParseQuery ¶
ParseQuery - the query q in the languages langs (the site's: the text may be in any of them).
func (Query) Matches ¶
Matches - whether the indexed words have every word of the query: one of its forms, or (Prefix) a word beginning with one.
func (Query) Prefix ¶
Prefix - whether the i-th word is matched as the beginning of a word: the last one, likely still being typed.