You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2017/09/02 15:43:15 UTC

[44/50] lucene-solr:feature/autoscaling: SOLR-11244: Add test for bool qparser in QueryEqualityTest

SOLR-11244: Add test for bool qparser in QueryEqualityTest


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/c141094f
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/c141094f
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/c141094f

Branch: refs/heads/feature/autoscaling
Commit: c141094f6bec699c78a7513d0ccef8b958c4606e
Parents: 6f6cdf9
Author: Cao Manh Dat <da...@apache.org>
Authored: Fri Sep 1 21:37:15 2017 +0700
Committer: Cao Manh Dat <da...@apache.org>
Committed: Fri Sep 1 21:37:15 2017 +0700

----------------------------------------------------------------------
 .../apache/solr/search/QueryEqualityTest.java   | 21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c141094f/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 6e74700..eab254f 100644
--- a/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
+++ b/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
@@ -1190,6 +1190,27 @@ public class QueryEqualityTest extends SolrTestCaseJ4 {
     }
   }
 
+  public void testBoolQuery() throws Exception {
+      assertQueryEquals("bool",
+          "{!bool must='{!lucene}foo_s:a' must='{!lucene}foo_s:b'}",
+          "{!bool must='{!lucene}foo_s:b' must='{!lucene}foo_s:a'}");
+    assertQueryEquals("bool",
+        "{!bool must_not='{!lucene}foo_s:a' should='{!lucene}foo_s:b' " +
+            "must='{!lucene}foo_s:c' filter='{!lucene}foo_s:d' filter='{!lucene}foo_s:e'}",
+        "{!bool must='{!lucene}foo_s:c' filter='{!lucene}foo_s:d' " +
+            "must_not='{!lucene}foo_s:a' should='{!lucene}foo_s:b' filter='{!lucene}foo_s:e'}");
+    try {
+      assertQueryEquals
+          ("bool"
+              , "{!bool must='{!lucene}foo_s:a'}"
+              , "{!bool should='{!lucene}foo_s:a'}"
+          );
+      fail("queries should not have been equal");
+    } catch(AssertionFailedError e) {
+      assertTrue("queries were not equal, as expected", true);
+    }
+  }
+
   // Override req to add df param
   public static SolrQueryRequest req(String... q) {
     return SolrTestCaseJ4.req(q, "df", "text");