-
Notifications
You must be signed in to change notification settings - Fork 11
Feature/libris search ns #1660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kwahlin
wants to merge
172
commits into
feature/typenormalization
Choose a base branch
from
feature/libris-search-ns
base: feature/typenormalization
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature/libris search ns #1660
Conversation
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
(At least issuance is a co-dependence.)
Split up for easier test runs.
and move mappings to separate JSON file (as an initial step, with the goal of picking the mappings directly from definitions data).
…l into feature/typenormalization
Adds functionality for merging query trees. When merging two trees **A** and **B**, only the parts of **B** that are compatible with **A** are kept, ensuring that the merged query remains valid. This is used to apply filters from the `_r` parameter and from `apps.jsonld`. Given - Q = input from `_q` - R = filters from `_r` - S = configured filters the merge sequence is: 1. Merge R into Q → QR 2. Merge S into QR → QRS (final query with all filters applied) Before merging, we need to know the subject types being queried. If Q specifies a type (e.g. `type:Agent`), we use that, otherwise we take it from R or S, resulting in `Q + Type(R)` (if present) or `Q + Type(S)`. For `_o` queries with curated predicates, some predicates may be incompatible with the current subject type. For example, if `Type(QRS) = Work` but a predicate `p` has domain `Agent`, we must include `type:Agent` in the query or no results will be returned for `p`. In that case, the query becomes `QRS OR (type:Agent AND p:o)`. For `_p` + `_o` queries, the domain of `p` takes precedence, i.e. the subject type of the query is determined entirely by `p`. If `p = instanceOf`, then `Type(QRS)` is set to `Instance`. Once the type of Q is set, we only merge the parts of R and S compatible with that type. See [QueryTree.merge()](https://github.com/libris/librisxl/blob/0bed4a0e965376608a58b3f39d59ea8e4916a926/whelk-core/src/main/groovy/whelk/search2/querytree/QueryTree.java#L48) and corresponding [unit tests](https://github.com/libris/librisxl/blob/0bed4a0e965376608a58b3f39d59ea8e4916a926/whelk-core/src/test/groovy/whelk/search2/querytree/QueryTreeSpec.groovy#L351) for details. Other improvements: - Proper search mapping is now generated for `_r`. - Work/Instance filters are adjusted automatically, e.g. `type:Audio` → `instanceOf.type:Audio` when merging into an `Instance` query, and `hasInstanceType:Electronic` → `type:Electronic`. - The query tree reduction logic (`Node.reduce()` / `Node.implies()`) has been refined to ensure correctness during merges. - `AppParams` simplified to store raw filters only. - `Filter` + `AliasedFilter` consolidated into single `FilterAlias` class. - `SelectedFilters` renamed to `SelectedFacets` and now only handles statistics/slices. - Skipped `p` aggregation for `_o` + `_p` queries since there is no current use case and this avoids unnecessary complexity with multi-query handling.
…l into feature/typenormalization
i.e. from an instance don't pull in all other instances linked to the same work. This fixes the problem where searching for an ISBN finds all other instances linked to the same work. For now only applied to integral relations.
…by-isbn fix(embellish): don't follow the same integral relation in reverse
…l into feature/typenormalization
…l into feature/typenormalization
* Handle hyphen-separated years as range * Refactor: Move @id/_str path appending to ES conversion phase * Simplify logic in SelectedFacets
olovy
approved these changes
Nov 7, 2025
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
bbf6593 to
bb5f342
Compare
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.
No description provided.