Skip to content

Commit

Permalink
Merge pull request blevesearch#1108 from abhinavdangeti/minMaxKey
Browse files Browse the repository at this point in the history
[Scorch] Skipping segments that don't include requested ids
  • Loading branch information
abhinavdangeti authored Jan 16, 2019
2 parents d04890d + 5554236 commit d725210
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions index/scorch/segment/zap/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,20 @@ func (s *SegmentBase) DocNumbers(ids []string) (*roaring.Bitmap, error) {
}

postingsList := emptyPostingsList

sMax, err := idDict.fst.GetMaxKey()
if err != nil {
return nil, err
}
sMaxStr := string(sMax)
filteredIds := make([]string, 0, len(ids))
for _, id := range ids {
if id <= sMaxStr {
filteredIds = append(filteredIds, id)
}
}

for _, id := range filteredIds {
postingsList, err = idDict.postingsList([]byte(id), nil, postingsList)
if err != nil {
return nil, err
Expand Down

0 comments on commit d725210

Please sign in to comment.