Advanced search displays different result than default search

Summary

This was reported by a 3,020-seat premium customer. When the customer is searching for a term that is repeated in a document, the default search returns all occurrences of the term. Advanced search only returns it twice.

Steps to reproduce

  • Create a project with a document that contains a repeating term (repeating more than twice each on its own line - our test repeated it 7 times), eg.

foo

foo

foo

foo

foo
  • Create a branch with the same document exactly
  • Search for the term on the default branch
  • Search for the term using Advanced search on the other branch
  • Compare results

What is the current bug behavior?

For the advanced search results, only 2 of the 7 results are displayed.

What is the expected correct behavior?

The default search result is correct, i.e all occurrences are displayed correctly. It is unclear whether this is the intended behavior. See https://gitlab.com/gitlab-org/gitlab-ee/blob/master/ee/lib/gitlab/elastic/search_results.rb#L130-151

Results of GitLab environment info

The replication test was performed on 12.2.4 ee

Assignee Loading
Time tracking Loading