Documentation ¶
Overview ¶
Post-ranking happens on the source backend (because it has the source files in the kernel’s page cache). In the post-ranking phase we can do (limited) source file level analysis, such as in which scope the query string was matched (comment, top-level, sub-level).
Pre-ranking happens on dcs-web after the index backends provided their results. Without looking at file contents at all, we assign a preliminary ranking to each file based on its database entries and whether the query string matches parts of the filename.
vim:ts=4:sw=4:noexpandtab
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadRankingData ¶
ReadRankingData reads the pre-computed rankings from |path|. It must be called before ResultPath.Rank() is called, otherwise Rank() won’t return meaningful results.
Types ¶
type QueryStr ¶
type QueryStr struct {
// contains filtered or unexported fields
}
Represents a query string with pre-compiled regular expressions for faster matching.
func NewQueryStr ¶
type RankingOpts ¶
type RankingOpts struct { // Map of file suffix (e.g. ".c") ranking. This is filled in based on the // filetype= parameter (which is extracted from the query string). Suffixes map[string]float32 // Same thing, but for the nfiletype parameter (from the -filetype: // keywords in the query). Nsuffixes map[string]float32 // pre-ranking: amount of reverse dependencies Rdep bool // pre-ranking: popcon installation count Inst bool // pre-ranking: filetype Filetype bool // pre-ranking: does the search query match the path? Pathmatch bool // pre-ranking: does the search query match the source package name? Sourcepkgmatch bool // post-ranking: in which scope is the match? Scope bool // post-ranking: does the search query (with enforced word boundaries) // match the line? Linematch bool // meta: turns on all rankings and uses 'optimal' weights (as determined in // the thesis). Weighted bool }
func RankingOptsFromQuery ¶
func RankingOptsFromQuery(query url.Values) RankingOpts
type ResultPath ¶
The regular expression trigram index provides us a path to a potential result. This data structure represents such a path and allows for ranking and sorting each path.
func (*ResultPath) Rank ¶
func (rp *ResultPath) Rank(opts *RankingOpts)
type ResultPaths ¶
type ResultPaths []ResultPath
func (ResultPaths) Len ¶
func (r ResultPaths) Len() int
func (ResultPaths) Less ¶
func (r ResultPaths) Less(i, j int) bool
func (ResultPaths) Swap ¶
func (r ResultPaths) Swap(i, j int)
type StoredRanking ¶
Represents an entry from our ranking database (determined by using the meta information about source packages).