Skip to content

Fix a couple bugs causing missing search results

Olivia Lee requested to merge benjamin/fix-search-skip into main

Another pair of related bugs that are not very frequent currently but will become much more severe once filtering is implemented. Right now it's only possible to trigger these with history visibility set to "joined" or "invited", but with filtering support they will be triggered by almost any filter that rejects some of the search results.

Steps to reproduce the next_batch bug (fixed by 0cdf0328)

  1. Create a room with history-visibility=joined as user A
  2. Join the room as user B
  3. Send some messages as user A
  4. Leave
  5. Send some messages as user A (these will be invisible to user B)
  6. Join the room again as user B
  7. Make a search request for this room that will match all of the sent messages, with limit set to some value lower than the number of events created in step 3.

Expected result

Response contains a subset of visible events, and a next_batch value that can be used to fetch the remaining results.

Actual result

Response contains a subset of visible events, but no next_batch.

On element web, this shows up as "No more results" when there are more results that you would expect to be displayed.

Steps to reproduce the dropped events bug (fixed by 3551a6ef)

  1. Create a room with history-visibility=joined as user A
  2. Join the room as user B
  3. Send some messages as user A
  4. Leave
  5. Send some messages as user A
  6. Join the room again as user B
  7. Send some messages as user A
  8. Make a search request for this room that will match all of the sent messages, with limit set to some value larger than the number of events created in step 7.
  9. Continue making paginated search calls until you stop getting next_batch.

Expected result

All visible events (i.e. not including the ones from step 5) can be seen by paginating through several search requests using next_batch.

Actual result

Every search call except the first one is missing several events.

Edited by Charles Hall

Merge request reports