Skip to content

Hide Load More in similarity search when there are no more results - #487

Open
burrows99 wants to merge 1 commit into
qdrant:masterfrom
burrows99:fix/similar-load-more-when-exhausted
Open

burrows99 wants to merge 1 commit into
qdrant:masterfrom
burrows99:fix/similar-load-more-when-exhausted

Conversation

@burrows99

Copy link
Copy Markdown

What was wrong

In a collection's Points tab, a similarity search (the Find Similar button, or an id typed into Similar to (id)) always shows a Load More button, even when every result is already listed. Clicking it sends the same request again and nothing changes on screen.

Steps on master (413a120): open a collection with 7 points, click Find Similar on a point. The other 6 points are listed, Load More is shown below them, and clicking it does nothing.

I did not find an existing issue for this.

Cause. The similarity branch of PointsTabs stores the number of returned points as the next offset (setNextPageOffset(newPoints.points.length)), so the value is truthy for any non-empty result and the button is always rendered. The scroll branches use next_page_offset from the API, which is null on the last page, so they are not affected.

What changed

When the similarity query returns fewer points than the requested limit, there is nothing left to load, so the next offset is set to null and the button is hidden. A full page keeps the previous behaviour. Four changed lines in src/components/Points/PointsTabs.jsx, plus a new test file.

flowchart TD
    A[Find Similar on a point] --> B{Fewer results than the page limit}
    B -->|Before| C[Load More shown and does nothing]
    B -->|After| D[Load More hidden]
Loading

Narrated recording, before then after (sound on):

evidence.mp4

Edge cases and unchanged behaviour checked

Checked in the running app (npm start against a local Qdrant 1.20.1 container) and shown in the recording:

  • Before: 7-point collection, Find Similar lists 6 points, Load More is shown and two clicks change nothing.
  • After: same steps, same 6 points, no Load More.
  • Edge case: exactly 10 results (11-point collection). Load More is shown once, and one click hides it; the list stays at 10 points.
  • Edge case: similarity search combined with a payload filter (city:Berlin) leaves 2 results and no Load More.
  • Unchanged: the plain points list of a 34-point collection still loads the next 10 with Load More.
  • Unchanged: a similarity search with more results (33) still loads the next page and keeps the button.

Checked by unit tests only (src/components/Points/PointsTabs.test.jsx, new):

  • 6 similar points: no Load More.
  • 15 similar points: first page of 10, one click requests limit: 20, shows 15 and hides the button.
  • 25 similar points: the button stays after the first click.

Tests

$ npx vitest --run src/components/Points/PointsTabs.test.jsx
 Test Files  1 passed (1)
      Tests  3 passed (3)

With the fix reverted and the new tests kept, the first two tests fail (2 failed, 1 passed).

npx eslint src/components/Points/PointsTabs.jsx and npx prettier --check on both files pass.

Not run locally: the full test suite and npm audit.

AI tools (Claude Code) assisted with this change; the bug was reproduced and the fix verified manually in the running app.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant