0
0

optimize when disjunction query has only a single child

On my dev laptop, the bleve-query benchmark of query-string
"+text:afternoon +text:coffee" (which gets parsed into a conjection of
disjunctions) had throughput of 308qps before this change, and after
this change was 342qps.
This commit is contained in:
Steve Yen 2016-09-20 23:08:42 -07:00
parent 38bd2fc058
commit 6d6fae2895

View File

@ -66,6 +66,10 @@ func (q *disjunctionQuery) SetMin(m float64) Query {
}
func (q *disjunctionQuery) Searcher(i index.IndexReader, m *IndexMapping, explain bool) (search.Searcher, error) {
if len(q.Disjuncts) == 1 {
return q.Disjuncts[0].Searcher(i, m, explain)
}
ss := make([]search.Searcher, len(q.Disjuncts))
for in, disjunct := range q.Disjuncts {
var err error