Skip to content

Commit 67ac5e5

Browse files
sattagconnell
authored andcommitted
query: improve performance of boolean operators
1 parent 3545c54 commit 67ac5e5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

query/query.go

+6
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ func (a unionQuery) LookupIn(ctx context.Context, index *indexfile.IndexFile) (b
132132
return nil, err
133133
}
134134
positions = positions.Union(pos)
135+
if positions.IsAllPositions() {
136+
break
137+
}
135138
}
136139
return positions, nil
137140
}
@@ -155,6 +158,9 @@ func (a intersectQuery) LookupIn(ctx context.Context, index *indexfile.IndexFile
155158
return nil, err
156159
}
157160
positions = positions.Intersect(pos)
161+
if positions.Len() == 0 {
162+
break
163+
}
158164
}
159165
return positions, nil
160166
}

0 commit comments

Comments
 (0)