Skip to content
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

Add tests for hl.ocr.q and hl.ocr.qparser parameters #376

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/test/java/com/github/dbmdz/solrocr/solr/HocrTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -559,4 +559,25 @@ public void testBrokenEntities() throws IOException {
req,
"contains(.//lst[@name='87372']//arr[@name='snippets']/lst/str[@name='text']/text(), 'dt_HiFi-i?cBßflpedx1ttonI-iii;_;ikW')");
}

public void testHlQParam() {
SolrQueryRequest req = xmlQ("q", "ocr_text:\"nathanael brush\"", "hl.q", "nathanael");
assertQ(
req,
"count(//arr[@name='snippets']/lst)='1'",
"contains(//arr[@name='snippets']/lst/str[@name='text'], '<em>Nathanael</em> Brush')");
}

public void testHlQParserParam() {
SolrQueryRequest req = xmlQ(
"defType", "lucene", "q", "ocr_text:\"nathanael brush\"",
"df", "ocr_text_stored", // should break hl.q if hl.qparser is not working properly
"hl.ocr.qparser", "edismax", "hl.ocr.q", "\"nathanael brush\"",
"qf", "ocr_text", // needed for hl.ocr.qparser to match the hl.ocr.q query
"hl.weightMatches", "true");
assertQ(
req,
"count(//arr[@name='snippets']/lst)='1'",
"contains(//arr[@name='snippets']/lst/str[@name='text'], '<em>Nathanael Brush</em>')");
}
}