Skip to content

Make search facets fully asynchronous#12262

Merged
RayBB merged 14 commits intointernetarchive:masterfrom
Sadashii:12256/feat/make-partials-searchfacets-full-async
Apr 4, 2026
Merged

Make search facets fully asynchronous#12262
RayBB merged 14 commits intointernetarchive:masterfrom
Sadashii:12256/feat/make-partials-searchfacets-full-async

Conversation

@Sadashii
Copy link
Copy Markdown
Contributor

@Sadashii Sadashii commented Apr 2, 2026

Closes #12256

feature -> Make /partials/SearchFacets.json full async to free up worker

Technical

Testing

Screenshot

Stakeholders

@RayBB

Copilot AI review requested due to automatic review settings April 2, 2026 03:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an async Solr-backed search helper and wires it into the /partials/SearchFacets.json path so facets can be generated without relying on synchronous Solr query execution.

Changes:

  • Introduces do_search_async (async) and keeps do_search as a sync wrapper via async_bridge.
  • Updates SearchFacetsPartial to perform the facets Solr query using await do_search_async(...).
  • Removes the “TODO: Make this fully async” note from the FastAPI partial endpoint docstring.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
openlibrary/plugins/worksearch/code.py Adds do_search_async and wraps it with do_search for sync callers.
openlibrary/plugins/openlibrary/partials.py Makes SearchFacetsPartial.generate async and awaits the async search call.
openlibrary/fastapi/partials.py Removes the async TODO comment from the SearchFacets partial endpoint docstring.

Comment thread openlibrary/fastapi/partials.py
Comment thread openlibrary/plugins/openlibrary/partials.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread openlibrary/fastapi/partials.py Outdated
@Sadashii
Copy link
Copy Markdown
Contributor Author

Sadashii commented Apr 2, 2026

@RayBB The failing test is because the parent @generate function for partials is synchronous, as we made the SearchFacets partial async there is a mismatch. Once all the partials are made async, the parent can be updated and then the test will pass.

@RayBB
Copy link
Copy Markdown
Collaborator

RayBB commented Apr 2, 2026 via email

@RayBB
Copy link
Copy Markdown
Collaborator

RayBB commented Apr 2, 2026

At first glance it looks good. Can you try to remove the Infogami change? I think you have to run MakeGit or something like that. It's a weird little thing that sneaks in there sometimes, but I'm pretty sure you don't need that and it'll have to be removed before we can merge.

@RayBB RayBB added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Apr 2, 2026
@RayBB RayBB self-assigned this Apr 2, 2026
@github-project-automation github-project-automation Bot moved this to Waiting Review/Merge from Staff in Ray's Project Apr 2, 2026
@Sadashii
Copy link
Copy Markdown
Contributor Author

Sadashii commented Apr 3, 2026

Fixed

@github-actions github-actions Bot added Needs: Response Issues which require feedback from lead and removed Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] labels Apr 3, 2026
Copy link
Copy Markdown
Collaborator

@RayBB RayBB left a comment

Choose a reason for hiding this comment

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

Confirmed this is working as expected on testing.

I did this by checking the solr and non-solr versions of search results (json and html) are the same between testing and production.

@RayBB
Copy link
Copy Markdown
Collaborator

RayBB commented Apr 4, 2026

Great job on this one thanks for the help!

@RayBB RayBB merged commit f0fb363 into internetarchive:master Apr 4, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from Waiting Review/Merge from Staff to Done in Ray's Project Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Response Issues which require feedback from lead

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🟢 /partials/SearchFacets.json

3 participants