Example #1
0
func (q *phraseQuery) Searcher(i index.IndexReader, m *IndexMapping, explain bool) (search.Searcher, error) {

	conjunctionQuery := NewConjunctionQuery(q.termQueries)
	conjunctionSearcher, err := conjunctionQuery.Searcher(i, m, explain)
	if err != nil {
		return nil, err
	}
	return searchers.NewPhraseSearcher(i, conjunctionSearcher.(*searchers.ConjunctionSearcher), q.Terms)
}
Example #2
0
func (q *phraseQuery) Searcher(i index.IndexReader, m *IndexMapping, explain bool) (search.Searcher, error) {

	terms := make([]string, len(q.Terms))
	for i, term := range q.Terms {
		terms[i] = term.(*termQuery).Term
	}

	conjunctionQuery := NewConjunctionQuery(q.Terms)
	conjunctionSearcher, err := conjunctionQuery.Searcher(i, m, explain)
	if err != nil {
		return nil, err
	}
	return searchers.NewPhraseSearcher(i, conjunctionSearcher.(*searchers.ConjunctionSearcher), terms)
}