fix bug in regexp, prefix and fuzzy searchers
these searchers incorrectly called Next() on their underlying searcher, instead of Advance(). this can cause values to be returned with an ID less than the one that was Advanced() to, which violates the contract, and causes other incorrect behavior. fixes #342
This commit is contained in:
parent
9f31ea6805
commit
54b06ce0f6
|
@ -113,7 +113,7 @@ func (s *FuzzySearcher) Next() (*search.DocumentMatch, error) {
|
|||
}
|
||||
|
||||
func (s *FuzzySearcher) Advance(ID string) (*search.DocumentMatch, error) {
|
||||
return s.searcher.Next()
|
||||
return s.searcher.Advance(ID)
|
||||
}
|
||||
|
||||
func (s *FuzzySearcher) Close() error {
|
||||
|
|
|
@ -112,7 +112,7 @@ func (s *RegexpSearcher) Next() (*search.DocumentMatch, error) {
|
|||
}
|
||||
|
||||
func (s *RegexpSearcher) Advance(ID string) (*search.DocumentMatch, error) {
|
||||
return s.searcher.Next()
|
||||
return s.searcher.Advance(ID)
|
||||
}
|
||||
|
||||
func (s *RegexpSearcher) Close() error {
|
||||
|
|
|
@ -76,7 +76,7 @@ func (s *TermPrefixSearcher) Next() (*search.DocumentMatch, error) {
|
|||
}
|
||||
|
||||
func (s *TermPrefixSearcher) Advance(ID string) (*search.DocumentMatch, error) {
|
||||
return s.searcher.Next()
|
||||
return s.searcher.Advance(ID)
|
||||
}
|
||||
|
||||
func (s *TermPrefixSearcher) Close() error {
|
||||
|
|
Loading…
Reference in New Issue
Block a user