Skip to content

Fix topic page pagination - #3682

Open
shanbady wants to merge 2 commits into
mainfrom
shanbady/topic-page-pagination-issue
Open

Fix topic page pagination#3682
shanbady wants to merge 2 commits into
mainfrom
shanbady/topic-page-pagination-issue

Conversation

@shanbady

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/12397

Description (What does it do?)

This PR fixes an issue where the topic pages show more pages than can be paginated to. This is due to the use of exact=False for the final count returned by the api which ends up showing more results than there actually are.

How can this be tested?

  1. checkout main - make sure you have embeddings locally
  2. go to a top-level topic page such as http://open.odl.local:8062/c/topic/engineering -> click on the very last page of results and it should come up empty.
  3. checkout this branch and attempt the same - it should never be empty and the page count should be accurate

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

OpenAPI Changes

No changes detected

View full changelog

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@shanbady shanbady changed the title use exact counts for filtered views Fix topic page pagination Jul 27, 2026
@shanbady
shanbady marked this pull request as ready for review July 27, 2026 15:07
Copilot AI review requested due to automatic review settings July 27, 2026 15:07
@shanbady shanbady added the Needs Review An open Pull Request that is ready for review label Jul 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the vector search count logic used by topic-page pagination so the UI’s total-results count is exact, preventing “extra” pages that render empty results.

Changes:

  • Switch Qdrant count calls used for pagination totals from approximate (exact=False) to exact (exact=True).
  • Add a regression test ensuring the vector search endpoint requests an exact count from Qdrant.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
vector_search/views.py Uses an exact Qdrant count for paginator totals to avoid advertising empty pages.
vector_search/views_test.py Adds a test that asserts the Qdrant count call is made with exact=True.

Comment thread vector_search/views_test.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review An open Pull Request that is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants