0
0
Fork 0

Don't search the same term twice

We have searched for the first term in the phrase query already so we
can skip it. Before doing so we have to add the location of the first
term.
This commit is contained in:
Silvan Jegen 2016-10-26 15:03:24 +02:00
parent d87b4f88bf
commit 3dd363afaa
1 changed files with 2 additions and 1 deletions

View File

@ -110,8 +110,9 @@ func (s *PhraseSearcher) Next(ctx *search.SearchContext) (*search.DocumentMatch,
OUTER:
for _, location := range locations {
crvtlm := make(search.TermLocationMap, 0)
crvtlm.AddLocation(firstTerm, location)
INNER:
for i := 0; i < len(s.terms); i++ {
for i := 1; i < len(s.terms); i++ {
nextTerm := s.terms[i]
if nextTerm == "" {
continue