feat(items): add sort_call_number index fields#4047
feat(items): add sort_call_number index fields#4047PascalRepond merged 1 commit intorero:stagingfrom
Conversation
be9ee9a to
65f5228
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughAdds dedicated Elasticsearch sort fields for items: Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/ui/holdings/test_issues_reindex.py (1)
125-157: Scope sort-field assertions by item PID for stronger test determinism.These checks currently count all matching docs in the index. Filtering by
pid=item.pidmakes the assertions robust against incidental fixture overlap.♻️ Proposed fix
- assert ItemsSearch().filter("term", sort_call_number="cote1").count() == 1 + assert ( + ItemsSearch() + .filter("term", pid=item.pid) + .filter("term", sort_call_number="cote1") + .count() + == 1 + ) @@ - assert ItemsSearch().filter("term", sort_call_number="item-own-cote").count() == 1 - assert ItemsSearch().filter("term", sort_call_number="cote1").count() == 0 + assert ( + ItemsSearch() + .filter("term", pid=item.pid) + .filter("term", sort_call_number="item-own-cote") + .count() + == 1 + ) + assert ( + ItemsSearch() + .filter("term", pid=item.pid) + .filter("term", sort_call_number="cote1") + .count() + == 0 + ) @@ - assert ItemsSearch().filter("term", sort_call_number="cote1").count() == 1 + assert ( + ItemsSearch() + .filter("term", pid=item.pid) + .filter("term", sort_call_number="cote1") + .count() + == 1 + ) @@ - assert ItemsSearch().filter("term", sort_second_call_number="cote2").count() == 1 - assert ItemsSearch().filter("term", sort_call_number="cote1").count() == 0 + assert ( + ItemsSearch() + .filter("term", pid=item.pid) + .filter("term", sort_second_call_number="cote2") + .count() + == 1 + ) + assert ( + ItemsSearch() + .filter("term", pid=item.pid) + .filter("term", sort_call_number="cote1") + .count() + == 0 + )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/ui/holdings/test_issues_reindex.py` around lines 125 - 157, The assertions in test_issues_reindex.py use ItemsSearch().filter(...) without scoping to the specific item, causing flakiness; update each ItemsSearch().filter call (including checks for sort_call_number, sort_second_call_number, issue__inherited_first_call_number__raw, issue__inherited_second_call_number__raw, call_numbers__raw, etc.) to also filter by pid=item.pid so the counts only consider the target item; locate these calls around the block that reindexes the item/holding (referencing the item variable and Item.get_record(item.id)) and add the pid filter to each assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/ui/holdings/test_issues_reindex.py`:
- Around line 125-157: The assertions in test_issues_reindex.py use
ItemsSearch().filter(...) without scoping to the specific item, causing
flakiness; update each ItemsSearch().filter call (including checks for
sort_call_number, sort_second_call_number,
issue__inherited_first_call_number__raw,
issue__inherited_second_call_number__raw, call_numbers__raw, etc.) to also
filter by pid=item.pid so the counts only consider the target item; locate these
calls around the block that reindexes the item/holding (referencing the item
variable and Item.get_record(item.id)) and add the pid filter to each assertion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9978fe17-a5cf-486d-9dd3-017edc39e150
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (5)
rero_ils/config.pyrero_ils/modules/items/listener.pyrero_ils/modules/items/mappings/v7/items/item-v0.0.1.jsontests/ui/holdings/test_issues_reindex.pytests/ui/items/test_items_mapping.py
65f5228 to
9e6f478
Compare
* Closes rero#4009. * Updates dependencies. *⚠️ Requires a full reindex of items. Co-Authored-by: Pascal Repond <pascal.repond@rero.ch>
9e6f478 to
f35f9df
Compare
Uh oh!
There was an error while loading. Please reload this page.