Fixed series autocomplete to correctly resolve OL IDs and URLs, added tests.#12123
Open
Saad259 wants to merge 2 commits intointernetarchive:masterfrom
Open
Fixed series autocomplete to correctly resolve OL IDs and URLs, added tests.#12123Saad259 wants to merge 2 commits intointernetarchive:masterfrom
Saad259 wants to merge 2 commits intointernetarchive:masterfrom
Conversation
for more information, see https://pre-commit.ci
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #12094
olid_to_keymaps theLsuffix to/lists/, but series records live under/series/. This fix adds anolid_to_keymethod to the baseautocompleteclass and replaces the directolid_to_key()call indirect_getwithself.olid_to_key().series_autocompletethen overrides this method to return the correct/series/prefix, keeping the change minimal and the base class behaviour unchanged for all other autocomplete types.Technical
Testing
pytest openlibrary/plugins/worksearch/tests/test_autocomplete.py -v. All 4 tests pass, including two new tests covering bare OL ID and full URL lookup for seriesolid_to_keymapped theLsuffix to/lists/, causing the Solr query to searchkey:"/lists/OL327669L"which returned no resultsScreenshot
N/A only backend change
Stakeholders
@cdrini