lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject lucene-solr:branch_6x: SOLR-9187: Support dates and booleans in /export handler, support boolean DocValues fields
Date Sun, 12 Jun 2016 00:35:37 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 00584579b -> f1c74bb25


SOLR-9187: Support dates and booleans in /export handler, support boolean DocValues fields


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

Branch: refs/heads/branch_6x
Commit: f1c74bb250fb285b9fb2fe1e96a361fd0ed92ab2
Parents: 0058457
Author: Erick Erickson <erick@apache.org>
Authored: Sat Jun 11 10:25:07 2016 -0700
Committer: Erick Erickson <erick@apache.org>
Committed: Sat Jun 11 17:34:52 2016 -0700

----------------------------------------------------------------------
 .../apache/solr/schema/BooleanFieldTest.java    | 78 ++++++++++++++++++++
 1 file changed, 78 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1c74bb2/solr/core/src/test/org/apache/solr/schema/BooleanFieldTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/BooleanFieldTest.java b/solr/core/src/test/org/apache/solr/schema/BooleanFieldTest.java
new file mode 100644
index 0000000..8f13204
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/schema/BooleanFieldTest.java
@@ -0,0 +1,78 @@
+package org.apache.solr.schema;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.solr.SolrTestCaseJ4;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class BooleanFieldTest extends SolrTestCaseJ4 {
+  @BeforeClass
+  public static void beforeClass() throws Exception {
+    initCore("solrconfig-basic.xml", "schema15.xml");
+  }
+
+  // Note, docValues-based boolean tests are tested elsewhere refering to more appropriate
schemas
+  @Test
+  public void testBoolField() {
+
+    // found an odd case when adding booleans to docValues and noticed that we didn't have
any boolean
+    // specific tests. Only caught the odd case by accident so let's have a place for explicit
tests
+    assertU(adoc("id", "0")); // missing
+    assertU(adoc("id", "1", "bind", "true", "bsto", "true", "bindsto", "true", "bindstom",
"true", "bindstom", "false"));
+    assertU(adoc("id", "2", "bind", "false", "bsto", "false", "bindsto", "false", "bindstom",
"false", "bindstom", "true"));
+    assertU(adoc("id", "3", "bind", "false"));
+    assertU(adoc("id", "4", "bsto", "false"));
+    assertU(adoc("id", "5", "bindsto", "true"));
+    assertU(adoc("id", "6", "bindstom", "true"));
+    assertU(commit());
+
+    assertQ(req("q", "*:*", "sort", "id asc", "fl", "id,bind,bsto,bindsto,bindstom")
+        ,"count(//result/doc[1]/bool[@name='bind'])=0"
+        ,"count(//result/doc[1]/bool[@name='bsto'])=0"
+        ,"count(//result/doc[1]/bool[@name='bindsto'])=0"
+        ,"count(//result/doc[2]/bool[@name='bind'])=0"
+        ,"count(//result/doc[3]/bool[@name='bind'])=0"
+        ,"//result/doc[2]/bool[@name='bsto'][.='true']"
+        ,"//result/doc[2]/bool[@name='bindsto'][.='true']"
+        ,"//result/doc[3]/bool[@name='bsto'][.='false']"
+        ,"//result/doc[3]/bool[@name='bindsto'][.='false']"
+        ,"//result/doc[2]/arr[@name='bindstom']/bool[1][.='true']"
+        ,"//result/doc[2]/arr[@name='bindstom']/bool[2][.='false']"
+        ,"//result/doc[3]/arr[@name='bindstom']/bool[1][.='false']"
+        ,"//result/doc[3]/arr[@name='bindstom']/bool[2][.='true']"
+
+    );
+    
+    // Make sure faceting is behaving.
+    assertQ(req("q", "*:*", "facet", "true", 
+        "facet.field", "bind", 
+        "facet.field", "bsto",
+        "facet.field", "bindsto",
+        "facet.field", "bindstom"),
+        "//lst[@name='bind']/int[@name='false'][.='2']",
+        "//lst[@name='bind']/int[@name='true'][.='1']",
+        "//lst[@name='bsto'][not(node())]",
+        "//lst[@name='bsto'][not(node())]",
+        "//lst[@name='bindsto']/int[@name='false'][.='1']",
+        "//lst[@name='bindsto']/int[@name='true'][.='2']",
+        "//lst[@name='bindstom']/int[@name='false'][.='2']",
+        "//lst[@name='bindstom']/int[@name='true'][.='3']");
+  }
+
+}


Mime
View raw message