lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject svn commit: r980610 [2/2] - in /lucene/dev/branches/branch_3x/solr: ./ example/ lib/ src/ src/common/org/apache/solr/common/ src/common/org/apache/solr/common/params/ src/java/org/apache/solr/analysis/ src/java/org/apache/solr/handler/component/ src/ja...
Date Thu, 29 Jul 2010 23:54:55 GMT
Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/request/SimpleFacetsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/request/SimpleFacetsTest.java?rev=980610&r1=980609&r2=980610&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/request/SimpleFacetsTest.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/request/SimpleFacetsTest.java
Thu Jul 29 23:54:54 2010
@@ -18,36 +18,75 @@
 package org.apache.solr.request;
 
 import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.util.AbstractSolrTestCase;
 import org.junit.BeforeClass;
-import org.junit.After;
 import org.junit.Test;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Random;
 
-public class SimpleFacetsTest extends SolrTestCaseJ4 {
 
+public class SimpleFacetsTest extends SolrTestCaseJ4 {
   @BeforeClass
   public static void beforeClass() throws Exception {
     initCore("solrconfig.xml","schema.xml");
+    createIndex();
+  }
+
+  static Random rand = new Random(); // TODO: a way to use lucene's newRandom()?
+  static int random_commit_percent = 30;
+  static int random_dupe_percent = 25;   // some duplicates in the index to create deleted
docs
+
+  static void randomCommit(int percent_chance) {
+    if (rand.nextInt(100) <= percent_chance)
+      assertU(commit());
+  }
+
+  static ArrayList<String[]> pendingDocs = new ArrayList<String[]>();
+
+  // committing randomly gives different looking segments each time
+  static void add_doc(String... fieldsAndValues) {
+    do {
+      pendingDocs.add(fieldsAndValues);      
+    } while (rand.nextInt(100) <= random_dupe_percent);
+
+    // assertU(adoc(fieldsAndValues));
+    // randomCommit(random_commit_percent);
+  }
+
+
+  static void createIndex() {
+    indexSimpleFacetCounts();
+    indexDateFacets();
+    indexFacetSingleValued();
+    indexFacetPrefixMultiValued();
+    indexFacetPrefixSingleValued();
+    
+   Collections.shuffle(pendingDocs, rand);
+    for (String[] doc : pendingDocs) {
+      assertU(adoc(doc));
+      randomCommit(random_commit_percent);
+    }
+    assertU(commit());
+  }
+
+  static void indexSimpleFacetCounts() {
+    add_doc("id", "42", "trait_s", "Tool", "trait_s", "Obnoxious",
+                 "name", "Zapp Brannigan");
+    add_doc("id", "43" ,
+                 "title", "Democratic Order of Planets");
+    add_doc("id", "44", "trait_s", "Tool",
+                 "name", "The Zapper");
+    add_doc("id", "45", "trait_s", "Chauvinist",
+                 "title", "25 star General");
+    add_doc("id", "46", "trait_s", "Obnoxious",
+                 "subject", "Defeated the pacifists of the Gandhi nebula");
+    add_doc("id", "47", "trait_s", "Pig",
+                 "text", "line up and fly directly at the enemy death cannons, clogging them
with wreckage!");   
   }
 
   @Test
   public void testSimpleFacetCounts() {
-    assertU(adoc("id", "42", "trait_s", "Tool", "trait_s", "Obnoxious",
-                 "name", "Zapp Brannigan"));
-    assertU(adoc("id", "43" ,
-                 "title", "Democratic Order of Planets"));
-    assertU(commit());
-    assertU(adoc("id", "44", "trait_s", "Tool",
-                 "name", "The Zapper"));
-    assertU(adoc("id", "45", "trait_s", "Chauvinist",
-                 "title", "25 star General"));
-    assertU(adoc("id", "46", "trait_s", "Obnoxious",
-                 "subject", "Defeated the pacifists of the Gandhi nebula"));
-    assertU(commit());
-    assertU(adoc("id", "47", "trait_s", "Pig",
-                 "text", "line up and fly directly at the enemy death cannons, clogging them
with wreckage!"));
-    assertU(commit());
  
     assertQ("standard request handler returns all matches",
             req("id:[42 TO 47]"),
@@ -219,29 +258,23 @@ public class SimpleFacetsTest extends So
   }
 
   public static void indexDateFacets() {
-    final String i = "id";
     final String f = "bday";
-    final String ff = "a_tdt";
-    final String ooo = "00:00:00.000Z";
-    final String xxx = "15:15:15.155Z";
-
-    assertU(adoc(i, "201",  f, "1976-07-04T12:08:56.235Z", ff, "1900-01-01T"+ooo));
-    assertU(adoc(i, "202",  f, "1976-07-05T00:00:00.000Z", ff, "1976-07-01T"+ooo));
-    assertU(adoc(i, "203",  f, "1976-07-15T00:07:67.890Z", ff, "1976-07-04T"+ooo));
-    assertU(commit());
-    assertU(adoc(i, "204",  f, "1976-07-21T00:07:67.890Z", ff, "1976-07-05T"+ooo));
-    assertU(adoc(i, "205",  f, "1976-07-13T12:12:25.255Z", ff, "1976-07-05T"+xxx));
-    assertU(adoc(i, "206",  f, "1976-07-03T17:01:23.456Z", ff, "1976-07-07T"+ooo));
-    assertU(adoc(i, "207",  f, "1976-07-12T12:12:25.255Z", ff, "1976-07-13T"+ooo));
-    assertU(commit());
-    assertU(adoc(i, "208",  f, "1976-07-15T15:15:15.155Z", ff, "1976-07-13T"+xxx));
-    assertU(adoc(i, "209",  f, "1907-07-12T13:13:23.235Z", ff, "1976-07-15T"+xxx));
-    assertU(adoc(i, "2010", f, "1976-07-03T11:02:45.678Z", ff, "2000-01-01T"+ooo));
-    assertU(adoc(i, "2011", f, "1907-07-12T12:12:25.255Z"));
-    assertU(adoc(i, "2012", f, "2007-07-30T07:07:07.070Z"));
-    assertU(adoc(i, "2013", f, "1976-07-30T22:22:22.222Z"));
-    assertU(adoc(i, "2014", f, "1976-07-05T22:22:22.222Z"));
-    assertU(commit());
+    final String pre = "//lst[@name='facet_dates']/lst[@name='"+f+"']";
+
+    add_doc("id", "201",  f, "1976-07-04T12:08:56.235Z");
+    add_doc("id", "202",  f, "1976-07-05T00:00:00.000Z");
+    add_doc("id", "203",  f, "1976-07-15T00:07:67.890Z");
+    add_doc("id", "204",  f, "1976-07-21T00:07:67.890Z");
+    add_doc("id", "205",  f, "1976-07-13T12:12:25.255Z");
+    add_doc("id", "206",  f, "1976-07-03T17:01:23.456Z");
+    add_doc("id", "207",  f, "1976-07-12T12:12:25.255Z");
+    add_doc("id", "208",  f, "1976-07-15T15:15:15.155Z");
+    add_doc("id", "209",  f, "1907-07-12T13:13:23.235Z");
+    add_doc("id", "2010", f, "1976-07-03T11:02:45.678Z");
+    add_doc("id", "2011", f, "1907-07-12T12:12:25.255Z");
+    add_doc("id", "2012", f, "2007-07-30T07:07:07.070Z");
+    add_doc("id", "2013", f, "1976-07-30T22:22:22.222Z");
+    add_doc("id", "2014", f, "1976-07-05T22:22:22.222Z");
   }
 
   @Test
@@ -249,8 +282,6 @@ public class SimpleFacetsTest extends So
     final String f = "bday";
     final String pre = "//lst[@name='facet_dates']/lst[@name='"+f+"']";
 
-    indexDateFacets();
-
     assertQ("check counts for month of facet by day",
             req( "q", "*:*"
                 ,"rows", "0"
@@ -354,42 +385,6 @@ public class SimpleFacetsTest extends So
             ,pre+"/int[@name='between'][.='11']"
             );
 
-    assertQ("check before is not inclusive of upper bound by default",
-            req("q", "*:*"
-                ,"rows", "0"
-                ,"facet", "true"
-                ,"facet.date", f
-                ,"facet.date.start",  "1976-07-05T00:00:00.000Z"
-                ,"facet.date.end",    "1976-07-07T00:00:00.000Z"
-                ,"facet.date.gap",    "+1DAY"
-                ,"facet.date.other",  "all"
-                )
-            // 2 gaps + pre+post+inner = 5
-            ,"*[count("+pre+"/int)=5]"
-            ,pre+"/int[@name='1976-07-05T00:00:00Z'][.='2'  ]"
-            ,pre+"/int[@name='1976-07-06T00:00:00Z'][.='0'  ]"
-            
-            ,pre+"/int[@name='before' ][.='5']"
-            );
-    assertQ("check after is not inclusive of lower bound by default",
-            req("q", "*:*"
-                ,"rows", "0"
-                ,"facet", "true"
-                ,"facet.date", f
-                ,"facet.date.start",  "1976-07-03T00:00:00.000Z"
-                ,"facet.date.end",    "1976-07-05T00:00:00.000Z"
-                ,"facet.date.gap",    "+1DAY"
-                ,"facet.date.other",  "all"
-                )
-            // 2 gaps + pre+post+inner = 5
-            ,"*[count("+pre+"/int)=5]"
-            ,pre+"/int[@name='1976-07-03T00:00:00Z'][.='2'  ]"
-            ,pre+"/int[@name='1976-07-04T00:00:00Z'][.='2'  ]"
-            
-            ,pre+"/int[@name='after' ][.='8']"
-            );
-            
-
     assertQ("check hardend=false",
             req( "q", "*:*"
                 ,"rows", "0"
@@ -436,342 +431,43 @@ public class SimpleFacetsTest extends So
     
   }
 
-  /** similar to testDateFacets, but a differnet field with test data 
-      exactly on on boundary marks */
-  @Test
-  public void testDateFacetsWithIncludeOption() {
-    final String f = "a_tdt";
-    final String pre = "//lst[@name='facet_dates']/lst[@name='"+f+"']";
-
-    indexDateFacets();
-
-    assertQ("checking counts for lower",
-            req( "q", "*:*"
-                ,"rows", "0"
-                ,"facet", "true"
-                ,"facet.date", f
-                ,"facet.date.start", "1976-07-01T00:00:00.000Z"
-                ,"facet.date.end",   "1976-07-16T00:00:00.000Z"
-                ,"facet.date.gap",   "+1DAY"
-                ,"facet.date.other", "all"
-                ,"facet.date.include", "lower"
-                )
-            // 15 days + pre+post+inner = 18
-            ,"*[count("+pre+"/int)=18]"
-            ,pre+"/int[@name='1976-07-01T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-02T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-03T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-04T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-05T00:00:00Z'][.='2'  ]"
-            ,pre+"/int[@name='1976-07-06T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-07T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-08T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-09T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-10T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-11T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-12T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-13T00:00:00Z'][.='2'  ]"
-            ,pre+"/int[@name='1976-07-14T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-15T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='before' ][.='1']"
-            ,pre+"/int[@name='after'  ][.='1']"
-            ,pre+"/int[@name='between'][.='8']"
-            );
-
-    assertQ("checking counts for upper",
-            req( "q", "*:*"
-                ,"rows", "0"
-                ,"facet", "true"
-                ,"facet.date", f
-                ,"facet.date.start", "1976-07-01T00:00:00.000Z"
-                ,"facet.date.end",   "1976-07-16T00:00:00.000Z"
-                ,"facet.date.gap",   "+1DAY"
-                ,"facet.date.other", "all"
-                ,"facet.date.include", "upper"
-                )
-            // 15 days + pre+post+inner = 18
-            ,"*[count("+pre+"/int)=18]"
-            ,pre+"/int[@name='1976-07-01T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-02T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-03T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-04T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-05T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-06T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-07T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-08T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-09T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-10T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-11T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-12T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-13T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-14T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-15T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='before' ][.='2']"
-            ,pre+"/int[@name='after'  ][.='1']"
-            ,pre+"/int[@name='between'][.='7']"
-            );
-
-    assertQ("checking counts for lower & upper",
-            req( "q", "*:*"
-                ,"rows", "0"
-                ,"facet", "true"
-                ,"facet.date", f
-                ,"facet.date.start", "1976-07-01T00:00:00.000Z"
-                ,"facet.date.end",   "1976-07-16T00:00:00.000Z"
-                ,"facet.date.gap",   "+1DAY"
-                ,"facet.date.other", "all"
-                ,"facet.date.include", "lower"
-                ,"facet.date.include", "upper"
-                )
-            // 15 days + pre+post+inner = 18
-            ,"*[count("+pre+"/int)=18]"
-            ,pre+"/int[@name='1976-07-01T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-02T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-03T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-04T00:00:00Z'][.='2'  ]"
-            ,pre+"/int[@name='1976-07-05T00:00:00Z'][.='2'  ]"
-            ,pre+"/int[@name='1976-07-06T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-07T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-08T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-09T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-10T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-11T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-12T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-13T00:00:00Z'][.='2'  ]"
-            ,pre+"/int[@name='1976-07-14T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-15T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='before' ][.='1']"
-            ,pre+"/int[@name='after'  ][.='1']"
-            ,pre+"/int[@name='between'][.='8']"
-            );
-
-    assertQ("checking counts for upper & edge",
-            req( "q", "*:*"
-                ,"rows", "0"
-                ,"facet", "true"
-                ,"facet.date", f
-                ,"facet.date.start", "1976-07-01T00:00:00.000Z"
-                ,"facet.date.end",   "1976-07-16T00:00:00.000Z"
-                ,"facet.date.gap",   "+1DAY"
-                ,"facet.date.other", "all"
-                ,"facet.date.include", "upper"
-                ,"facet.date.include", "edge"
-                )
-            // 15 days + pre+post+inner = 18
-            ,"*[count("+pre+"/int)=18]"
-            ,pre+"/int[@name='1976-07-01T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-02T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-03T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-04T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-05T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-06T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-07T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-08T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-09T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-10T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-11T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-12T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-13T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-14T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-15T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='before' ][.='1']"
-            ,pre+"/int[@name='after'  ][.='1']"
-            ,pre+"/int[@name='between'][.='8']"
-            );
-
-    assertQ("checking counts for upper & outer",
-            req( "q", "*:*"
-                ,"rows", "0"
-                ,"facet", "true"
-                ,"facet.date", f
-                ,"facet.date.start", "1976-07-01T00:00:00.000Z"
-                ,"facet.date.end",   "1976-07-13T00:00:00.000Z" // smaller now
-                ,"facet.date.gap",   "+1DAY"
-                ,"facet.date.other", "all"
-                ,"facet.date.include", "upper"
-                ,"facet.date.include", "outer"
-                )
-            // 12 days + pre+post+inner = 15
-            ,"*[count("+pre+"/int)=15]"
-            ,pre+"/int[@name='1976-07-01T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-02T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-03T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-04T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-05T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-06T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-07T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-08T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-09T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-10T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-11T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-12T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='before' ][.='2']"
-            ,pre+"/int[@name='after'  ][.='4']"
-            ,pre+"/int[@name='between'][.='5']"
-            );
-
-    assertQ("checking counts for lower & edge",
-            req( "q", "*:*"
-                ,"rows", "0"
-                ,"facet", "true"
-                ,"facet.date", f
-                ,"facet.date.start", "1976-07-01T00:00:00.000Z"
-                ,"facet.date.end",   "1976-07-13T00:00:00.000Z" // smaller now
-                ,"facet.date.gap",   "+1DAY"
-                ,"facet.date.other", "all"
-                ,"facet.date.include", "lower"
-                ,"facet.date.include", "edge"
-                )
-            // 12 days + pre+post+inner = 15
-            ,"*[count("+pre+"/int)=15]"
-            ,pre+"/int[@name='1976-07-01T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-02T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-03T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-04T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-05T00:00:00Z'][.='2'  ]"
-            ,pre+"/int[@name='1976-07-06T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-07T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-08T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-09T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-10T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-11T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-12T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='before' ][.='1']"
-            ,pre+"/int[@name='after'  ][.='3']"
-            ,pre+"/int[@name='between'][.='6']"
-            );
-
-    assertQ("checking counts for lower & outer",
-            req( "q", "*:*"
-                ,"rows", "0"
-                ,"facet", "true"
-                ,"facet.date", f
-                ,"facet.date.start", "1976-07-01T00:00:00.000Z"
-                ,"facet.date.end",   "1976-07-13T00:00:00.000Z" // smaller now
-                ,"facet.date.gap",   "+1DAY"
-                ,"facet.date.other", "all"
-                ,"facet.date.include", "lower"
-                ,"facet.date.include", "outer"
-                )
-            // 12 days + pre+post+inner = 15
-            ,"*[count("+pre+"/int)=15]"
-            ,pre+"/int[@name='1976-07-01T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-02T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-03T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-04T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-05T00:00:00Z'][.='2'  ]"
-            ,pre+"/int[@name='1976-07-06T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-07T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-08T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-09T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-10T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-11T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-12T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='before' ][.='2']"
-            ,pre+"/int[@name='after'  ][.='4']"
-            ,pre+"/int[@name='between'][.='5']"
-            );
-
-    assertQ("checking counts for lower & edge & outer",
-            req( "q", "*:*"
-                ,"rows", "0"
-                ,"facet", "true"
-                ,"facet.date", f
-                ,"facet.date.start", "1976-07-01T00:00:00.000Z"
-                ,"facet.date.end",   "1976-07-13T00:00:00.000Z" // smaller now
-                ,"facet.date.gap",   "+1DAY"
-                ,"facet.date.other", "all"
-                ,"facet.date.include", "lower"
-                ,"facet.date.include", "edge"
-                ,"facet.date.include", "outer"
-                )
-            // 12 days + pre+post+inner = 15
-            ,"*[count("+pre+"/int)=15]"
-            ,pre+"/int[@name='1976-07-01T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-02T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-03T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-04T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-05T00:00:00Z'][.='2'  ]"
-            ,pre+"/int[@name='1976-07-06T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-07T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-08T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-09T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-10T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-11T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-12T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='before' ][.='2']"
-            ,pre+"/int[@name='after'  ][.='4']"
-            ,pre+"/int[@name='between'][.='6']"
-            );
-
-    assertQ("checking counts for all",
-            req( "q", "*:*"
-                ,"rows", "0"
-                ,"facet", "true"
-                ,"facet.date", f
-                ,"facet.date.start", "1976-07-01T00:00:00.000Z"
-                ,"facet.date.end",   "1976-07-13T00:00:00.000Z" // smaller now
-                ,"facet.date.gap",   "+1DAY"
-                ,"facet.date.other", "all"
-                ,"facet.date.include", "all"
-                )
-            // 12 days + pre+post+inner = 15
-            ,"*[count("+pre+"/int)=15]"
-            ,pre+"/int[@name='1976-07-01T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-02T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-03T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-04T00:00:00Z'][.='2'  ]"
-            ,pre+"/int[@name='1976-07-05T00:00:00Z'][.='2'  ]"
-            ,pre+"/int[@name='1976-07-06T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-07T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='1976-07-08T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-09T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-10T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-11T00:00:00Z'][.='0']"
-            ,pre+"/int[@name='1976-07-12T00:00:00Z'][.='1'  ]"
-            ,pre+"/int[@name='before' ][.='2']"
-            ,pre+"/int[@name='after'  ][.='4']"
-            ,pre+"/int[@name='between'][.='6']"
-            );
-  }
-
-  @Test
-  public void testFacetMultiValued() {
-    doFacetPrefix("t_s", "facet.method","enum");
-    doFacetPrefix("t_s", "facet.method", "enum", "facet.enum.cache.minDf", "2");
-    doFacetPrefix("t_s", "facet.method", "enum", "facet.enum.cache.minDf", "100");
-    doFacetPrefix("t_s", "facet.method", "fc");
+  static void indexFacetSingleValued() {
+    indexFacets("40","t_s1");
   }
 
   @Test
   public void testFacetSingleValued() {
     doFacets("t_s1");
   }
+  @Test
+  public void testFacetSingleValuedFcs() {
+    doFacets("t_s1","facet.method","fcs");
+  }
+
+  static void indexFacets(String idPrefix, String f) {
+    add_doc("id", idPrefix+"1",  f, "A");
+    add_doc("id", idPrefix+"2",  f, "B");
+    add_doc("id", idPrefix+"3",  f, "C");
+    add_doc("id", idPrefix+"4",  f, "C");
+    add_doc("id", idPrefix+"5",  f, "D");
+    add_doc("id", idPrefix+"6",  f, "E");
+    add_doc("id", idPrefix+"7",  f, "E");
+    add_doc("id", idPrefix+"8",  f, "E");
+    add_doc("id", idPrefix+"9",  f, "F");
+    add_doc("id", idPrefix+"10", f, "G");
+    add_doc("id", idPrefix+"11", f, "G");
+    add_doc("id", idPrefix+"12", f, "G");
+    add_doc("id", idPrefix+"13", f, "G");
+    add_doc("id", idPrefix+"14", f, "G");
+  }
 
   public void doFacets(String f, String... params) {
     String pre = "//lst[@name='"+f+"']";
     String notc = "id:[* TO *] -"+f+":C";
 
-    assertU(adoc("id", "1",  f, "A"));
-    assertU(adoc("id", "2",  f, "B"));
-    assertU(commit());
-    assertU(adoc("id", "3",  f, "C"));
-    assertU(adoc("id", "4",  f, "C"));
-    assertU(adoc("id", "5",  f, "D"));
-    assertU(adoc("id", "6",  f, "E"));
-    assertU(adoc("id", "7",  f, "E"));
-    assertU(adoc("id", "8",  f, "E"));
-    assertU(adoc("id", "9",  f, "F"));
-    assertU(commit());
-    assertU(adoc("id", "10", f, "G"));
-    assertU(adoc("id", "11", f, "G"));
-    assertU(adoc("id", "12", f, "G"));
-    assertU(adoc("id", "13", f, "G"));
-    assertU(adoc("id", "14", f, "G"));
-    assertU(commit());
 
     assertQ("check counts for unlimited facet",
-            req(params, "q", "id:[* TO *]"
+            req(params, "q", "id:[* TO *]", "indent","true"
                 ,"facet", "true"
                 ,"facet.field", f
                 )
@@ -912,49 +608,63 @@ public class SimpleFacetsTest extends So
   }
 
 
+  static void indexFacetPrefixMultiValued() {
+    indexFacetPrefix("50","t_s");
+  }
+
   @Test
   public void testFacetPrefixMultiValued() {
-    doFacetPrefix("t_s", "facet.method","enum");
-    doFacetPrefix("t_s", "facet.method", "enum", "facet.enum.cache.minDf", "3");
-    doFacetPrefix("t_s", "facet.method", "enum", "facet.enum.cache.minDf", "100");
-    doFacetPrefix("t_s", "facet.method", "fc");
+    doFacetPrefix("t_s", null, "facet.method","enum");
+    doFacetPrefix("t_s", null, "facet.method", "enum", "facet.enum.cache.minDf", "3");
+    doFacetPrefix("t_s", null, "facet.method", "enum", "facet.enum.cache.minDf", "100");
+    doFacetPrefix("t_s", null, "facet.method", "fc");
+  }
+
+  static void indexFacetPrefixSingleValued() {
+    indexFacetPrefix("60","tt_s1");
   }
 
   @Test
   public void testFacetPrefixSingleValued() {
-    doFacetPrefix("t_s1");
+    doFacetPrefix("tt_s1", null);
+  }
+  @Test
+  public void testFacetPrefixSingleValuedFcs() {
+    doFacetPrefix("tt_s1", null, "facet.method","fcs");
+    doFacetPrefix("tt_s1", "{!threads=0}", "facet.method","fcs");   // direct execution
+    doFacetPrefix("tt_s1", "{!threads=-1}", "facet.method","fcs");  // default / unlimited
threads
+    doFacetPrefix("tt_s1", "{!threads=2}", "facet.method","fcs");   // specific number of
threads
   }
 
-  public void doFacetPrefix(String f, String... params) {
+
+  static void indexFacetPrefix(String idPrefix, String f) {
+    add_doc("id", idPrefix+"1",  f, "AAA");
+    add_doc("id", idPrefix+"2",  f, "B");
+    add_doc("id", idPrefix+"3",  f, "BB");
+    add_doc("id", idPrefix+"4",  f, "BB");
+    add_doc("id", idPrefix+"5",  f, "BBB");
+    add_doc("id", idPrefix+"6",  f, "BBB");
+    add_doc("id", idPrefix+"7",  f, "BBB");
+    add_doc("id", idPrefix+"8",  f, "CC");
+    add_doc("id", idPrefix+"9",  f, "CC");
+    add_doc("id", idPrefix+"10", f, "CCC");
+    add_doc("id", idPrefix+"11", f, "CCC");
+    add_doc("id", idPrefix+"12", f, "CCC");
+    assertU(commit());
+  }
+
+  public void doFacetPrefix(String f, String local, String... params) {
     String indent="on";
     String pre = "//lst[@name='"+f+"']";
     String notc = "id:[* TO *] -"+f+":C";
+    String lf = local==null ? f : local+f;
 
-    assertU(delQ("*:*"));
-
-    assertU(adoc("id", "1",  f, "AAA"));
-    assertU(adoc("id", "2",  f, "B"));
-    assertU(adoc("id", "3",  f, "BB"));
-    assertU(adoc("id", "4",  f, "BB"));
-    assertU(commit());
-    assertU(adoc("id", "5",  f, "BBB"));
-    assertU(adoc("id", "6",  f, "BBB"));
-    assertU(commit());
-    assertU(adoc("id", "7",  f, "BBB"));
-    assertU(adoc("id", "8",  f, "CC"));
-    assertU(adoc("id", "9",  f, "CC"));
-    assertU(commit());
-    assertU(adoc("id", "10", f, "CCC"));
-    assertU(adoc("id", "11", f, "CCC"));
-    assertU(commit());    
-    assertU(adoc("id", "12", f, "CCC"));
-    assertU(commit());
 
     assertQ("test facet.prefix middle, exact match first term",
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","0"
                     ,"facet.limit","100"
@@ -971,7 +681,7 @@ public class SimpleFacetsTest extends So
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","0"
                     ,"facet.limit","100"
@@ -989,7 +699,7 @@ public class SimpleFacetsTest extends So
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","0"
                     ,"facet.limit","100"
@@ -1007,7 +717,7 @@ public class SimpleFacetsTest extends So
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","1"
                     ,"facet.limit","100"
@@ -1023,7 +733,7 @@ public class SimpleFacetsTest extends So
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","1"
                     ,"facet.limit","1"
@@ -1038,7 +748,7 @@ public class SimpleFacetsTest extends So
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","1"
                     ,"facet.limit","1"
@@ -1053,7 +763,7 @@ public class SimpleFacetsTest extends So
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","0"
                     ,"facet.limit","100"
@@ -1069,7 +779,7 @@ public class SimpleFacetsTest extends So
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","0"
                     ,"facet.limit","100"
@@ -1085,7 +795,7 @@ public class SimpleFacetsTest extends So
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","0"
                     ,"facet.limit","100"
@@ -1099,7 +809,7 @@ public class SimpleFacetsTest extends So
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","1"
                     ,"facet.limit","-1"
@@ -1113,7 +823,7 @@ public class SimpleFacetsTest extends So
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","0"
                     ,"facet.limit","100"
@@ -1127,7 +837,7 @@ public class SimpleFacetsTest extends So
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","0"
                     ,"facet.limit","100"
@@ -1141,7 +851,7 @@ public class SimpleFacetsTest extends So
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","0"
                     ,"facet.limit","100"
@@ -1155,7 +865,7 @@ public class SimpleFacetsTest extends So
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","0"
                     ,"facet.limit","100"
@@ -1169,7 +879,7 @@ public class SimpleFacetsTest extends So
             req(params, "q", "id:[* TO *]"
                     ,"indent",indent
                     ,"facet","true"
-                    ,"facet.field", f
+                    ,"facet.field", lf
                     ,"facet.mincount","0"
                     ,"facet.offset","2"
                     ,"facet.limit","100"

Propchange: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/request/SimpleFacetsTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Jul 29 23:54:54 2010
@@ -0,0 +1,6 @@
+/lucene/dev/trunk/solr/src/test/org/apache/solr/request/SimpleFacetsTest.java:931183-980555,980592
+/lucene/java/branches/lucene_2_4/solr/src/test/org/apache/solr/request/SimpleFacetsTest.java:748824
+/lucene/java/branches/lucene_2_9/solr/src/test/org/apache/solr/request/SimpleFacetsTest.java:817269-818600,825998,829134,829881,831036,896850,909334
+/lucene/java/branches/lucene_2_9_back_compat_tests/solr/src/test/org/apache/solr/request/SimpleFacetsTest.java:818601-821336
+/lucene/java/branches/lucene_3_0/solr/src/test/org/apache/solr/request/SimpleFacetsTest.java:880793,896906
+/lucene/solr/trunk/src/test/org/apache/solr/request/SimpleFacetsTest.java:922950-923910,923912-925091

Modified: lucene/dev/branches/branch_3x/solr/src/test/test-files/solr/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/test-files/solr/conf/schema.xml?rev=980610&r1=980609&r2=980610&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/test-files/solr/conf/schema.xml (original)
+++ lucene/dev/branches/branch_3x/solr/src/test/test-files/solr/conf/schema.xml Thu Jul 29
23:54:54 2010
@@ -558,7 +558,18 @@
    <copyField source="subject" dest="text"/>
  
    <copyField source="*_t" dest="text"/>
+
+   <copyField source="id"            dest="range_facet_si"/>
+   <copyField source="id"            dest="range_facet_l"/>
+   <copyField source="id"            dest="range_facet_sl"/>
+   <copyField source="range_facet_f" dest="range_facet_sf"/>
+   <copyField source="range_facet_f" dest="range_facet_d"/>
+   <copyField source="range_facet_f" dest="range_facet_sd"/>
+
+   <copyField source="bday" dest="bday_pdt"/>
+   <copyField source="a_tdt" dest="a_pdt"/>
    
+
    <!-- dynamic destination -->
    <copyField source="*_dynamic" dest="dynamic_*"/>
     

Propchange: lucene/dev/branches/branch_3x/solr/src/webapp/src/org/apache/solr/client/solrj/embedded/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jul 29 23:54:54 2010
@@ -1,2 +1,2 @@
-/lucene/dev/trunk/solr/src/webapp/src/org/apache/solr/client/solrj/embedded:931298,931337,931502,932129-932131,932163,932304,932369,932374,932398,932417,932541,932576,932587,932698,932731-932749,932752,932773,932795,932828,932856-932857,932862,932864,932878,932963,932998-932999,933541-933575,933598,933613,933679,933879,934339,934954,935014-935048,935065,935186-935513,935521-935522,935553-935962,936522,936544,936605,936657-936726,937039,937360,938582-938646,938989,939111,939611,939649,940433,940447,940451-940452,940556,940666,940699,940730,940878-940892,940994,941270,941363,942166,942235,942288,942676,942719,943142,943493,943931,945057,945090,945130,945245,945343,945420,946139,946330,946338,946599,948011,948082,948429,949288,949311,949445,949976,949997,950008,950042,950125,950207,950458,950613,950723,950835,951126,951355,951397,951521,953628,953886,954336,955547,955613,955615,955796-955797,955809-955996,956097,956125,956173,956316,956715,957465,957520,957634,957707,960367,960
 374,960719,961821,961941,962555,962714,963372,963654,963720,963781,963873,963888,963906,963909,963920,964019,964054,964267,964312,964430,964459,964720,964753,964832,964856,965103,965222,965230,965327,965330,965585,965938,966354,979049,979807,980369,980428,980436,980501
+/lucene/dev/trunk/solr/src/webapp/src/org/apache/solr/client/solrj/embedded:931298,931337,931502,932129-932131,932163,932304,932369,932374,932398,932417,932541,932576,932587,932698,932731-932749,932752,932773,932795,932828,932856-932857,932862,932864,932878,932963,932998-932999,933541-933575,933598,933613,933679,933879,934339,934954,935014-935048,935065,935186-935513,935521-935522,935553-935962,936522,936544,936605,936657-936726,937039,937360,938582-938646,938989,939111,939611,939649,940433,940447,940451-940452,940556,940666,940699,940730,940878-940892,940994,941270,941363,942166,942235,942288,942676,942719,943142,943493,943931,945057,945090,945130,945245,945343,945420,946139,946330,946338,946599,948011,948082,948429,949288,949311,949445,949976,949997,950008,950042,950125,950207,950458,950613,950723,950835,951126,951355,951397,951521,953628,953886,954336,955547,955613,955615,955796-955797,955809-955996,956097,956125,956173,956316,956715,957465,957520,957634,957707,960367,960
 374,960719,961821,961941,962555,962714,963372,963654,963720,963781,963873,963888,963906,963909,963920,964019,964054,964267,964312,964430,964459,964720,964753,964832,964856,965103,965222,965230,965327,965330,965585,965938,966354,979049,979807,980369,980428,980436,980501,980555,980592
 /lucene/solr/trunk/src/webapp/src/org/apache/solr/client/solrj/embedded:922950-923910,923912-925091

Propchange: lucene/dev/branches/branch_3x/solr/src/webapp/web/admin/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jul 29 23:54:54 2010
@@ -1,4 +1,4 @@
-/lucene/dev/trunk/solr/src/webapp/web/admin:931298,931337,931502,932129-932131,932163,932304,932369,932374,932398,932417,932541,932576,932587,932698,932731-932749,932752,932773,932795,932828,932856-932857,932862,932864,932878,932963,932998-932999,933541-933575,933598,933613,933679,933879,934339,934954,935014-935048,935065,935186-935513,935521-935522,935553-935962,936522,936544,936605,936657-936726,937039,937360,938582-938646,938989,939111,939611,939649,940433,940447,940451-940452,940556,940666,940699,940730,940878-940892,940994,941270,941363,942166,942235,942288,942676,942719,943142,943493,943931,945057,945090,945130,945245,945343,945420,946139,946330,946338,946599,948011,948082,948429,949288,949311,949445,949976,949997,950008,950042,950125,950207,950458,950613,950723,950835,951126,951355,951397,951521,953628,953886,954336,955547,955613,955615,955796-955797,955809-955996,956097,956125,956173,956316,956715,957465,957520,957634,957707,960367,960374,961821,961941,962555,962714,
 963372,963654,963720,963781,963873,963888,963906,963909,963920,964019,964054,964267,964306,964312,964430,964459,964720,964753,964832,964856,965222,965230,965327,965330,965585,965938,966354,979049,979807,980369,980428,980436,980501
+/lucene/dev/trunk/solr/src/webapp/web/admin:931298,931337,931502,932129-932131,932163,932304,932369,932374,932398,932417,932541,932576,932587,932698,932731-932749,932752,932773,932795,932828,932856-932857,932862,932864,932878,932963,932998-932999,933541-933575,933598,933613,933679,933879,934339,934954,935014-935048,935065,935186-935513,935521-935522,935553-935962,936522,936544,936605,936657-936726,937039,937360,938582-938646,938989,939111,939611,939649,940433,940447,940451-940452,940556,940666,940699,940730,940878-940892,940994,941270,941363,942166,942235,942288,942676,942719,943142,943493,943931,945057,945090,945130,945245,945343,945420,946139,946330,946338,946599,948011,948082,948429,949288,949311,949445,949976,949997,950008,950042,950125,950207,950458,950613,950723,950835,951126,951355,951397,951521,953628,953886,954336,955547,955613,955615,955796-955797,955809-955996,956097,956125,956173,956316,956715,957465,957520,957634,957707,960367,960374,961821,961941,962555,962714,
 963372,963654,963720,963781,963873,963888,963906,963909,963920,964019,964054,964267,964306,964312,964430,964459,964720,964753,964832,964856,965222,965230,965327,965330,965585,965938,966354,979049,979807,980369,980428,980436,980501,980555,980592
 /lucene/java/branches/lucene_2_4/solr/src/webapp/web/admin:748824
 /lucene/java/branches/lucene_2_9/solr/src/webapp/web/admin:817269-818600,825998,829134,829881,831036,896850,909334
 /lucene/java/branches/lucene_2_9_back_compat_tests/solr/src/webapp/web/admin:818601-821336



Mime
View raw message