zacharymorn commented on code in PR #1039:
URL: https://github.com/apache/lucene/pull/1039#discussion_r940877761
##########
lucene/core/src/test/org/apache/lucene/search/TestWANDScorer.java:
##########
@@ -947,4 +988,82 @@ public long cost() {
};
}
}
+
+ private static class WANDScorerQuery extends Query {
+ private final BooleanQuery query;
+
+ private WANDScorerQuery(BooleanQuery query) {
Review Comment:
Hmm do you mean for current caller pattern like the following:
```
Query query =
new BooleanQuery.Builder()
.add(
new WANDScorerQuery(
new BooleanQuery.Builder()
.add(
new BoostQuery(
new ConstantScoreQuery(new TermQuery(new
Term("foo", "A"))), 2),
Occur.SHOULD)
.add(
new ConstantScoreQuery(new TermQuery(new
Term("foo", "B"))),
Occur.SHOULD)
.add(
new BoostQuery(
new ConstantScoreQuery(new TermQuery(new
Term("foo", "D"))), 4),
Occur.SHOULD)
.setMinimumNumberShouldMatch(2)
.build()),
Occur.MUST)
.add(new TermQuery(new Term("foo", "C")), Occur.FILTER)
.build();
```
we would like to see if we can create the same via the following calling
pattern:
```
// missing Occur.MUST from the above between boolean queries
Query = new WANDScorerQuery(
new BooleanQuery.Builder()
.add(
new BoostQuery(
new ConstantScoreQuery(new TermQuery(new
Term("foo", "A"))), 2),
Occur.SHOULD)
.add(
new ConstantScoreQuery(new TermQuery(new
Term("foo", "B"))),
Occur.SHOULD)
.add(
new BoostQuery(
new ConstantScoreQuery(new TermQuery(new
Term("foo", "D"))), 4),
Occur.SHOULD)
.setMinimumNumberShouldMatch(2)
.build(),
new BooleanQuery.Builder().add(new TermQuery(new
Term("foo", "C")), Occur.FILTER).build());
```
I feel this constructor API may not be easy to capture the (boolean)
relationship between queries, and also allow non boolean queries to be passed
in, which may complicate logic inside the class?
--
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]