Mikep86 commented on code in PR #13587:
URL: https://github.com/apache/lucene/pull/13587#discussion_r1695262457


##########
lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinScorer.java:
##########
@@ -118,4 +110,114 @@ public void testScoreNone() throws IOException {
     reader.close();
     dir.close();
   }
+
+  public void testScoreMax() throws IOException {
+    try (Directory dir = newDirectory()) {
+      try (RandomIndexWriter w =
+          new RandomIndexWriter(
+              random(),
+              dir,
+              newIndexWriterConfig()
+                  .setMergePolicy(
+                      // retain doc id order
+                      newLogMergePolicy(random().nextBoolean())))) {
+
+        for (String[][] values :
+            Arrays.asList(
+                new String[][] {{"A", "B"}, {"A", "B", "C"}},
+                new String[][] {{"A"}, {"B"}},
+                new String[][] {{}},
+                new String[][] {{"A", "B", "C"}, {"A", "B", "C", "D"}},
+                new String[][] {{"B"}},
+                new String[][] {{"B", "C"}, {"A", "B"}, {"A", "C"}})) {
+
+          List<Document> docs = new ArrayList<>();
+          for (String[] value : values) {
+            Document childDoc = new Document();
+            childDoc.add(newStringField("type", "child", Field.Store.NO));
+            for (String v : value) {
+              childDoc.add(newStringField("value", v, Field.Store.NO));
+            }
+            docs.add(childDoc);
+          }
+
+          Document parentDoc = new Document();
+          parentDoc.add(newStringField("type", "parent", Field.Store.NO));
+          docs.add(parentDoc);
+
+          w.addDocuments(docs);
+        }
+
+        w.forceMerge(1);
+      }
+
+      try (IndexReader reader = DirectoryReader.open(dir)) {
+        IndexSearcher searcher = newSearcher(reader);
+
+        BooleanQuery childQuery =
+            new BooleanQuery.Builder()
+                .add(
+                    new BoostQuery(
+                        new ConstantScoreQuery(new TermQuery(new Term("value", 
"A"))), 2),
+                    BooleanClause.Occur.SHOULD)
+                .add(
+                    new ConstantScoreQuery(new TermQuery(new Term("value", 
"B"))),
+                    BooleanClause.Occur.SHOULD)
+                .add(
+                    new BoostQuery(
+                        new ConstantScoreQuery(new TermQuery(new Term("value", 
"C"))), 3),
+                    BooleanClause.Occur.SHOULD)
+                .add(
+                    new BoostQuery(
+                        new ConstantScoreQuery(new TermQuery(new Term("value", 
"D"))), 4),
+                    BooleanClause.Occur.SHOULD)
+                .setMinimumNumberShouldMatch(2)

Review Comment:
   This is just a holdover from the test I used as a template when writing 
this. I'll remove it.



-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to