0
0
Fork 0

Merge pull request #589 from mschoch/fix-term-range-panic

fix panic in term range search
This commit is contained in:
Marty Schoch 2017-05-05 23:18:56 -04:00 committed by GitHub
commit 5c9915c6f4
2 changed files with 13 additions and 0 deletions

View File

@ -64,6 +64,10 @@ func NewTermRangeSearcher(indexReader index.IndexReader,
if !*inclusiveMin && min != nil && string(min) == terms[0] {
terms = terms[1:]
// check again, as we might have removed only entry
if len(terms) < 1 {
return NewMatchNoneSearcher(indexReader)
}
}
// if our term list included the max, it would be the last item

View File

@ -157,6 +157,15 @@ func TestTermRangeSearch(t *testing.T) {
inclusiveMax: true,
want: nil,
},
// min and max same (and term exists), both exlusive
{
min: []byte("marty"),
max: []byte("marty"),
field: "name",
inclusiveMin: false,
inclusiveMax: false,
want: nil,
},
}
for _, test := range tests {