Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoostingQuery ¶
type BoostingQuery struct {
// BoostVal represents the ratio of recency to preexisitng score. The
// default, 1.0, assigns equal importance to recency score and match score.
// A value of 2 would relatively rank recency twice as important as match score.
BoostVal *query.Boost
// These fields are loaded, and used in the boost processing.
// Predicate will be called with every field.
Fields []string
// Return true if BoostVal should be applied to this hit.
Predicate BoostingQueryPredicate
// contains filtered or unexported fields
}
func NewBoostingQuery ¶
func NewBoostingQuery(base query.Query, fields []string, predicate BoostingQueryPredicate) *BoostingQuery
func (*BoostingQuery) Boost ¶
func (q *BoostingQuery) Boost() float64
func (*BoostingQuery) Searcher ¶
func (q *BoostingQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*BoostingQuery) SetBoost ¶
func (q *BoostingQuery) SetBoost(b float64)
SetBoost sets the boost value. Usually you should leave this, and return differing values from Predicate. Changing this scales the result of Predicate.
type BoostingQueryPredicate ¶
BoostingQueryPredicate is called with a search field, term, and whether the field was part of the match, or was included just for the purposes of the BoostingQuery.
For example, maybe if any of 3 fields match, the document should be boosted. The predicate would be called with all three fields, but only those with isPartOfMatch should return a non-nil query.Boost.
Additionally, perhaps some documents should be boosted merely because of their value ("sale" items). In this case, you would likely ignore isPartOfMatch and instead compare against term.