bleveext

package
v0.0.0-...-3cedf58 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 6 Imported by: 0

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 (*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

type BoostingQueryPredicate func(field string, term []byte, isPartOfMatch bool) *query.Boost

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL