0
0
bleve/search/query_phrase.go
Marty Schoch f225d484b3 overhauled search
many bugs fixed in existing search
phrase query updated to support gaps in term sequence
new query types
all,none,match,phrase match
and new query syntax search, like google search:
+/-(optional field qualifier:)<term or quoted phrase>
2014-07-11 14:49:59 -04:00

29 lines
568 B
Go

package search
import (
"fmt"
"github.com/couchbaselabs/bleve/index"
)
type PhraseQuery struct {
Terms []*TermQuery `json:"terms,omitempty"`
BoostVal float64 `json:"boost,omitempty"`
Explain bool `json:"explain,omitempty"`
}
func (q *PhraseQuery) Boost() float64 {
return q.BoostVal
}
func (q *PhraseQuery) Searcher(index index.Index) (Searcher, error) {
return NewPhraseSearcher(index, q)
}
func (q *PhraseQuery) Validate() error {
if q.Terms == nil {
return fmt.Errorf("Phrase query must contain at least one term")
}
return nil
}