Skip to content

Hybrid Search: Fix "resource type" filter#3528

Merged
shanbady merged 4 commits into
mainfrom
shanbady/vector-search-resource-type-filter
Jun 30, 2026
Merged

Hybrid Search: Fix "resource type" filter#3528
shanbady merged 4 commits into
mainfrom
shanbady/vector-search-resource-type-filter

Conversation

@shanbady

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

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

Description (What does it do?)

This PR resolves an issue where in the hybrid search interface (topic pages which is live) the "resource category" filter does not work when looking at learning materials.

Screenshots (if appropriate):

Screenshot 2026-06-26 at 10 37 00 AM

How can this be tested?

  1. checkout this branch
  2. make sure you have a variety of learning materials embedded locally - otherwise run ./manage.py generate_embeddings --videos --video_playlists --documents --podcasts --skip-contentfiles
  3. go to a topic channel page - select "learning materials"
  4. try to filter by different resource categories and confirm it works as intended
  5. login as an admin and go to the main search interface and enable "hybrid search" from the admin options ~ try the same filtering and it should work.

@github-actions

Copy link
Copy Markdown

OpenAPI Changes

3 changes: 0 error, 0 warning, 3 info

View full changelog

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

@shanbady shanbady added the Needs Review An open Pull Request that is ready for review label Jun 26, 2026
@shanbady shanbady marked this pull request as ready for review June 26, 2026 14:46
Copilot AI review requested due to automatic review settings June 26, 2026 14:46

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 fixes hybrid/vector search filtering for the “resource category” facet by wiring the resource_category filter through the backend request serializer/OpenAPI spec and through the frontend vector-search request construction, with regression tests added on both sides.

Changes:

  • Add resource_category to the vector-search filter serializer so it’s forwarded into Qdrant filter conditions.
  • Update OpenAPI specs and regenerated TS API clients (v0 + v1) to include the new query parameter.
  • Update frontend hybrid search param mapping and add a SearchPage regression test to ensure resource_category is sent to the vector endpoint.

Reviewed changes

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

Show a summary per file
File Description
vector_search/serializers.py Adds resource_category to shared Qdrant-backed filter serializer.
vector_search/serializers_test.py Tests serializer acceptance + inheritance of resource_category.
vector_search/views_test.py Ensures Qdrant query/scroll filters include resource_category.
openapi/specs/v1.yaml Documents resource_category query param for relevant v1 endpoints.
openapi/specs/v0.yaml Documents resource_category query param for relevant v0 endpoint.
frontends/main/src/page-components/SearchDisplay/HybridSearchDisplay.tsx Passes resource_category into vector-search request params.
frontends/main/src/app-pages/SearchPage/SearchPage.test.tsx Adds regression test asserting resource_category is included in vector-search request URL.
frontends/api/src/generated/v1/api.ts Regenerated client: includes resource_category on v1 requests.
frontends/api/src/generated/v0/api.ts Regenerated client: includes resource_category on v0 requests.

Comment on lines +88 to +96
const getLastVectorApiSearchParams = () => {
const call = makeRequest.mock.calls.find(([args]) => {
if (args.method !== "get") return false
return args.url.startsWith(urls.search.vectorResources())
})
invariant(call)
const fullUrl = new URL(call[0].url, "http://mit.edu")
return fullUrl.searchParams
}
@abeglova abeglova self-assigned this Jun 29, 2026

@abeglova abeglova 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.

👍

@shanbady shanbady merged commit 180b9fa into main Jun 30, 2026
15 checks passed
@shanbady shanbady deleted the shanbady/vector-search-resource-type-filter branch June 30, 2026 12:15
@odlbot odlbot mentioned this pull request Jun 30, 2026
9 tasks
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.

3 participants