Skip to content

Conversation

@saifxyzyz
Copy link
Contributor

@saifxyzyz saifxyzyz commented Dec 5, 2025

Partially Closes #11546

[Fix]

Technical

Changes:

  1. openlibrary/plugins/worksearch/languages.py: Set _pass_time_allowed=True to the Solr query in get_all_language_counts, this makes Solr return the partial results it has collected so far instead of crashing.
  2. openlibrary/plugins/worksearch/subjects.py: Changed the publish_year facet limit from -1 to 2000 in SubjectEngine, this makes sure Solr returns the top 2000 most common years which covers up all legitimate historical years while filtering out dirty data like typos or invalid years which would cause performance issues

Testing

Ran automated tests (openlibrary/plugins/worksearch/tests/test_worksearch.py)
Created a custom script (openlibrary/plugins/worksearch/tests/test_verification.py) to mock solr and verify that the new parameters are correctly passed

  1. Timeout handling: Simulated a timeout returning partialResults: True and confirmed that get_all_language_counts returns the available data instead of raising an exception.
  2. Parameter Verification: Confirmed that _pass_time_allowed=True is explicitly passed in the Solr query parameters.
  3. Facet Limit: Confirmed that the publish_year facet request includes limit: 2000.

Screenshot

Stakeholders

@saifxyzyz saifxyzyz marked this pull request as draft December 5, 2025 17:25
@saifxyzyz
Copy link
Contributor Author

I've been trying to get the python_tests to pass but my test_verification.py file makes it fail

@github-actions github-actions bot added the Needs: Response Issues which require feedback from lead label Dec 6, 2025
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

None yet

Development

Successfully merging this pull request may close these issues.

Improve Open Library uptime

1 participant