mirror of https://github.com/apache/lucene.git
Some additional testing to prove 'defered function computation' in a syntax variant i was recently asked about
(cherry picked from commit 852f02b4b7
)
This commit is contained in:
parent
b2796bf0c8
commit
d91f7856ba
|
@ -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 {
|
public class SOLR749Test extends SolrTestCaseJ4 {
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
|
@ -73,7 +77,7 @@ public class SOLR749Test extends SolrTestCaseJ4 {
|
||||||
"//result[@numFound=20]");
|
"//result[@numFound=20]");
|
||||||
assertEquals(20, CountUsageValueSourceParser.getAndClearCount("func_q_wrapping_fq"));
|
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)'})"),
|
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]");
|
"//result[@numFound=19]");
|
||||||
|
|
||||||
|
@ -83,6 +87,16 @@ public class SOLR749Test extends SolrTestCaseJ4 {
|
||||||
int count = CountUsageValueSourceParser.getAndClearCount("frange_in_bq");
|
int count = CountUsageValueSourceParser.getAndClearCount("frange_in_bq");
|
||||||
assertTrue("frange_in_bq: " + count, (19 <= count && count <= 20));
|
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
|
// non-cached frange queries should default to post-filtering
|
||||||
// (ie: only be computed on candidates of other q/fq restrictions)
|
// (ie: only be computed on candidates of other q/fq restrictions)
|
||||||
// regardless of how few/many docs match the frange
|
// regardless of how few/many docs match the frange
|
||||||
|
|
Loading…
Reference in New Issue