Merge pull request #589 from mschoch/fix-term-range-panic
fix panic in term range search
This commit is contained in:
commit
5c9915c6f4
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue