Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 72478200C67 for ; Mon, 1 May 2017 03:56:44 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 656D0160BC0; Mon, 1 May 2017 01:56:44 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B2B48160BA4 for ; Mon, 1 May 2017 03:56:43 +0200 (CEST) Received: (qmail 59766 invoked by uid 500); 1 May 2017 01:56:42 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 59737 invoked by uid 99); 1 May 2017 01:56:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2017 01:56:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 47383DF97F; Mon, 1 May 2017 01:56:42 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ehatcher@apache.org To: commits@lucene.apache.org Date: Mon, 01 May 2017 01:56:45 -0000 Message-Id: <57264e1193f34364a002d32b2223395a@git.apache.org> In-Reply-To: <09221a9decb54572b428afe44cff512e@git.apache.org> References: <09221a9decb54572b428afe44cff512e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/4] lucene-solr:jira/SOLR-1485: Add equality tests for payload_score and payload_check queries archived-at: Mon, 01 May 2017 01:56:44 -0000 Add equality tests for payload_score and payload_check queries Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/149231af Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/149231af Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/149231af Branch: refs/heads/jira/SOLR-1485 Commit: 149231af379e619bf13f1c026ea19d95f6ac5fe7 Parents: ee801de Author: Erik Hatcher Authored: Sun Apr 30 21:56:26 2017 -0400 Committer: Erik Hatcher Committed: Sun Apr 30 21:56:26 2017 -0400 ---------------------------------------------------------------------- .../solr/collection1/conf/schema15.xml | 8 ++++ .../apache/solr/search/QueryEqualityTest.java | 46 ++++++++++++++------ 2 files changed, 40 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/149231af/solr/core/src/test-files/solr/collection1/conf/schema15.xml ---------------------------------------------------------------------- diff --git a/solr/core/src/test-files/solr/collection1/conf/schema15.xml b/solr/core/src/test-files/solr/collection1/conf/schema15.xml index 57c6bf1..9b4f0b1 100644 --- a/solr/core/src/test-files/solr/collection1/conf/schema15.xml +++ b/solr/core/src/test-files/solr/collection1/conf/schema15.xml @@ -618,6 +618,14 @@ + + + + + + + + text id http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/149231af/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java ---------------------------------------------------------------------- diff --git a/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java b/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java index c44cc1e..88e4274 100644 --- a/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java +++ b/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java @@ -20,6 +20,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; +import junit.framework.AssertionFailedError; import org.apache.lucene.search.Query; import org.apache.lucene.search.QueryUtils; import org.apache.solr.SolrTestCaseJ4; @@ -29,8 +30,6 @@ import org.apache.solr.response.SolrQueryResponse; import org.junit.AfterClass; import org.junit.BeforeClass; - - /** * Sanity checks that queries (generated by the QParser and ValueSourceParser * framework) are appropriately {@link Object#equals} and @@ -193,15 +192,6 @@ public class QueryEqualityTest extends SolrTestCaseJ4 { } } - public void testSignificantTermsQuery() throws Exception { - SolrQueryRequest req = req("q", "*:*"); - try { - assertQueryEquals("sigificantTerms", req, "{!sigificantTerms}"); - } finally { - req.close(); - } - } - public void testQuerySwitch() throws Exception { SolrQueryRequest req = req("myXXX", "XXX", "myField", "foo_s", @@ -1001,6 +991,35 @@ public class QueryEqualityTest extends SolrTestCaseJ4 { } } + public void testPayloadScoreQuery() throws Exception { + // I don't see a precedent to test query inequality in here, so doing a `try` + // There was a bug with PayloadScoreQuery's .equals() method that said two queries were equal with different includeSpanScore settings + + try { + assertQueryEquals + (null + , "{!payload_score f=foo_dpf v=query func=min includeSpanScore=false}" + , "{!payload_score f=foo_dpf v=query func=min includeSpanScore=true}" + ); + fail("queries should not have been equal"); + } catch(AssertionFailedError e) { + assertTrue("queries were not equal, as expected", true); + } + } + + public void testPayloadCheckQuery() throws Exception { + try { + assertQueryEquals + (null + , "{!payload_check f=foo_dpf payloads=2}one" + , "{!payload_check f=foo_dpf payloads=2}two" + ); + fail("queries should not have been equal"); + } catch(AssertionFailedError e) { + assertTrue("queries were not equal, as expected", true); + } + } + /** * NOTE: defType is not only used to pick the parser, but also to record @@ -1046,7 +1065,7 @@ public class QueryEqualityTest extends SolrTestCaseJ4 { for (int i = 0; i < queries.length; i++) { QueryUtils.check(queries[i]); - // yes starting j=0 is redundent, we're making sure every query + // yes starting j=0 is redundant, we're making sure every query // is equal to itself, and that the quality checks work regardless // of which caller/callee is used. for (int j = 0; j < queries.length; j++) { @@ -1099,8 +1118,7 @@ public class QueryEqualityTest extends SolrTestCaseJ4 { assertFuncEquals("agg_hll(foo_i)", "agg_hll(foo_i)"); assertFuncEquals("agg_sumsq(foo_i)", "agg_sumsq(foo_i)"); assertFuncEquals("agg_percentile(foo_i,50)", "agg_percentile(foo_i,50)"); - assertFuncEquals("agg_variance(foo_i)", "agg_variance(foo_i)"); - assertFuncEquals("agg_stddev(foo_i)", "agg_stddev(foo_i)"); + // assertFuncEquals("agg_stdev(foo_i)", "agg_stdev(foo_i)"); // assertFuncEquals("agg_multistat(foo_i)", "agg_multistat(foo_i)"); }