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
fix: Exclude characters with special meaning in Lucene Query Parser syntax from searchbylabel search (DEV-1446) #2269
Changes from all commits
1d3b497
d4dd090
faab714
0b8c9d2
dce9df8
46327a1
267d686
3124a70
14a4614
c672705
caedbce
89c8aa2
b79723d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{ | ||
"knora-api:arkUrl": { | ||
"@value": "http://0.0.0.0:3336/ark:/72163/1/0001/book=instance=04K", | ||
"@type": "xsd:anyURI" | ||
}, | ||
"rdfs:label": "Treasure Island", | ||
"knora-api:versionArkUrl": { | ||
"@value": "http://0.0.0.0:3336/ark:/72163/1/0001/book=instance=04K.20191129T100000673298Z", | ||
"@type": "xsd:anyURI" | ||
}, | ||
"knora-api:attachedToProject": { | ||
"@id": "http://rdfh.ch/projects/Lw3FC39BSzCwvmdOaTyLqQ" | ||
}, | ||
"knora-api:userHasPermission": "RV", | ||
"knora-api:creationDate": { | ||
"@value": "2019-11-29T10:00:00.673298Z", | ||
"@type": "xsd:dateTimeStamp" | ||
}, | ||
"knora-api:hasPermissions": "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:KnownUser|RV knora-admin:UnknownUser", | ||
"@type": "books:Book", | ||
"books:hasTextType": { | ||
"knora-api:arkUrl": { | ||
"@value": "http://0.0.0.0:3336/ark:/72163/1/0001/book=instance=04K/00list_value_adventurQo", | ||
"@type": "xsd:anyURI" | ||
}, | ||
"knora-api:userHasPermission": "RV", | ||
"knora-api:valueCreationDate": { | ||
"@value": "2018-05-29T16:42:04.381Z", | ||
"@type": "xsd:dateTimeStamp" | ||
}, | ||
"knora-api:attachedToUser": { | ||
"@id": "http://rdfh.ch/users/BhkfBc3hTeS_IDo-JgXRbQ" | ||
}, | ||
"knora-api:valueHasUUID": "00list_value_adventurQ", | ||
"knora-api:hasPermissions": "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:KnownUser|RV knora-admin:UnknownUser", | ||
"@type": "knora-api:ListValue", | ||
"@id": "http://rdfh.ch/0001/book-instance-04/values/has-list-value-03", | ||
"knora-api:listValueAsListNode": { | ||
"@id": "http://rdfh.ch/lists/0001/ynm02-05" | ||
}, | ||
"knora-api:versionArkUrl": { | ||
"@value": "http://0.0.0.0:3336/ark:/72163/1/0001/book=instance=04K/00list_value_adventurQo.20180529T164204381Z", | ||
"@type": "xsd:anyURI" | ||
} | ||
}, | ||
"@id": "http://rdfh.ch/0001/book-instance-04", | ||
"books:hasTitle": { | ||
"knora-api:valueAsString": "Treasure Island", | ||
"knora-api:arkUrl": { | ||
"@value": "http://0.0.0.0:3336/ark:/72163/1/0001/book=instance=04K/IN4R19yYR0ygi3K2VEHpUQe", | ||
"@type": "xsd:anyURI" | ||
}, | ||
"knora-api:versionArkUrl": { | ||
"@value": "http://0.0.0.0:3336/ark:/72163/1/0001/book=instance=04K/IN4R19yYR0ygi3K2VEHpUQe.20180529T164204381Z", | ||
"@type": "xsd:anyURI" | ||
}, | ||
"knora-api:userHasPermission": "RV", | ||
"knora-api:valueCreationDate": { | ||
"@value": "2018-05-29T16:42:04.381Z", | ||
"@type": "xsd:dateTimeStamp" | ||
}, | ||
"knora-api:attachedToUser": { | ||
"@id": "http://rdfh.ch/users/BhkfBc3hTeS_IDo-JgXRbQ" | ||
}, | ||
"knora-api:valueHasUUID": "IN4R19yYR0ygi3K2VEHpUQ", | ||
"knora-api:hasPermissions": "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:KnownUser|RV knora-admin:UnknownUser", | ||
"@type": "knora-api:TextValue", | ||
"@id": "http://rdfh.ch/0001/book-instance-04/values/has-title-value-04" | ||
}, | ||
"knora-api:attachedToUser": { | ||
"@id": "http://rdfh.ch/users/9XBCrDV3SRa7kS1WwynB4Q" | ||
}, | ||
"@context": { | ||
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", | ||
"knora-api": "http://api.knora.org/ontology/knora-api/v2#", | ||
"rdfs": "http://www.w3.org/2000/01/rdf-schema#", | ||
"books": "http://0.0.0.0:3333/ontology/0001/books/v2#", | ||
"xsd": "http://www.w3.org/2001/XMLSchema#" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"knora-api:arkUrl": { | ||
"@value": "http://0.0.0.0:3336/ark:/72163/1/0001/book=instance=05I", | ||
"@type": "xsd:anyURI" | ||
}, | ||
"rdfs:label": "this .,:; is + a - test & with \\ special ( characters ) in [] {} | the || label?!", | ||
"knora-api:versionArkUrl": { | ||
"@value": "http://0.0.0.0:3336/ark:/72163/1/0001/book=instance=05I.20191129T100000673298Z", | ||
"@type": "xsd:anyURI" | ||
}, | ||
"knora-api:attachedToProject": { | ||
"@id": "http://rdfh.ch/projects/Lw3FC39BSzCwvmdOaTyLqQ" | ||
}, | ||
"knora-api:userHasPermission": "V", | ||
"knora-api:creationDate": { | ||
"@value": "2019-11-29T10:00:00.673298Z", | ||
"@type": "xsd:dateTimeStamp" | ||
}, | ||
"knora-api:hasPermissions": "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:KnownUser,knora-admin:UnknownUser", | ||
"@type": "books:Book", | ||
"@id": "http://rdfh.ch/0001/book-instance-05", | ||
"books:hasTitle": { | ||
"knora-api:valueAsString": "A title", | ||
"knora-api:arkUrl": { | ||
"@value": "http://0.0.0.0:3336/ark:/72163/1/0001/book=instance=05I/dFLLWiihTAqxJsh0iTQ1HQ0", | ||
"@type": "xsd:anyURI" | ||
}, | ||
"knora-api:versionArkUrl": { | ||
"@value": "http://0.0.0.0:3336/ark:/72163/1/0001/book=instance=05I/dFLLWiihTAqxJsh0iTQ1HQ0.20180529T164204381Z", | ||
"@type": "xsd:anyURI" | ||
}, | ||
"knora-api:userHasPermission": "RV", | ||
"knora-api:valueCreationDate": { | ||
"@value": "2018-05-29T16:42:04.381Z", | ||
"@type": "xsd:dateTimeStamp" | ||
}, | ||
"knora-api:attachedToUser": { | ||
"@id": "http://rdfh.ch/users/BhkfBc3hTeS_IDo-JgXRbQ" | ||
}, | ||
"knora-api:valueHasUUID": "dFLLWiihTAqxJsh0iTQ1HQ", | ||
"knora-api:hasPermissions": "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:KnownUser|RV knora-admin:UnknownUser", | ||
"@type": "knora-api:TextValue", | ||
"@id": "http://rdfh.ch/0001/book-instance-05/values/has-title-value-05" | ||
}, | ||
"knora-api:attachedToUser": { | ||
"@id": "http://rdfh.ch/users/9XBCrDV3SRa7kS1WwynB4Q" | ||
}, | ||
"@context": { | ||
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", | ||
"knora-api": "http://api.knora.org/ontology/knora-api/v2#", | ||
"rdfs": "http://www.w3.org/2000/01/rdf-schema#", | ||
"books": "http://0.0.0.0:3333/ontology/0001/books/v2#", | ||
"xsd": "http://www.w3.org/2001/XMLSchema#" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ | |
SELECT (count(distinct ?resource) as ?count) | ||
} | ||
WHERE { | ||
?resource <http://jena.apache.org/text#query> "@searchTerm.generateLiteralForLuceneIndexWithoutExactSequence" . | ||
?resource <http://jena.apache.org/text#query> (rdfs:label "@searchTerm.generateLiteralForLuceneIndexWithoutExactSequence") . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what influence does this change have? has our search by label been defective all along? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The update doesn't affect anything. It's just good practice to be as explicit as possible, according to the Apache Jena documentation, so I thought I add this. |
||
|
||
?resource a ?resourceClass ; | ||
rdfs:label ?label . | ||
|
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.
is this step still necessary if we replace some special characters anyways? I haven't checked - but I thought that just replaces some characters too
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.
toSparqlEncodedString
returns an error when there is a new line or an empty string handed over. Also, the characters that are replaced are different than the ones that are replaced because of the Lucene Query Parser syntax. I thought it is better to leave them both separate - although there is some overlap (\"
and\\
).