jainankitk commented on code in PR #15635:
URL: https://github.com/apache/lucene/pull/15635#discussion_r2756567721


##########
lucene/highlighter/src/test/org/apache/lucene/search/vectorhighlight/TestFieldPhraseList.java:
##########
@@ -289,4 +289,21 @@ private <T extends Comparable<T>> void 
assertConsistentLessThan(T a, T b) {
     assertTrue(a.compareTo(b) < 0);
     assertTrue(b.compareTo(a) > 0);
   }
+
+  public void testMergeOverlappingWeightedPhraseInfoAccumulateBoost() {
+    LinkedList<TermInfo> infos1 = new LinkedList<>();
+    infos1.add(new TermInfo("中国", 0, 2, 0, 0));
+    infos1.add(new TermInfo("经济", 3, 5, 1, 1));
+    WeightedPhraseInfo wpi1 = new WeightedPhraseInfo(infos1, 2.0f);
+
+    LinkedList<TermInfo> infos2 = new LinkedList<>();
+    infos2.add(new TermInfo("经济", 3, 5, 1, 1));
+    infos2.add(new TermInfo("发展", 6, 8, 2, 2));
+    WeightedPhraseInfo wpi2 = new WeightedPhraseInfo(infos2, 3.0f);
+
+    // trigger merge
+    WeightedPhraseInfo merged = new WeightedPhraseInfo(java.util.List.of(wpi1, 
wpi2));
+
+    assertEquals(5.0f, merged.getBoost(), 0.0001f);
+  }

Review Comment:
   This unit test does not seem to exercise the code change. I ran it without 
the code change and that passed!



-- 
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]

Reply via email to