Esempio n. 1
0
func (q *regexpQuery) Searcher(i index.IndexReader, m *IndexMapping, explain bool) (search.Searcher, error) {
	field := q.FieldVal
	if q.FieldVal == "" {
		field = m.DefaultField
	}
	err := q.compile()
	if err != nil {
		return nil, err
	}

	return searchers.NewRegexpSearcher(i, q.compiled, field, q.BoostVal, explain)
}
Esempio n. 2
0
func (q *wildcardQuery) Searcher(i index.IndexReader, m *IndexMapping, explain bool) (search.Searcher, error) {
	field := q.FieldVal
	if q.FieldVal == "" {
		field = m.DefaultField
	}
	if q.compiled == nil {
		var err error
		q.compiled, err = q.convertToRegexp()
		if err != nil {
			return nil, err
		}
	}

	return searchers.NewRegexpSearcher(i, q.compiled, field, q.BoostVal, explain)
}