You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ha...@apache.org on 2013/08/30 17:06:49 UTC

svn commit: r1518989 [10/10] - in /lucene/dev/branches/lucene3069: ./ dev-tools/ dev-tools/idea/solr/contrib/velocity/ dev-tools/maven/ dev-tools/maven/solr/core/src/java/ lucene/ lucene/analysis/ lucene/analysis/common/ lucene/analysis/common/src/java...

Modified: lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestDocSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestDocSet.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestDocSet.java (original)
+++ lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestDocSet.java Fri Aug 30 15:06:42 2013
@@ -404,6 +404,11 @@ public class TestDocSet extends LuceneTe
       }
 
       @Override
+      public Bits getDocsWithField(String field) throws IOException {
+        return null;
+      }
+
+      @Override
       public NumericDocValues getNormValues(String field) {
         return null;
       }

Modified: lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestFastLRUCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestFastLRUCache.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestFastLRUCache.java (original)
+++ lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestFastLRUCache.java Fri Aug 30 15:06:42 2013
@@ -43,7 +43,7 @@ public class TestFastLRUCache extends Lu
     params.put("size", "100");
     params.put("initialSize", "10");
     params.put("autowarmCount", "100%");
-    CacheRegenerator cr = createCodeRegenerator();
+    CacheRegenerator cr = new NoOpRegenerator();
     Object o = fastCache.init(params, null, cr);
     fastCache.setState(SolrCache.State.LIVE);
     for (int i = 0; i < 101; i++) {
@@ -89,7 +89,7 @@ public class TestFastLRUCache extends Lu
     params.put("size", String.valueOf(limit));
     params.put("initialSize", "10");
     params.put("autowarmCount", percentage + "%");
-    CacheRegenerator cr = createCodeRegenerator();
+    CacheRegenerator cr = new NoOpRegenerator();
     Object o = fastCache.init(params, null, cr);
     fastCache.setState(SolrCache.State.LIVE);
     for (int i = 1; i <= limit; i++) {
@@ -120,7 +120,7 @@ public class TestFastLRUCache extends Lu
     Map<String, String> params = new HashMap<String, String>();
     params.put("size", "100");
     params.put("initialSize", "10");
-    CacheRegenerator cr = createCodeRegenerator();
+    CacheRegenerator cr = new NoOpRegenerator();
     Object o = fastCache.init(params, null, cr);
     fastCache.setState(SolrCache.State.LIVE);
     for (int i = 0; i < 101; i++) {
@@ -150,7 +150,7 @@ public class TestFastLRUCache extends Lu
     params.put("size", "100");
     params.put("initialSize", "10");
     params.put("autowarmCount", "-1");
-    CacheRegenerator cr = createCodeRegenerator();
+    CacheRegenerator cr = new NoOpRegenerator();
     Object o = cache.init(params, null, cr);
     cache.setState(SolrCache.State.LIVE);
     for (int i = 0; i < 101; i++) {
@@ -173,20 +173,6 @@ public class TestFastLRUCache extends Lu
     assertEquals("103", cacheNew.get(103));
     cacheNew.close();
   }
-
-  private CacheRegenerator createCodeRegenerator() {
-    CacheRegenerator cr = new CacheRegenerator() {
-        @Override
-        public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache,
-                                      SolrCache oldCache, Object oldKey, Object oldVal) {
-          newCache.put(oldKey, oldVal);
-          return true;
-        }
-      };
-    return cr;
-  }
-  
-  
   
   public void testSimple() throws IOException {
     FastLRUCache sc = new FastLRUCache();
@@ -194,7 +180,7 @@ public class TestFastLRUCache extends Lu
     l.put("size", "100");
     l.put("initialSize", "10");
     l.put("autowarmCount", "25");
-    CacheRegenerator cr = createCodeRegenerator();
+    CacheRegenerator cr = new NoOpRegenerator();
     Object o = sc.init(l, null, cr);
     sc.setState(SolrCache.State.LIVE);
     for (int i = 0; i < 101; i++) {

Modified: lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestLFUCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestLFUCache.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestLFUCache.java (original)
+++ lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestLFUCache.java Fri Aug 30 15:06:42 2013
@@ -38,15 +38,6 @@ import java.util.Map;
  */
 public class TestLFUCache extends SolrTestCaseJ4 {
 
-  private class LFURegenerator implements CacheRegenerator {
-    @Override
-    public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache,
-                                  SolrCache oldCache, Object oldKey, Object oldVal) throws IOException {
-      newCache.put(oldKey, oldVal);
-      return true;
-    }
-  }
-
   @BeforeClass
   public static void beforeClass() throws Exception {
     initCore("solrconfig-caching.xml", "schema.xml");
@@ -139,7 +130,7 @@ public class TestLFUCache extends SolrTe
       params.put("size", "100");
       params.put("initialSize", "10");
       params.put("autowarmCount", "25");
-      LFURegenerator regenerator = new LFURegenerator();
+      NoOpRegenerator regenerator = new NoOpRegenerator();
       Object initObj = lfuCache.init(params, null, regenerator);
       lfuCache.setState(SolrCache.State.LIVE);
       for (int i = 0; i < 101; i++) {

Modified: lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestLRUCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestLRUCache.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestLRUCache.java (original)
+++ lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/TestLRUCache.java Fri Aug 30 15:06:42 2013
@@ -36,7 +36,7 @@ public class TestLRUCache extends Lucene
     params.put("size", "100");
     params.put("initialSize", "10");
     params.put("autowarmCount", "100%");
-    CacheRegenerator cr = createCodeRegenerator();
+    CacheRegenerator cr = new NoOpRegenerator();
     Object o = lruCache.init(params, null, cr);
     lruCache.setState(SolrCache.State.LIVE);
     for (int i = 0; i < 101; i++) {
@@ -69,7 +69,7 @@ public class TestLRUCache extends Lucene
     params.put("size", String.valueOf(limit));
     params.put("initialSize", "10");
     params.put("autowarmCount", percentage + "%");
-    CacheRegenerator cr = createCodeRegenerator();
+    CacheRegenerator cr = new NoOpRegenerator();
     Object o = lruCache.init(params, null, cr);
     lruCache.setState(SolrCache.State.LIVE);
     for (int i = 1; i <= limit; i++) {
@@ -98,7 +98,7 @@ public class TestLRUCache extends Lucene
     Map<String, String> params = new HashMap<String, String>();
     params.put("size", "100");
     params.put("initialSize", "10");
-    CacheRegenerator cr = createCodeRegenerator();
+    CacheRegenerator cr = new NoOpRegenerator();
     Object o = lruCache.init(params, null, cr);
     lruCache.setState(SolrCache.State.LIVE);
     for (int i = 0; i < 101; i++) {
@@ -121,17 +121,4 @@ public class TestLRUCache extends Lucene
     assertEquals(null, lruCacheNew.get(50));
     lruCacheNew.close();
   }
-  
-  private CacheRegenerator createCodeRegenerator() {
-    CacheRegenerator cr = new CacheRegenerator() {
-      @Override
-      @SuppressWarnings("unchecked")
-      public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache,
-                                    SolrCache oldCache, Object oldKey, Object oldVal) {
-        newCache.put(oldKey, oldVal);
-        return true;
-      }
-    };
-    return cr;
-  }
 }

Modified: lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/join/BJQParserTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/join/BJQParserTest.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/join/BJQParserTest.java (original)
+++ lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/search/join/BJQParserTest.java Fri Aug 30 15:06:42 2013
@@ -25,6 +25,7 @@ import org.apache.solr.search.SolrCache;
 import org.apache.solr.search.SyntaxError;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.junit.Ignore;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -49,13 +50,21 @@ public class BJQParserTest extends SolrT
     int i = 0;
     List<List<String[]>> blocks = createBlocks();
     for (List<String[]> block : blocks) {
+      List<XmlDoc> updBlock = new ArrayList<>();
+      
       for (String[] doc : block) {
         String[] idDoc = Arrays.copyOf(doc,doc.length+2);
         idDoc[doc.length]="id";
         idDoc[doc.length+1]=Integer.toString(i);
-        assertU(add(doc(idDoc)));
+        updBlock.add(doc(idDoc));
         i++;
       }
+      //got xmls for every doc. now nest all into the last one
+      XmlDoc parentDoc = updBlock.get(updBlock.size()-1);
+      parentDoc.xml = parentDoc.xml.replace("</doc>", 
+          updBlock.subList(0, updBlock.size()-1).toString().replaceAll("[\\[\\]]","")+"</doc>");
+      assertU(add(parentDoc));
+      
       if (random().nextBoolean()) {
         assertU(commit());
         // force empty segment (actually, this will no longer create an empty segment, only a new segments_n)
@@ -184,6 +193,7 @@ public class BJQParserTest extends SolrT
   }
   
   @Test
+  @Ignore("SOLR-5168")
   public void testGrandChildren() throws IOException {
     assertQ(
         req("q", "{!parent which=$parentfilter v=$children}", "children",

Modified: lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java (original)
+++ lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java Fri Aug 30 15:06:42 2013
@@ -23,11 +23,13 @@ import java.io.Writer;
 import java.util.Arrays;
 import java.util.Date;
 
+import com.google.common.base.Charsets;
 import org.apache.http.Header;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.methods.HttpRequestBase;
 import org.apache.http.impl.cookie.DateUtils;
 import org.apache.solr.common.params.CommonParams;
+import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -37,13 +39,18 @@ import org.apache.lucene.util._TestUtil;
  * A test case for the several HTTP cache headers emitted by Solr
  */
 public class CacheHeaderTest extends CacheHeaderTestBase {
+    private static final File solrHomeDirectory = new File(TEMP_DIR, "CacheHeaderTest");
 
   @BeforeClass
   public static void beforeTest() throws Exception {
-    createJetty("solr/", null, null);
+    setupJettyTestHome(solrHomeDirectory, "collection1");
+    createJetty(solrHomeDirectory.getAbsolutePath(), null, null);
   }
 
-  protected static final String CHARSET = "UTF-8";
+  @AfterClass
+  public static void afterTest() throws Exception {
+    cleanUpJettyHome(solrHomeDirectory);
+  }
 
   protected static final String CONTENTS = "id\n100\n101\n102";
 
@@ -241,7 +248,7 @@ public class CacheHeaderTest extends Cac
   }
 
   protected File makeFile(String contents) {
-    return makeFile(contents, CHARSET);
+    return makeFile(contents, Charsets.UTF_8.toString());
   }
 
   protected File makeFile(String contents, String charset) {

Modified: lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java (original)
+++ lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java Fri Aug 30 15:06:42 2013
@@ -21,7 +21,9 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.lucene.util.LuceneTestCase.Slow;
+import org.apache.lucene.util._TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.GroupParams;
 import org.apache.solr.common.params.ModifiableSolrParams;
@@ -44,24 +46,52 @@ public class SpellCheckCollatorTest exte
   @BeforeClass
   public static void beforeClass() throws Exception {
     initCore("solrconfig-spellcheckcomponent.xml", "schema.xml");
-    assertNull(h.validateUpdate(adoc("id", "0", "lowerfilt", "faith hope and love", "teststop", "metanoia")));
-    assertNull(h.validateUpdate(adoc("id", "1", "lowerfilt", "faith hope and loaves")));
-    assertNull(h.validateUpdate(adoc("id", "2", "lowerfilt", "fat hops and loaves")));
-    assertNull(h.validateUpdate(adoc("id", "3", "lowerfilt", "faith of homer", "teststop", "metanoia")));
-    assertNull(h.validateUpdate(adoc("id", "4", "lowerfilt", "fat of homer")));
-    assertNull(h.validateUpdate(adoc("id", "5", "lowerfilt1", "peace")));
-    assertNull(h.validateUpdate(adoc("id", "6", "lowerfilt", "hyphenated word")));
-    assertNull(h.validateUpdate(adoc("id", "7", "teststop", "Jane filled out a form at Charles De Gaulle")));
-    assertNull(h.validateUpdate(adoc("id", "8", "teststop", "Dick flew from Heathrow")));
-    assertNull(h.validateUpdate(adoc("id", "9", "teststop", "Jane is stuck in customs because Spot chewed up the form")));
-    assertNull(h.validateUpdate(adoc("id", "10", "teststop", "Once in Paris Dick built a fire on the hearth")));
-    assertNull(h.validateUpdate(adoc("id", "11", "teststop", "Dick waited for Jane as he watched the sparks flow upward")));
-    assertNull(h.validateUpdate(adoc("id", "12", "teststop", "This June parisian rendez-vous is ruined because of a customs snafu")));
-    assertNull(h.validateUpdate(adoc("id", "13", "teststop", "partisan political machine", "teststop", "metanoia")));
-    assertNull(h.validateUpdate(adoc("id", "14", "teststop", "metanoia")));
-    assertNull(h.validateUpdate(adoc("id", "15", "teststop", "metanoia")));
-    assertNull(h.validateUpdate(adoc("id", "16", "teststop", "metanoia")));
-    assertNull(h.validateUpdate(commit()));
+    assertU(adoc("id", "0", 
+                 "lowerfilt", "faith hope and love", 
+                 "teststop", "metanoia"));
+    assertU(adoc("id", "1", 
+                 "lowerfilt", "faith hope and loaves",
+                 "teststop", "everyother"));
+    assertU(adoc("id", "2", 
+                 "lowerfilt", "fat hops and loaves"));
+    assertU(adoc("id", "3", 
+                 "lowerfilt", "faith of homer", 
+                 "teststop", "metanoia",
+                 "teststop", "everyother"));
+    assertU(adoc("id", "4", 
+                 "lowerfilt", "fat of homer"));
+    assertU(adoc("id", "5", 
+                 "lowerfilt1", "peace",
+                 "teststop", "everyother"));
+    assertU(adoc("id", "6", 
+                 "lowerfilt", "hyphenated word"));
+    assertU(adoc("id", "7", 
+                 "teststop", "Jane filled out a form at Charles De Gaulle",
+                 "teststop", "everyother"));
+    assertU(adoc("id", "8", 
+                 "teststop", "Dick flew from Heathrow"));
+    assertU(adoc("id", "9", 
+                 "teststop", "Jane is stuck in customs because Spot chewed up the form",
+                 "teststop", "everyother"));
+    assertU(adoc("id", "10", 
+                 "teststop", "Once in Paris Dick built a fire on the hearth"));
+    assertU(adoc("id", "11", 
+                 "teststop", "Dick waited for Jane as he watched the sparks flow upward",
+                 "teststop", "everyother"));
+    assertU(adoc("id", "12", 
+                 "teststop", "This June parisian rendez-vous is ruined because of a customs snafu"));
+    assertU(adoc("id", "13", 
+                 "teststop", "partisan political machine", 
+                 "teststop", "metanoia",
+                 "teststop", "everyother"));
+    assertU(adoc("id", "14", 
+                 "teststop", "metanoia"));
+    assertU(adoc("id", "15", 
+                 "teststop", "metanoia",
+                 "teststop", "everyother"));
+    assertU(adoc("id", "16", 
+                 "teststop", "metanoia"));
+    assertU(commit());
   }
 
   @Test
@@ -436,71 +466,66 @@ public class SpellCheckCollatorTest exte
   }
 
   @Test
-  @Ignore("SOLR-5122: estimates don't seem to make any sense")
   public void testEstimatedHitCounts() throws Exception {
-   assertQ(
-        req(
-          SpellCheckComponent.COMPONENT_NAME, "true",
-          SpellCheckComponent.SPELLCHECK_DICT, "direct",
-          SpellingParams.SPELLCHECK_COUNT, "1",   
-          SpellingParams.SPELLCHECK_COLLATE, "true",
-          SpellingParams.SPELLCHECK_MAX_COLLATION_TRIES, "1",
-          SpellingParams.SPELLCHECK_MAX_COLLATIONS, "1",
-          SpellingParams.SPELLCHECK_COLLATE_EXTENDED_RESULTS, "true",          
-          "qt", "spellCheckCompRH",          
-          CommonParams.Q, "teststop:metnoia"
-        ),
-        "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='collation']/str[@name='collationQuery']='teststop:metanoia'",
-        "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='collation']/int[@name='hits']=6"        
-      );
-    assertQ(
-        req(
-          SpellCheckComponent.COMPONENT_NAME, "true",
-          SpellCheckComponent.SPELLCHECK_DICT, "direct",
-          SpellingParams.SPELLCHECK_COUNT, "1",   
-          SpellingParams.SPELLCHECK_COLLATE, "true",
-          SpellingParams.SPELLCHECK_MAX_COLLATION_TRIES, "1",
-          SpellingParams.SPELLCHECK_MAX_COLLATIONS, "1",
-          SpellingParams.SPELLCHECK_COLLATE_EXTENDED_RESULTS, "true",
-          SpellingParams.SPELLCHECK_COLLATE_MAX_COLLECT_DOCS, "1",
-          "qt", "spellCheckCompRH",          
-          CommonParams.Q, "teststop:metnoia"
-        ),
-        "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='collation']/str[@name='collationQuery']='teststop:metanoia'",
-        "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='collation']/int[@name='hits']=17"        
-      );
-    assertQ(
-        req(
-          SpellCheckComponent.COMPONENT_NAME, "true",
-          SpellCheckComponent.SPELLCHECK_DICT, "direct",
-          SpellingParams.SPELLCHECK_COUNT, "1",   
-          SpellingParams.SPELLCHECK_COLLATE, "true",
-          SpellingParams.SPELLCHECK_MAX_COLLATION_TRIES, "1",
-          SpellingParams.SPELLCHECK_MAX_COLLATIONS, "1",
-          SpellingParams.SPELLCHECK_COLLATE_EXTENDED_RESULTS, "true",
-          SpellingParams.SPELLCHECK_COLLATE_MAX_COLLECT_DOCS, "3",
-          "qt", "spellCheckCompRH",          
-          CommonParams.Q, "teststop:metnoia"
-        ),
-        "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='collation']/str[@name='collationQuery']='teststop:metanoia'",
-        "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='collation']/int[@name='hits']=4"        
-      );
-    assertQ(
-        req(
-          SpellCheckComponent.COMPONENT_NAME, "true",
-          SpellCheckComponent.SPELLCHECK_DICT, "direct",
-          SpellingParams.SPELLCHECK_COUNT, "1",   
-          SpellingParams.SPELLCHECK_COLLATE, "true",
-          SpellingParams.SPELLCHECK_MAX_COLLATION_TRIES, "1",
-          SpellingParams.SPELLCHECK_MAX_COLLATIONS, "1",
-          SpellingParams.SPELLCHECK_COLLATE_EXTENDED_RESULTS, "true",
-          SpellingParams.SPELLCHECK_COLLATE_MAX_COLLECT_DOCS, "100",
-          "qt", "spellCheckCompRH",          
-          CommonParams.Q, "teststop:metnoia"
-        ),
-        "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='collation']/str[@name='collationQuery']='teststop:metanoia'",
-        "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='collation']/int[@name='hits']=6"        
-      );
+    final String xpathPrefix = 
+      "//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='collation']/";
+    final SolrParams reusedParams = params
+      (SpellCheckComponent.COMPONENT_NAME, "true",
+       SpellCheckComponent.SPELLCHECK_DICT, "direct",
+       SpellingParams.SPELLCHECK_COUNT, "1",   
+       SpellingParams.SPELLCHECK_COLLATE, "true",
+       SpellingParams.SPELLCHECK_MAX_COLLATION_TRIES, "1",
+       SpellingParams.SPELLCHECK_MAX_COLLATIONS, "1",
+       SpellingParams.SPELLCHECK_COLLATE_EXTENDED_RESULTS, "true",          
+       "qt", "spellCheckCompRH");       
+
+    // default case, no SPELLCHECK_COLLATE_MAX_COLLECT_DOCS should be exact num hits
+    assertQ(req(reusedParams, 
+                CommonParams.Q, "teststop:metnoia")
+            , xpathPrefix + "str[@name='collationQuery']='teststop:metanoia'"
+            , xpathPrefix + "int[@name='hits']=6"        
+            );
+
+    // specifying 0 means "exact" same as default, but specifing a value greater 
+    // then the total number of docs in the index should also result in it
+    // "estimating" and getting exact number as well.
+    for (String val : new String[] { "0", "30", "100", "10000" }) {
+      assertQ(req(reusedParams,
+                  CommonParams.Q, "teststop:metnoia",
+                  SpellingParams.SPELLCHECK_COLLATE_MAX_COLLECT_DOCS, val)
+              , xpathPrefix + "str[@name='collationQuery']='teststop:metanoia'"
+              , xpathPrefix + "int[@name='hits']=6"        
+              );
+    }
+
+    // values between 0 and the num docs in the index should not error, and should 
+    // produce an estimate no more then the total number of docs
+    final int iters = atLeast(10);
+    for (int iter = 0; iter < iters; iter++) {
+      final int val = _TestUtil.nextInt(random(), 1, 17);
+      assertQ(req(reusedParams,
+                  CommonParams.Q, "teststop:metnoia",
+                  SpellingParams.SPELLCHECK_COLLATE_MAX_COLLECT_DOCS, ""+val)
+              , xpathPrefix + "str[@name='collationQuery']='teststop:metanoia'"
+              , xpathPrefix + "int[@name='hits' and . <= 17 and 0 < .]"        
+              );
+    }
+
+    // "everYother" appears in every other doc in the index, so "everother" 
+    // should produce a "decent" aproximation of the number of hits (8)
+    // for any 5 <= SPELLCHECK_COLLATE_MAX_COLLECT_DOCS
+    //
+    // (we have to be kind of flexible with our definition of "decent"
+    // since we're dealing with a fairly small index here)
+    for (int val = 5; val <= 20; val++) {
+      assertQ(req(reusedParams,
+                  CommonParams.Q, "teststop:everother",
+                  SpellingParams.SPELLCHECK_COLLATE_MAX_COLLECT_DOCS, ""+val)
+              , xpathPrefix + "str[@name='collationQuery']='teststop:everyother'"
+              , xpathPrefix + "int[@name='hits' and 6 <= . and . <= 10]"        
+              );
+    }
+
   }  
   
 }

Modified: lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java (original)
+++ lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java Fri Aug 30 15:06:42 2013
@@ -130,8 +130,11 @@ public class AddBlockUpdateTest extends 
   
   @AfterClass
   public static void afterClass() throws Exception {
-    inputFactory = null;
     exe.shutdownNow();
+    
+    exe = null;
+    inputFactory = null;
+    counter = null;
   }
   
   @Test
@@ -219,7 +222,7 @@ public class AddBlockUpdateTest extends 
     Element doc1 = root.addElement("doc");
     attachField(doc1, "id", id());
     attachField(doc1, parent, "Y");
-    attachField(doc1, "sample_i", "notanumber");
+    attachField(doc1, "sample_i", "notanumber/ignore_exception");
     Element subDoc1 = doc1.addElement("doc");
     attachField(subDoc1, "id", id());
     attachField(subDoc1, child, "x");

Modified: lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java (original)
+++ lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java Fri Aug 30 15:06:42 2013
@@ -23,6 +23,8 @@ import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import org.apache.lucene.index.LogDocMergePolicy;
+
 import org.apache.solr.BaseDistributedSearchTestCase;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServer;
@@ -45,7 +47,16 @@ import org.apache.solr.update.SolrCmdDis
 import org.apache.solr.update.SolrCmdDistributor.StdNode;
 import org.apache.solr.update.processor.DistributedUpdateProcessor;
 
+import org.junit.BeforeClass;
+
 public class SolrCmdDistributorTest extends BaseDistributedSearchTestCase {
+  @BeforeClass
+  public static void beforeClass() throws Exception {
+
+    // we can't use the Randomized merge policy because the test depends on
+    // being able to call optimize to have all deletes expunged.
+    System.setProperty("solr.tests.mergePolicy", LogDocMergePolicy.class.getName());
+  }
   private UpdateShardHandler updateShardHandler;
   
   public SolrCmdDistributorTest() {

Modified: lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java (original)
+++ lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java Fri Aug 30 15:06:42 2013
@@ -54,7 +54,7 @@ public class SolrIndexConfigTest extends
   @Test
   public void testTieredMPSolrIndexConfigCreation() throws Exception {
     SolrConfig solrConfig = new SolrConfig("solr" + File.separator
-        + "collection1", "solrconfig-mergepolicy.xml", null);
+        + "collection1", "solrconfig-tieredmergepolicy.xml", null);
     SolrIndexConfig solrIndexConfig = new SolrIndexConfig(solrConfig, null,
         null);
     assertNotNull(solrIndexConfig);

Modified: lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java (original)
+++ lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java Fri Aug 30 15:06:42 2013
@@ -119,6 +119,49 @@ public class SolrIndexSplitterTest exten
       if (request != null) request.close(); // decrefs the searcher
     }
   }
+  
+  // SOLR-5144
+  public void testSplitDeletes() throws Exception {
+    LocalSolrQueryRequest request = null;
+    try {
+      // add two docs
+      String id1 = "dorothy";
+      assertU(adoc("id", id1));
+      String id2 = "kansas";
+      assertU(adoc("id", id2));
+      assertU(commit());
+      assertJQ(req("q", "*:*"), "/response/numFound==2");
+      assertU(delI(id2)); // delete id2
+      assertU(commit());
+
+
+      // find minHash/maxHash hash ranges
+      List<DocRouter.Range> ranges = getRanges(id1, id2);
+
+      request = lrf.makeRequest("q", "dummy");
+
+      SplitIndexCommand command = new SplitIndexCommand(request,
+          Lists.newArrayList(indexDir1.getAbsolutePath(), indexDir2.getAbsolutePath()), null, ranges, new PlainIdRouter());
+      new SolrIndexSplitter(command).split();
+
+      Directory directory = h.getCore().getDirectoryFactory().get(indexDir1.getAbsolutePath(),
+          DirectoryFactory.DirContext.DEFAULT, h.getCore().getSolrConfig().indexConfig.lockType);
+      DirectoryReader reader = DirectoryReader.open(directory);
+      assertEquals("id:dorothy should be present in split index1", 1, reader.docFreq(new Term("id", "dorothy")));
+      assertEquals("id:kansas should not be present in split index1", 0, reader.docFreq(new Term("id", "kansas")));
+      assertEquals("split index1 should have only one document", 1, reader.numDocs());
+      reader.close();
+      h.getCore().getDirectoryFactory().release(directory);
+      directory = h.getCore().getDirectoryFactory().get(indexDir2.getAbsolutePath(),
+          DirectoryFactory.DirContext.DEFAULT, h.getCore().getSolrConfig().indexConfig.lockType);
+      reader = DirectoryReader.open(directory);
+      assertEquals(0, reader.numDocs()); // should be empty
+      reader.close();
+      h.getCore().getDirectoryFactory().release(directory);
+    } finally {
+      if (request != null) request.close(); // decrefs the searcher
+    }
+  }
 
   @Test
   public void testSplitByCores() throws Exception {

Modified: lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java (original)
+++ lucene/dev/branches/lucene3069/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java Fri Aug 30 15:06:42 2013
@@ -94,6 +94,28 @@ public class FieldMutatingUpdateProcesso
                  5.0F, d.getField("foo_s").getBoost(), 0.0F);
   }
 
+  public void testUniqValues() throws Exception {
+    final String chain = "uniq-values";
+    SolrInputDocument d = null;
+    d = processAdd(chain,
+                   doc(f("id", "1111"),
+                       f("name", "Hoss", "Man", "Hoss"),
+                       f("uniq_1_s", "Hoss", "Man", "Hoss"),
+                       f("uniq_2_s", "Foo", "Hoss", "Man", "Hoss", "Bar"),
+                       f("uniq_3_s", 5.0F, 23, "string", 5.0F)));
+    
+    assertNotNull(d);
+    
+    assertEquals(Arrays.asList("Hoss", "Man", "Hoss"),
+                 d.getFieldValues("name"));
+    assertEquals(Arrays.asList("Hoss","Man"), 
+                 d.getFieldValues("uniq_1_s"));
+    assertEquals(Arrays.asList("Foo","Hoss","Man","Bar"),
+                 d.getFieldValues("uniq_2_s"));
+    assertEquals(Arrays.asList(5.0F, 23, "string"),
+                 d.getFieldValues("uniq_3_s"));
+  }
+
   public void testTrimFields() throws Exception {
     for (String chain : Arrays.asList("trim-fields", "trim-fields-arr")) {
       SolrInputDocument d = null;

Modified: lucene/dev/branches/lucene3069/solr/example/solr/collection1/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/example/solr/collection1/conf/schema.xml?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/example/solr/collection1/conf/schema.xml (original)
+++ lucene/dev/branches/lucene3069/solr/example/solr/collection1/conf/schema.xml Fri Aug 30 15:06:42 2013
@@ -168,8 +168,10 @@
    <!--
      Some fields such as popularity and manu_exact could be modified to
      leverage doc values:
-     <field name="popularity" type="int" indexed="true" stored="true" docValues="true" default="0" />
-     <field name="manu_exact" type="string" indexed="false" stored="false" docValues="true" default="" />
+     <field name="popularity" type="int" indexed="true" stored="true" docValues="true" />
+     <field name="manu_exact" type="string" indexed="false" stored="false" docValues="true" />
+     <field name="cat" type="string" indexed="true" stored="true" docValues="true" multiValued="true"/>
+
 
      Although it would make indexing slightly slower and the index bigger, it
      would also make the index faster to load, more memory-efficient and more

Modified: lucene/dev/branches/lucene3069/solr/example/solr/collection1/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/example/solr/collection1/conf/solrconfig.xml?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/example/solr/collection1/conf/solrconfig.xml (original)
+++ lucene/dev/branches/lucene3069/solr/example/solr/collection1/conf/solrconfig.xml Fri Aug 30 15:06:42 2013
@@ -1480,6 +1480,7 @@
   <searchComponent name="terms" class="solr.TermsComponent"/>
 
   <!-- A request handler for demonstrating the terms component -->
+  <requestHandler name="/js" class="org.apache.solr.handler.js.JavaScriptRequestHandler" startup="lazy"/>
   <requestHandler name="/terms" class="solr.SearchHandler" startup="lazy">
      <lst name="defaults">
       <bool name="terms">true</bool>

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java Fri Aug 30 15:06:42 2013
@@ -17,6 +17,7 @@ package org.apache.solr.common.cloud;
  * limitations under the License.
  */
 
+import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.Hash;
@@ -59,17 +60,33 @@ public class CompositeIdRouter extends H
   }
 
   @Override
-  public int sliceHash(String id, SolrInputDocument doc, SolrParams params) {
-    int idx = id.indexOf(separator);
-    if (idx < 0) {
-      return Hash.murmurhash3_x86_32(id, 0, id.length(), 0);
+  public int sliceHash(String id, SolrInputDocument doc, SolrParams params, DocCollection collection) {
+    String shardFieldName = collection ==null? null: collection.getStr(DocRouter.ROUTE_FIELD);
+    String part1 = null;
+    int idx = 0;
+    int commaIdx = 0;
+
+    if(shardFieldName == null || doc == null) {
+      idx = id.indexOf(separator);
+      if (idx < 0) {
+        return Hash.murmurhash3_x86_32(id, 0, id.length(), 0);
+      }
+      part1 = id.substring(0, idx);
+      commaIdx = part1.indexOf(bitsSeparator);
+
+    } else {
+      Object o = doc.getFieldValue(shardFieldName);
+      if (o != null) {
+        part1 = o.toString();
+        return Hash.murmurhash3_x86_32(part1, 0, part1.length(), 0);
+      } else {
+        throw new SolrException (SolrException.ErrorCode.BAD_REQUEST, "No value for :"+shardFieldName + ". Unable to identify shard");
+      }
     }
 
     int m1 = mask1;
     int m2 = mask2;
 
-    String part1 = id.substring(0,idx);
-    int commaIdx = part1.indexOf(bitsSeparator);
     if (commaIdx > 0) {
       int firstBits = getBits(part1, commaIdx);
       if (firstBits >= 0) {

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/java/org/apache/solr/common/cloud/HashBasedRouter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/java/org/apache/solr/common/cloud/HashBasedRouter.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/java/org/apache/solr/common/cloud/HashBasedRouter.java (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/java/org/apache/solr/common/cloud/HashBasedRouter.java Fri Aug 30 15:06:42 2013
@@ -30,19 +30,19 @@ public abstract class HashBasedRouter ex
   @Override
   public Slice getTargetSlice(String id, SolrInputDocument sdoc, SolrParams params, DocCollection collection) {
     if (id == null) id = getId(sdoc, params);
-    int hash = sliceHash(id, sdoc, params);
+    int hash = sliceHash(id, sdoc, params,collection);
     return hashToSlice(hash, collection);
   }
 
   @Override
   public boolean isTargetSlice(String id, SolrInputDocument sdoc, SolrParams params, String shardId, DocCollection collection) {
     if (id == null) id = getId(sdoc, params);
-    int hash = sliceHash(id, sdoc, params);
+    int hash = sliceHash(id, sdoc, params, collection);
     Range range = collection.getSlice(shardId).getRange();
     return range != null && range.includes(hash);
   }
 
-  public int sliceHash(String id, SolrInputDocument sdoc, SolrParams params) {
+  public int sliceHash(String id, SolrInputDocument sdoc, SolrParams params, DocCollection collection) {
     return Hash.murmurhash3_x86_32(id, 0, id.length(), 0);
   }
 

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/solr.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/solr.xml?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/solr.xml (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/solr.xml Fri Aug 30 15:06:42 2013
@@ -29,6 +29,7 @@
     If 'null' (or absent), cores will not be manageable via request handler
   -->
   <cores adminPath="/admin/cores" defaultCoreName="collection1" host="127.0.0.1" hostPort="${hostPort:8983}" hostContext="${hostContext:solr}" zkClientTimeout="8000" genericCoreNodeNames="${genericCoreNodeNames:true}">
-    <core name="collection1" instanceDir="collection1" shard="${shard:}" collection="${collection:collection1}" config="${solrconfig:solrconfig.xml}" schema="${schema:schema.xml}"/>
+    <core name="collection1" instanceDir="collection1" shard="${shard:}" collection="${collection:collection1}" />
+    <!--config="${solrconfig:solrconfig.xml}" schema="${schema:schema.xml}"/-->
   </cores>
 </solr>

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java Fri Aug 30 15:06:42 2013
@@ -46,11 +46,6 @@ public abstract class MultiCoreExampleTe
 
   @Override public String getSolrHome() { return ExternalPaths.EXAMPLE_MULTICORE_HOME; }
 
-  protected void setupCoreContainer() {
-    cores = new CoreContainer();
-    cores.load();
-  }
-  
   @Override public void setUp() throws Exception {
     super.setUp();
 
@@ -65,11 +60,6 @@ public abstract class MultiCoreExampleTe
     System.setProperty( "solr.core0.data.dir", this.dataDir1.getCanonicalPath() ); 
     System.setProperty( "solr.core1.data.dir", this.dataDir2.getCanonicalPath() );
 
-    setupCoreContainer();
-
-    SolrCore.log.info("CORES=" + cores + " : " + cores.getCoreNames());
-
-
   }
   
   @Override
@@ -84,8 +74,6 @@ public abstract class MultiCoreExampleTe
         System.err.println("!!!! WARNING: best effort to remove " + dataDir2.getAbsolutePath() + " FAILED !!!!!");
       }
     }
-
-    cores.shutdown();
   }
 
   @Override

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java Fri Aug 30 15:06:42 2013
@@ -273,6 +273,11 @@ public class TestLBHttpSolrServer extend
       return "solrj/solr/collection1/conf/solrconfig-slave1.xml";
     }
 
+    public String getSolrXmlFile() {
+      return "solrj/solr/solr.xml";
+    }
+
+
     public void setUp() throws Exception {
       File home = new File(LuceneTestCase.TEMP_DIR,
               getClass().getName() + "-" + System.currentTimeMillis());
@@ -286,6 +291,8 @@ public class TestLBHttpSolrServer extend
       dataDir.mkdirs();
       confDir.mkdirs();
 
+      FileUtils.copyFile(SolrTestCaseJ4.getFile(getSolrXmlFile()), new File(homeDir, "solr.xml"));
+
       File f = new File(confDir, "solrconfig.xml");
       FileUtils.copyFile(SolrTestCaseJ4.getFile(getSolrConfigFile()), f);
       f = new File(confDir, "schema.xml");

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java Fri Aug 30 15:06:42 2013
@@ -19,6 +19,8 @@ package org.apache.solr.client.solrj.emb
 
 import org.apache.solr.client.solrj.MultiCoreExampleTestBase;
 import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.core.SolrCore;
 
 /**
  * This runs SolrServer test using 
@@ -33,6 +35,19 @@ public class MultiCoreEmbeddedTest exten
     // TODO: fix this test to use MockDirectoryFactory
     System.clearProperty("solr.directoryFactory");
     super.setUp();
+    setupCoreContainer();
+    SolrCore.log.info("CORES=" + cores + " : " + cores.getCoreNames());
+  }
+  
+  protected void setupCoreContainer() {
+    cores = new CoreContainer();
+    cores.load();
+  }
+  
+  @Override
+  public void tearDown() throws Exception {
+    cores.shutdown();
+    super.tearDown();
   }
 
   @Override

Modified: lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java (original)
+++ lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java Fri Aug 30 15:06:42 2013
@@ -22,6 +22,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.SortedMap;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
@@ -188,4 +189,21 @@ abstract public class SolrJettyTestBase 
       return new EmbeddedSolrServer( h.getCoreContainer(), "" );
     }
   }
+
+  // Sets up the necessary config files for Jetty. At least some tests require that the solrconfig from the test
+  // file directory are used, but some also require that the solr.xml file be explicitly there as of SOLR-4817
+  public static void setupJettyTestHome(File solrHome, String collection) throws Exception {
+    if (solrHome.exists()) {
+      FileUtils.deleteDirectory(solrHome);
+    }
+    copySolrHomeToTemp(solrHome, collection);
+  }
+
+  public static void cleanUpJettyHome(File solrHome) throws Exception {
+    if (solrHome.exists()) {
+      FileUtils.deleteDirectory(solrHome);
+    }
+  }
+
+
 }

Modified: lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java Fri Aug 30 15:06:42 2013
@@ -1599,16 +1599,53 @@ public abstract class SolrTestCaseJ4 ext
     }
   }
   // Creates a mininmal conf dir.
-  public void copyMinConf(File dstRoot) throws IOException {
+  public static void copyMinConf(File dstRoot) throws IOException {
 
     File subHome = new File(dstRoot, "conf");
-    assertTrue("Failed to make subdirectory ", dstRoot.mkdirs());
+    if (! dstRoot.exists()) {
+      assertTrue("Failed to make subdirectory ", dstRoot.mkdirs());
+    }
+
     String top = SolrTestCaseJ4.TEST_HOME() + "/collection1/conf";
     FileUtils.copyFile(new File(top, "schema-tiny.xml"), new File(subHome, "schema.xml"));
     FileUtils.copyFile(new File(top, "solrconfig-minimal.xml"), new File(subHome, "solrconfig.xml"));
     FileUtils.copyFile(new File(top, "solrconfig.snippet.randomindexconfig.xml"), new File(subHome, "solrconfig.snippet.randomindexconfig.xml"));
   }
 
+  // Creates minimal full setup, including the old solr.xml file that used to be hard coded in COnfigSolrXmlOld
+  public static void copyMinFullSetup(File dstRoot) throws IOException {
+    if (! dstRoot.exists()) {
+      assertTrue("Failed to make subdirectory ", dstRoot.mkdirs());
+    }
+    File xmlF = new File(SolrTestCaseJ4.TEST_HOME(), "solr.xml");
+    FileUtils.copyFile(xmlF, new File(dstRoot, "solr.xml"));
+    copyMinConf(dstRoot);
+  }
+
+  // Creates a consistent configuration, _including_ solr.xml at dstRoot. Creates collection1/conf and copies
+  // the stock files in there. Seems to be indicated for some tests when we remove the default, hard-coded
+  // solr.xml from being automatically synthesized from SolrConfigXmlOld.DEFAULT_SOLR_XML.
+  public static void copySolrHomeToTemp(File dstRoot, String collection) throws IOException {
+    if (!dstRoot.exists()) {
+      assertTrue("Failed to make subdirectory ", dstRoot.mkdirs());
+    }
+
+    FileUtils.copyFile(new File(SolrTestCaseJ4.TEST_HOME(), "solr.xml"), new File(dstRoot, "solr.xml"));
+
+    File subHome = new File(dstRoot, collection + File.separator + "conf");
+    String top = SolrTestCaseJ4.TEST_HOME() + "/collection1/conf";
+    FileUtils.copyFile(new File(top, "currency.xml"), new File(subHome, "currency.xml"));
+    FileUtils.copyFile(new File(top, "mapping-ISOLatin1Accent.txt"), new File(subHome, "mapping-ISOLatin1Accent.txt"));
+    FileUtils.copyFile(new File(top, "old_synonyms.txt"), new File(subHome, "old_synonyms.txt"));
+    FileUtils.copyFile(new File(top, "open-exchange-rates.json"), new File(subHome, "open-exchange-rates.json"));
+    FileUtils.copyFile(new File(top, "protwords.txt"), new File(subHome, "protwords.txt"));
+    FileUtils.copyFile(new File(top, "schema.xml"), new File(subHome, "schema.xml"));
+    FileUtils.copyFile(new File(top, "solrconfig.snippet.randomindexconfig.xml"), new File(subHome, "solrconfig.snippet.randomindexconfig.xml"));
+    FileUtils.copyFile(new File(top, "solrconfig.xml"), new File(subHome, "solrconfig.xml"));
+    FileUtils.copyFile(new File(top, "stopwords.txt"), new File(subHome, "stopwords.txt"));
+    FileUtils.copyFile(new File(top, "synonyms.txt"), new File(subHome, "synonyms.txt"));
+  }
+
   public static CoreDescriptorBuilder buildCoreDescriptor(CoreContainer container, String name, String instancedir) {
     return new CoreDescriptorBuilder(container, name, instancedir);
   }

Modified: lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java (original)
+++ lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java Fri Aug 30 15:06:42 2013
@@ -17,8 +17,10 @@ package org.apache.solr.cloud;
  * limitations under the License.
  */
 
+import org.apache.commons.io.FilenameUtils;
 import org.apache.http.params.CoreConnectionPNames;
 import org.apache.lucene.util.LuceneTestCase.Slow;
+import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.SolrServer;
@@ -44,6 +46,7 @@ import org.apache.solr.common.params.Col
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.StrUtils;
+import org.apache.solr.core.SolrResourceLoader;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -455,14 +458,45 @@ public abstract class AbstractFullDistri
   }
   
   public JettySolrRunner createJetty(File solrHome, String dataDir, String shardList, String solrConfigOverride, String schemaOverride) throws Exception {
-
-    JettySolrRunner jetty = new JettySolrRunner(solrHome.getAbsolutePath(), context, 0, solrConfigOverride, schemaOverride, false, getExtraServlets());
+    // randomly test a relative solr.home path
+    if (random().nextBoolean()) {
+      solrHome = getRelativeSolrHomePath(solrHome);
+    }
+    
+    JettySolrRunner jetty = new JettySolrRunner(solrHome.getPath(), context, 0, solrConfigOverride, schemaOverride, false, getExtraServlets());
     jetty.setShards(shardList);
     jetty.setDataDir(getDataDir(dataDir));
     jetty.start();
     
     return jetty;
   }
+
+  private File getRelativeSolrHomePath(File solrHome) {
+    String path = SolrResourceLoader.normalizeDir(new File(".").getAbsolutePath());
+    String base = new File(solrHome.getPath()).getAbsolutePath();
+    
+    if (base.startsWith("."));
+    base.replaceFirst("\\.", new File(".").getName());
+    
+    if (path.endsWith(File.separator + ".")) {
+      path = path.substring(0, path.length() - 2);
+    }
+    
+    int splits = path.split("\\" + File.separator).length;
+    
+    StringBuilder p = new StringBuilder();
+    for (int i = 0; i < splits - 2; i++) {
+      p.append(".." + File.separator);
+    }   
+    
+    String prefix = FilenameUtils.getPrefix(path);
+    if (base.startsWith(prefix)) {
+      base = base.substring(prefix.length());
+    }
+
+    solrHome = new File(p.toString() + base);
+    return solrHome;
+  }
   
   protected void updateMappingsFromZk(List<JettySolrRunner> jettys,
       List<SolrServer> clients) throws Exception {

Modified: lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/RandomMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/RandomMergePolicy.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/RandomMergePolicy.java (original)
+++ lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/RandomMergePolicy.java Fri Aug 30 15:06:42 2013
@@ -21,6 +21,9 @@ import org.apache.lucene.index.*;
 import org.apache.lucene.index.MergePolicy.MergeSpecification;
 import org.apache.lucene.util.LuceneTestCase;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.util.Map;
 import java.io.IOException;
 
@@ -32,6 +35,8 @@ import java.io.IOException;
  */
 public final class RandomMergePolicy extends MergePolicy {
 
+  public static Logger log = LoggerFactory.getLogger(RandomMergePolicy.class);
+  
   /** 
    * Not private so tests can inspect it, 
    * Not final so it can be set on clone
@@ -45,6 +50,8 @@ public final class RandomMergePolicy ext
     super(inner.getNoCFSRatio(), 
           (long) (inner.getMaxCFSSegmentSizeMB() * 1024 * 1024));
     this.inner = inner;
+    log.info("RandomMergePolicy wrapping {}: {}",
+             inner.getClass(), inner);
   }
 
   public RandomMergePolicy clone() {

Modified: lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java (original)
+++ lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java Fri Aug 30 15:06:42 2013
@@ -173,7 +173,6 @@ public class TestHarness extends BaseTes
                                                  String solrConfig, String schema) {
     String solrxml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
         + "<solr persistent=\"false\">\n"
-        + "  <logging enabled=\"true\"/>\n"
         + "  <cores adminPath=\"/admin/cores\" defaultCoreName=\""
         + ConfigSolrXmlOld.DEFAULT_DEFAULT_CORE_NAME
         + "\""

Modified: lucene/dev/branches/lucene3069/solr/webapp/web/admin.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/webapp/web/admin.html?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/webapp/web/admin.html (original)
+++ lucene/dev/branches/lucene3069/solr/webapp/web/admin.html Fri Aug 30 15:06:42 2013
@@ -41,6 +41,8 @@ limitations under the License.
   <link rel="stylesheet" type="text/css" href="css/styles/schema-browser.css?_=${version}">
   <link rel="stylesheet" type="text/css" href="css/styles/threads.css?_=${version}">
   <link rel="stylesheet" type="text/css" href="css/chosen.css?_=${version}">
+
+  <meta http-equiv="x-ua-compatible" content="IE=9">
     
   <script type="text/javascript">
     

Modified: lucene/dev/branches/lucene3069/solr/webapp/web/js/scripts/app.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/webapp/web/js/scripts/app.js?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/webapp/web/js/scripts/app.js (original)
+++ lucene/dev/branches/lucene3069/solr/webapp/web/js/scripts/app.js Fri Aug 30 15:06:42 2013
@@ -552,7 +552,7 @@ var solr_admin = function( app_config )
       json_str = JSON.stringify( JSON.parse( json_str ), undefined, 2 );
     }
 
-    return json_str;
+    return json_str.esc();
   };
 
   this.format_number = function format_number( number )

Modified: lucene/dev/branches/lucene3069/solr/webapp/web/js/scripts/logging.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/webapp/web/js/scripts/logging.js?rev=1518989&r1=1518988&r2=1518989&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/webapp/web/js/scripts/logging.js (original)
+++ lucene/dev/branches/lucene3069/solr/webapp/web/js/scripts/logging.js Fri Aug 30 15:06:42 2013
@@ -334,8 +334,8 @@ var load_logging_viewer = function()
             var lines = doc.message.split( "\n" );
             if( 1 < lines.length )
             {
-              doc.message = lines[0];
               doc.trace = doc.message;
+              doc.message = lines[0];
               delete lines;
             }
           }
@@ -360,14 +360,7 @@ var load_logging_viewer = function()
           if( has_trace )
           {
             content += '<tr class="trace">' + "\n";
-              
-              // (1) with colspan
               content += '<td colspan="4"><pre>' + doc.trace.esc() + '</pre></td>' + "\n";
-              
-              // (2) without colspan
-              //content += '<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>';
-              //content += '<td>' + doc.trace.esc().replace( /\n/g, '<br>' ) + '</td>' + "\n";
-
             content += '</tr>' + "\n";
           }