Apache Solr open-source search software
SOLR-11244: Add test for bool qparser in QueryEqualityTest
Cao Manh Datc141094f6bec
diff --git a/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java b/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.javaindex 6e747001cd5..eab254fb3f4 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 parampublic static SolrQueryRequest req(String... q) {return SolrTestCaseJ4.req(q, "df", "text");