You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2020/02/25 20:21:22 UTC
[lucene-solr] branch master updated: Some additional testing to
prove 'defered function computation' in a syntax variant i was recently
asked about
This is an automated email from the ASF dual-hosted git repository.
hossman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/master by this push:
new 852f02b Some additional testing to prove 'defered function computation' in a syntax variant i was recently asked about
852f02b is described below
commit 852f02b4b7934aca0c4f82e3cf541b4149feafdc
Author: Chris Hostetter <ho...@apache.org>
AuthorDate: Tue Feb 25 13:21:13 2020 -0700
Some additional testing to prove 'defered function computation' in a syntax variant i was recently asked about
---
.../src/test/org/apache/solr/core/SOLR749Test.java | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/solr/core/src/test/org/apache/solr/core/SOLR749Test.java b/solr/core/src/test/org/apache/solr/core/SOLR749Test.java
index d3b5e32..d802899 100644
--- a/solr/core/src/test/org/apache/solr/core/SOLR749Test.java
+++ b/solr/core/src/test/org/apache/solr/core/SOLR749Test.java
@@ -23,9 +23,13 @@ import org.junit.BeforeClass;
/**
- * Test for https://issues.apache.org/jira/browse/SOLR-749
+ * This class started life as a test for SOLR-749 to prove that value source plugins were properly
+ * intialized, but it has since evolved to also help prove that ValueSource's are not asked to compute
+ * values for documents unneccessarily.
*
- **/
+ * @see CountUsageValueSourceParser
+ * @see <a href="https://issues.apache.org/jira/browse/SOLR-749">SOLR-749</a>
+ */
public class SOLR749Test extends SolrTestCaseJ4 {
@BeforeClass
public static void beforeClass() throws Exception {
@@ -73,15 +77,25 @@ public class SOLR749Test extends SolrTestCaseJ4 {
"//result[@numFound=20]");
assertEquals(20, CountUsageValueSourceParser.getAndClearCount("func_q_wrapping_fq"));
- assertQ("frange in complex bq w/ other mandatory clauses to check skipping",
+ assertQ("frange in complex boolean query w/ other mandatory clauses to check skipping",
req("q","{!notfoo}(+id_i1:[20 TO 39] -id:25 +{!frange l=4.5 u=4.5 v='countUsage(frange_in_bq,4.5)'})"),
"//result[@numFound=19]");
-
+
// don't assume specific clause evaluation ordering.
// ideally this is 19, but could be as high as 20 depending on whether frange's
// scorer has next() called on it before other clauses skipTo
int count = CountUsageValueSourceParser.getAndClearCount("frange_in_bq");
assertTrue("frange_in_bq: " + count, (19 <= count && count <= 20));
+
+ assertQ("func in complex boolean query w/ constant scoring mandatory clauses",
+ req("q","{!notfoo}(+id_i1:[20 TO 29]^0 +{!frange l=4.5 u=4.5 v='countUsage(func_in_bq,4.5)'})"),
+ "//result[@numFound=10]");
+
+ // don't assume specific clause evaluation ordering.
+ // ideally this is 10, but could be as high as 11 depending on whether func's
+ // scorer has next() called on it before other clauses skipTo
+ count = CountUsageValueSourceParser.getAndClearCount("func_in_bq");
+ assertTrue("func_in_bq: " + count, (10 <= count && count <= 11));
// non-cached frange queries should default to post-filtering
// (ie: only be computed on candidates of other q/fq restrictions)