Add matchedNotation field to search results for notation matches#1933
Open
fvogel wants to merge 1 commit intoNatLibFi:mainfrom
Open
Add matchedNotation field to search results for notation matches#1933fvogel wants to merge 1 commit intoNatLibFi:mainfrom
fvogel wants to merge 1 commit intoNatLibFi:mainfrom
Conversation
When searchByNotation is enabled and a concept is matched by its skos:notation, the labelpriority BIND block was missing priority 5/6 and transformConceptSearchResult() had no handler for notation matches. Add the missing BIND, SELECT/GROUP BY entries, and a result handler that populates a new matchedNotation field — parallel to the existing matchedPrefLabel — so API consumers can see why a concept matched. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
407c898 to
1f36809
Compare
|
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.



Summary
Fixes #1931 — adds a
matchedNotationfield to REST API search results when a concept is found via itsskos:notation, parallel to the existingmatchedPrefLabelfor prefLabel matches.Changes in
src/model/sparql/GenericSparql.php:BIND(IF((?pri = "5" || ?pri = "6"), ?match, ?unbound) as ?nlabel)in the$labelpriorityblock?nlabelto SELECT and GROUP BY clauseselseif (isset($row->nlabel))handler setting$hit['matchedNotation']Before (notation search
query=A.1):{ "prefLabel": "Cat", "notation": "A.1" }After:
{ "prefLabel": "Cat", "notation": "A.1", "matchedNotation": "A.1" }Test plan
query=A.1→ result includesmatchedNotation: "A.1"query=A.1.1→ result includesmatchedNotation: "A.1.1"query=Cat→ nomatchedNotationfield (prefLabel match, correct)Tested against Skosmos 3.1 with Fuseki 5.4.0,
searchByNotation true,sparqlDialect "JenaText".