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:
parent
38bd2fc058
commit
6d6fae2895
|
@ -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) {
|
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))
|
ss := make([]search.Searcher, len(q.Disjuncts))
|
||||||
for in, disjunct := range q.Disjuncts {
|
for in, disjunct := range q.Disjuncts {
|
||||||
var err error
|
var err error
|
||||||
|
|
Loading…
Reference in New Issue
Block a user