fix(facet-count): count library facets by document#4169
Conversation
WalkthroughDocument indexing now stores document-level organisation, library, and location keyword lists derived from holdings. Facet configuration uses these fields instead of nested holding aggregations. Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rero_ils/modules/documents/serializers/json.py`:
- Around line 201-202: Update the organisation aggregation handling in the
serializer to materialize the doc_count filter as a list and assign that list
back to aggregations["organisation"]["buckets"]. Keep the existing nonzero-count
predicate and subsequent iteration unchanged so global views serialize only
populated organisation buckets.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d598bd13-417d-475a-9d9d-ebcc6be1c1d0
📒 Files selected for processing (5)
rero_ils/config.pyrero_ils/modules/documents/dumpers/indexer.pyrero_ils/modules/documents/mappings/v7/documents/document-v0.0.1.jsonrero_ils/modules/documents/serializers/json.pytests/unit/documents/test_document_organisation_facets.py
d26a837 to
80d6f1b
Compare
43c09d0 to
f5786ca
Compare
* Replaces nested facet aggregations with indexed organisation library location paths. * Stores unique pid combinations in organisation_library_location. * Uses those paths to count documents instead of holdings. * Rebuilds the same facet tree for the UI. * Replaces rero/rero-ils-ui#1508 and rero/ng-core#831. * Closes rero#4003 Co-Authored-by: Ana Gomes <anagoncalves7@icloud.com>
f5786ca to
d8effb5
Compare
Note: this change adds new indexed fields for document facet counts. Existing records need to be reindexed for the corrected organisation/library/location counts to be available.