dsmiley commented on code in PR #15434:
URL: https://github.com/apache/lucene/pull/15434#discussion_r2648525324
##########
lucene/highlighter/src/test/org/apache/lucene/search/vectorhighlight/TestFieldQuery.java:
##########
@@ -814,6 +815,48 @@ public void testQueryPhraseMapOverlap2gram() throws
Exception {
assertEquals(0, qpm2.subMap.size());
}
+ public void testQueryPhraseMapDuplicate() throws IOException {
+ BooleanQuery.Builder query = new BooleanQuery.Builder();
+ Query bq = toPhraseQuery(analyze("a b c", F, analyzerB), F);
+ bq = new BoostQuery(bq, 100);
+ query.add(bq, Occur.SHOULD);
+
+ bq = toPhraseQuery(analyze("a b", F, analyzerB), F);
+ bq = new BoostQuery(bq, 20);
+ query.add(bq, Occur.SHOULD);
+
+ bq = toPhraseQuery(analyze("b c", F, analyzerB), F);
+ bq = new BoostQuery(bq, 50);
+ query.add(bq, Occur.SHOULD);
+
+ bq = query.build();
+ FieldQuery fq = new FieldQuery(bq, true, true);
+ Set<Query> flatQueries = new LinkedHashSet<>();
+ fq.flatten(bq, searcher, flatQueries, 1f);
+
+ assertCollectionQueries(
+ fq.expand(flatQueries),
+ pqF(100, "a", "b", "c"),
+ pqF(20, "a", "b"),
+ // "a b c": 1 -> expanded from "a b" + "b c"
+ new BoostQuery(pqF(1f, "a", "b", "c"), 1f),
+ pqF(50, "b", "c"));
+
+ Map<String, QueryPhraseMap> map = fq.rootMaps;
+ QueryPhraseMap qpm = map.get("f").subMap.get("a");
Review Comment:
I find the variable name choices here confusing. For example, should this
one be `a_qpm` maybe?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]