You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2013/04/23 16:29:13 UTC
svn commit: r1470979 [4/5] - in /lucene/dev/branches/branch_4x: ./ solr/
solr/contrib/
solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/carrot2/
solr/contrib/dataimporthandler-extras/src/test/org/apache/solr/handler/dataimport/
solr/...
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestGroupingSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestGroupingSearch.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestGroupingSearch.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestGroupingSearch.java Tue Apr 23 14:29:10 2013
@@ -35,7 +35,16 @@ import org.junit.Test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
public class TestGroupingSearch extends SolrTestCaseJ4 {
@@ -720,10 +729,12 @@ public class TestGroupingSearch extends
int group_limit = random().nextInt(10)==0 ? random().nextInt(model.size()+2) : random().nextInt(11)-1;
int group_offset = random().nextInt(10)==0 ? random().nextInt(model.size()+2) : random().nextInt(2); // pick a small start normally for better coverage
+ IndexSchema schema = h.getCore().getLatestSchema();
+
String[] stringSortA = new String[1];
- Comparator<Doc> sortComparator = createSort(h.getCore().getSchema(), types, stringSortA);
+ Comparator<Doc> sortComparator = createSort(schema, types, stringSortA);
String sortStr = stringSortA[0];
- Comparator<Doc> groupComparator = random().nextBoolean() ? sortComparator : createSort(h.getCore().getSchema(), types, stringSortA);
+ Comparator<Doc> groupComparator = random().nextBoolean() ? sortComparator : createSort(schema, types, stringSortA);
String groupSortStr = stringSortA[0];
// since groupSortStr defaults to sortStr, we need to normalize null to "score desc" if
@@ -760,7 +771,7 @@ public class TestGroupingSearch extends
Collections.sort(sortedGroups, groupComparator==sortComparator ? createFirstDocComparator(sortComparator) : createMaxDocComparator(sortComparator));
boolean includeNGroups = random().nextBoolean();
- Object modelResponse = buildGroupedResult(h.getCore().getSchema(), sortedGroups, start, rows, group_offset, group_limit, includeNGroups);
+ Object modelResponse = buildGroupedResult(schema, sortedGroups, start, rows, group_offset, group_limit, includeNGroups);
boolean truncateGroups = random().nextBoolean();
Map<String, Integer> facetCounts = new TreeMap<String, Integer>();
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestJoin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestJoin.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestJoin.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestJoin.java Tue Apr 23 14:29:10 2013
@@ -17,25 +17,21 @@
package org.apache.solr;
-import org.apache.lucene.search.FieldCache;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.BooleanQuery;
-
import org.noggit.JSONUtil;
import org.noggit.ObjectBuilder;
-import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.core.SolrCore;
-import org.apache.solr.handler.JsonUpdateRequestHandler;
import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.request.SolrRequestHandler;
-import org.apache.solr.schema.IndexSchema;
-import org.apache.solr.servlet.DirectSolrConnection;
-import org.apache.solr.search.QParser;
-import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
public class TestJoin extends SolrTestCaseJ4 {
@@ -198,7 +194,7 @@ public class TestJoin extends SolrTestCa
List sortedDocs = new ArrayList();
for (Doc doc : docList) {
if (sortedDocs.size() >= 10) break;
- sortedDocs.add(doc.toObject(h.getCore().getSchema()));
+ sortedDocs.add(doc.toObject(h.getCore().getLatestSchema()));
}
Map<String,Object> resultSet = new LinkedHashMap<String,Object>();
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestTrie.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestTrie.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestTrie.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestTrie.java Tue Apr 23 14:29:10 2013
@@ -53,7 +53,7 @@ public class TestTrie extends SolrTestCa
@Test
public void testTokenizer() throws Exception {
- FieldType type = h.getCore().getSchema().getFieldType("tint");
+ FieldType type = h.getCore().getLatestSchema().getFieldType("tint");
assertTrue(type instanceof TrieField);
String value = String.valueOf(random().nextInt());
@@ -303,7 +303,7 @@ public class TestTrie extends SolrTestCa
}
private void checkPrecisionSteps(String fieldType) {
- FieldType type = h.getCore().getSchema().getFieldType(fieldType);
+ FieldType type = h.getCore().getLatestSchema().getFieldType(fieldType);
if (type instanceof TrieField) {
TrieField field = (TrieField) type;
assertTrue(field.getPrecisionStep() > 0 && field.getPrecisionStep() < 64);
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/analysis/TestLuceneMatchVersion.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/analysis/TestLuceneMatchVersion.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/analysis/TestLuceneMatchVersion.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/analysis/TestLuceneMatchVersion.java Tue Apr 23 14:29:10 2013
@@ -18,7 +18,6 @@ package org.apache.solr.analysis;
import java.lang.reflect.Field;
-import org.apache.lucene.analysis.util.TokenizerFactory;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.core.Config;
import org.apache.solr.schema.IndexSchema;
@@ -45,7 +44,7 @@ public class TestLuceneMatchVersion exte
public void testStandardTokenizerVersions() throws Exception {
assertEquals(DEFAULT_VERSION, solrConfig.luceneMatchVersion);
- final IndexSchema schema = h.getCore().getSchema();
+ final IndexSchema schema = h.getCore().getLatestSchema();
FieldType type = schema.getFieldType("textDefault");
TokenizerChain ana = (TokenizerChain) type.getAnalyzer();
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java Tue Apr 23 14:29:10 2013
@@ -30,8 +30,15 @@ import org.apache.solr.util.plugin.SolrC
import org.junit.Test;
import java.io.File;
-import java.util.concurrent.*;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
public class SolrCoreTest extends SolrTestCaseJ4 {
private static final String COLLECTION1 = "collection1";
@@ -52,7 +59,7 @@ public class SolrCoreTest extends SolrTe
final CoreContainer cores = h.getCoreContainer();
SolrCore core = cores.getCore("");
- IndexSchema schema = h.getCore().getSchema();
+ IndexSchema schema = h.getCore().getLatestSchema();
assertEquals(COLLECTION1, cores.getDefaultCoreName());
cores.remove("");
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java Tue Apr 23 14:29:10 2013
@@ -35,7 +35,7 @@ public class TestCodecSupport extends So
public void testPostingsFormats() {
Codec codec = h.getCore().getCodec();
- Map<String, SchemaField> fields = h.getCore().getSchema().getFields();
+ Map<String, SchemaField> fields = h.getCore().getLatestSchema().getFields();
SchemaField schemaField = fields.get("string_pulsing_f");
PerFieldPostingsFormat format = (PerFieldPostingsFormat) codec.postingsFormat();
assertEquals("Pulsing41", format.getPostingsFormatForField(schemaField.getName()).getName());
@@ -50,7 +50,7 @@ public class TestCodecSupport extends So
public void testDocValuesFormats() {
Codec codec = h.getCore().getCodec();
- Map<String, SchemaField> fields = h.getCore().getSchema().getFields();
+ Map<String, SchemaField> fields = h.getCore().getLatestSchema().getFields();
SchemaField schemaField = fields.get("string_disk_f");
PerFieldDocValuesFormat format = (PerFieldDocValuesFormat) codec.docValuesFormat();
assertEquals("Disk", format.getDocValuesFormatForField(schemaField.getName()).getName());
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java Tue Apr 23 14:29:10 2013
@@ -30,7 +30,6 @@ import javax.xml.parsers.ParserConfigura
import org.apache.commons.io.FileUtils;
import org.apache.lucene.util.IOUtils;
import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.common.SolrException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -88,7 +87,7 @@ public class TestCoreContainer extends S
CoreDescriptor descriptor2 = new CoreDescriptor(cores, "core2", "./collection1");
SolrCore core2 = cores.create(descriptor2);
- assertSame(core1.getSchema(), core2.getSchema());
+ assertSame(core1.getLatestSchema(), core2.getLatestSchema());
core1.close();
core2.close();
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestMergePolicyConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestMergePolicyConfig.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestMergePolicyConfig.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestMergePolicyConfig.java Tue Apr 23 14:29:10 2013
@@ -31,7 +31,7 @@ public class TestMergePolicyConfig exten
}
public void testTieredMergePolicyConfig() throws Exception {
- IndexWriterConfig iwc = solrConfig.indexConfig.toIndexWriterConfig(h.getCore().getSchema());
+ IndexWriterConfig iwc = solrConfig.indexConfig.toIndexWriterConfig(h.getCore().getLatestSchema());
MergePolicy mp = iwc.getMergePolicy();
assertTrue(mp instanceof TieredMergePolicy);
TieredMergePolicy tieredMP = (TieredMergePolicy) mp;
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestQuerySenderListener.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestQuerySenderListener.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestQuerySenderListener.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestQuerySenderListener.java Tue Apr 23 14:29:10 2013
@@ -75,7 +75,7 @@ public class TestQuerySenderListener ext
assertNotNull("Event is null", evt);
assertTrue(evt + " is not equal to " + EventParams.FIRST_SEARCHER, evt.equals(EventParams.FIRST_SEARCHER) == true);
- SolrIndexSearcher newSearcher = new SolrIndexSearcher(core, core.getNewIndexDir(), core.getSchema(), core.getSolrConfig().indexConfig, "testQuerySenderListener", false, core.getDirectoryFactory());
+ SolrIndexSearcher newSearcher = new SolrIndexSearcher(core, core.getNewIndexDir(), core.getLatestSchema(), core.getSolrConfig().indexConfig, "testQuerySenderListener", false, core.getDirectoryFactory());
qsl.newSearcher(newSearcher, currentSearcher);
evt = mock.req.getParams().get(EventParams.EVENT);
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestQuerySenderNoQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestQuerySenderNoQuery.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestQuerySenderNoQuery.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestQuerySenderNoQuery.java Tue Apr 23 14:29:10 2013
@@ -75,7 +75,7 @@ public class TestQuerySenderNoQuery exte
assertNotNull("Mock is null", mock);
assertNull("Req (firstsearcher) is not null", mock.req);
- SolrIndexSearcher newSearcher = new SolrIndexSearcher(core, core.getNewIndexDir(), core.getSchema(), core.getSolrConfig().indexConfig, "testQuerySenderNoQuery", false, core.getDirectoryFactory());
+ SolrIndexSearcher newSearcher = new SolrIndexSearcher(core, core.getNewIndexDir(), core.getLatestSchema(), core.getSolrConfig().indexConfig, "testQuerySenderNoQuery", false, core.getDirectoryFactory());
qsl.newSearcher(newSearcher, currentSearcher); // get newSearcher.
assertNull("Req (newsearcher) is not null", mock.req);
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrIndexConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrIndexConfig.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrIndexConfig.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrIndexConfig.java Tue Apr 23 14:29:10 2013
@@ -29,7 +29,7 @@ public class TestSolrIndexConfig extends
}
public void testIndexConfig() throws Exception {
- IndexWriterConfig iwc = solrConfig.indexConfig.toIndexWriterConfig(h.getCore().getSchema());
+ IndexWriterConfig iwc = solrConfig.indexConfig.toIndexWriterConfig(h.getCore().getLatestSchema());
assertEquals(123, iwc.getMaxThreadStates());
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestXIncludeConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestXIncludeConfig.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestXIncludeConfig.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestXIncludeConfig.java Tue Apr 23 14:29:10 2013
@@ -19,6 +19,7 @@ package org.apache.solr.core;
import javax.xml.parsers.DocumentBuilderFactory;
+import org.apache.solr.schema.IndexSchema;
import org.apache.solr.update.processor.RegexReplaceProcessorFactory;
import org.apache.solr.update.processor.UpdateRequestProcessorChain;
import org.apache.solr.util.AbstractSolrTestCase;
@@ -60,9 +61,8 @@ public class TestXIncludeConfig extends
RegexReplaceProcessorFactory.class,
chain.getFactories()[0].getClass());
- assertNotNull("ft-included is null",
- core.getSchema().getFieldTypeByName("ft-included"));
- assertNotNull("field-included is null",
- core.getSchema().getFieldOrNull("field-included"));
+ IndexSchema schema = core.getLatestSchema();
+ assertNotNull("ft-included is null", schema.getFieldTypeByName("ft-included"));
+ assertNotNull("field-included is null", schema.getFieldOrNull("field-included"));
}
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/DocumentAnalysisRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/DocumentAnalysisRequestHandlerTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/DocumentAnalysisRequestHandlerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/DocumentAnalysisRequestHandlerTest.java Tue Apr 23 14:29:10 2013
@@ -216,7 +216,7 @@ public class DocumentAnalysisRequestHand
.setShowMatch(true)
.addDocument(document);
- NamedList<Object> result = handler.handleAnalysisRequest(request, h.getCore().getSchema());
+ NamedList<Object> result = handler.handleAnalysisRequest(request, h.getCore().getLatestSchema());
assertNotNull("result is null and it shouldn't be", result);
NamedList<NamedList<NamedList<Object>>> documentResult = (NamedList<NamedList<NamedList<Object>>>) result.get("1");
assertNotNull("An analysis for document with key '1' should be returned", documentResult);
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/FieldAnalysisRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/FieldAnalysisRequestHandlerTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/FieldAnalysisRequestHandlerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/FieldAnalysisRequestHandlerTest.java Tue Apr 23 14:29:10 2013
@@ -18,7 +18,6 @@
package org.apache.solr.handler;
import org.apache.lucene.analysis.MockTokenizer;
-import org.apache.lucene.analysis.core.KeywordTokenizer;
import org.apache.lucene.analysis.core.WhitespaceTokenizer;
import org.apache.solr.common.params.AnalysisParams;
import org.apache.solr.common.params.CommonParams;
@@ -126,7 +125,7 @@ public class FieldAnalysisRequestHandler
request.setQuery("fox brown");
request.setShowMatch(true);
- NamedList<NamedList> result = handler.handleAnalysisRequest(request, h.getCore().getSchema());
+ NamedList<NamedList> result = handler.handleAnalysisRequest(request, h.getCore().getLatestSchema());
assertTrue("result is null and it shouldn't be", result != null);
NamedList<NamedList> fieldTypes = result.get("field_types");
@@ -315,7 +314,7 @@ public class FieldAnalysisRequestHandler
request.setFieldValue("<html><body>whátëvêr</body></html>");
request.setShowMatch(false);
- NamedList<NamedList> result = handler.handleAnalysisRequest(request, h.getCore().getSchema());
+ NamedList<NamedList> result = handler.handleAnalysisRequest(request, h.getCore().getLatestSchema());
assertTrue("result is null and it shouldn't be", result != null);
NamedList<NamedList> fieldTypes = result.get("field_types");
@@ -343,7 +342,7 @@ public class FieldAnalysisRequestHandler
request.setFieldValue("hi, 3456-12 a Test");
request.setShowMatch(false);
- NamedList<NamedList> result = handler.handleAnalysisRequest(request, h.getCore().getSchema());
+ NamedList<NamedList> result = handler.handleAnalysisRequest(request, h.getCore().getLatestSchema());
assertTrue("result is null and it shouldn't be", result != null);
NamedList<NamedList> fieldTypes = result.get("field_types");
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java Tue Apr 23 14:29:10 2013
@@ -201,7 +201,7 @@ public class LukeRequestHandlerTest exte
deleteCore();
initCore("solrconfig.xml", "schema-copyfield-test.xml");
- IndexSchema schema = h.getCore().getSchema();
+ IndexSchema schema = h.getCore().getLatestSchema();
assertNull("'*' should not be (or match) a dynamic field", schema.getDynamicPattern("*"));
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java Tue Apr 23 14:29:10 2013
@@ -351,7 +351,7 @@ public class StatsComponentTest extends
public void testStatsFacetMultivaluedErrorHandling() throws Exception {
SolrCore core = h.getCore();
- SchemaField foo_ss = core.getSchema().getField("foo_ss");
+ SchemaField foo_ss = core.getLatestSchema().getField("foo_ss");
assertU(adoc("id", "1", "active_i", "1", "foo_ss", "aa" ));
assertU(commit());
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/highlight/TestPostingsSolrHighlighter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/highlight/TestPostingsSolrHighlighter.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/highlight/TestPostingsSolrHighlighter.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/highlight/TestPostingsSolrHighlighter.java Tue Apr 23 14:29:10 2013
@@ -38,7 +38,7 @@ public class TestPostingsSolrHighlighter
assertTrue("wrong highlighter: " + highlighter.getClass(), highlighter instanceof PostingsSolrHighlighter);
// 'text' and 'text3' should have offsets, 'text2' should not
- IndexSchema schema = h.getCore().getSchema();
+ IndexSchema schema = h.getCore().getLatestSchema();
assertTrue(schema.getField("text").storeOffsetsWithPositions());
assertTrue(schema.getField("text3").storeOffsetsWithPositions());
assertFalse(schema.getField("text2").storeOffsetsWithPositions());
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java Tue Apr 23 14:29:10 2013
@@ -352,7 +352,7 @@ public class SimpleFacetsTest extends So
}
static void doEmptyFacetCounts(String field, String[] prefixes) throws Exception {
- SchemaField sf = h.getCore().getSchema().getField(field);
+ SchemaField sf = h.getCore().getLatestSchema().getField(field);
String response = JQ(req("q", "*:*"));
Map rsp = (Map) ObjectBuilder.fromJSON(response);
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/request/TestFaceting.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/request/TestFaceting.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/request/TestFaceting.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/request/TestFaceting.java Tue Apr 23 14:29:10 2013
@@ -27,7 +27,6 @@ import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.util.BytesRef;
import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.FacetParams;
import org.junit.After;
import org.junit.BeforeClass;
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/rest/schema/TestFieldResource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/rest/schema/TestFieldResource.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/rest/schema/TestFieldResource.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/rest/schema/TestFieldResource.java Tue Apr 23 14:29:10 2013
@@ -92,4 +92,18 @@ public class TestFieldResource extends S
assertQ("/schema/fields/id?indent=on&wt=xml", tests);
assertQ("/schema/fields/id?indent=on&wt=xml&showDefaults=false", tests);
}
+
+ @Test
+ public void testJsonPutFieldToNonMutableIndexSchema() throws Exception {
+ assertJPut("/schema/fields/newfield",
+ "{\"type\":\"text_general\", \"stored\":\"false\"}",
+ "/error/msg=='This IndexSchema is not mutable.'");
+ }
+
+ @Test
+ public void testJsonPostFieldsToNonMutableIndexSchema() throws Exception {
+ assertJPost("/schema/fields",
+ "[{\"name\":\"foobarbaz\", \"type\":\"text_general\", \"stored\":\"false\"}]",
+ "/error/msg=='This IndexSchema is not mutable.'");
+ }
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/AbstractCurrencyFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/AbstractCurrencyFieldTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/AbstractCurrencyFieldTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/AbstractCurrencyFieldTest.java Tue Apr 23 14:29:10 2013
@@ -64,7 +64,7 @@ public abstract class AbstractCurrencyFi
@Test
public void testCurrencySchema() throws Exception {
- IndexSchema schema = h.getCore().getSchema();
+ IndexSchema schema = h.getCore().getLatestSchema();
SchemaField amount = schema.getField(field());
assertNotNull(amount);
@@ -91,7 +91,7 @@ public abstract class AbstractCurrencyFi
@Test
public void testCurrencyFieldType() throws Exception {
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
SchemaField amount = schema.getField(field());
assertNotNull(amount);
assertTrue(field() + " is not a poly field", amount.isPolyField());
@@ -122,7 +122,7 @@ public abstract class AbstractCurrencyFi
@Test
public void testMockExchangeRateProvider() throws Exception {
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
SchemaField amount = schema.getField("mock_amount");
// A few tests on the provider directly
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/CopyFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/CopyFieldTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/CopyFieldTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/CopyFieldTest.java Tue Apr 23 14:29:10 2013
@@ -167,7 +167,7 @@ public class CopyFieldTest extends SolrT
public void testExplicitSourceGlob()
{
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
assertTrue("schema should contain explicit field 'sku1'", schema.getFields().containsKey("sku1"));
assertTrue("schema should contain explicit field 'sku2'", schema.getFields().containsKey("sku2"));
@@ -228,7 +228,7 @@ public class CopyFieldTest extends SolrT
{
// SOLR-4650: copyField source globs should not have to match an explicit or dynamic field
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
assertNull("'testing123_*' should not be (or match) a dynamic or explicit field", schema.getFieldOrNull("testing123_*"));
@@ -248,7 +248,7 @@ public class CopyFieldTest extends SolrT
}
public void testCatchAllCopyField() {
- IndexSchema schema = h.getCore().getSchema();
+ IndexSchema schema = h.getCore().getLatestSchema();
assertNull("'*' should not be (or match) a dynamic field",
schema.getDynamicPattern("*"));
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/DocValuesTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/DocValuesTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/DocValuesTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/DocValuesTest.java Tue Apr 23 14:29:10 2013
@@ -65,7 +65,7 @@ public class DocValuesTest extends SolrT
assertEquals(Double.doubleToLongBits(3), reader.getNumericDocValues("doubledv").get(0));
assertEquals(4L, reader.getNumericDocValues("longdv").get(0));
- final IndexSchema schema = core.getSchema();
+ final IndexSchema schema = core.getLatestSchema();
final SchemaField floatDv = schema.getField("floatdv");
final SchemaField intDv = schema.getField("intdv");
final SchemaField doubleDv = schema.getField("doubledv");
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/IndexSchemaRuntimeFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/IndexSchemaRuntimeFieldTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/IndexSchemaRuntimeFieldTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/IndexSchemaRuntimeFieldTest.java Tue Apr 23 14:29:10 2013
@@ -40,7 +40,7 @@ public class IndexSchemaRuntimeFieldTest
// willi-nilly
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
final String fieldName = "runtimefield";
SchemaField sf = new SchemaField( fieldName, schema.getFieldTypes().get( "string" ) );
schema.getFields().put( fieldName, sf );
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/IndexSchemaTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/IndexSchemaTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/IndexSchemaTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/IndexSchemaTest.java Tue Apr 23 14:29:10 2013
@@ -81,7 +81,7 @@ public class IndexSchemaTest extends Sol
@Test
public void testIsDynamicField() throws Exception {
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
assertFalse( schema.isDynamicField( "id" ) );
assertTrue( schema.isDynamicField( "aaa_i" ) );
assertFalse( schema.isDynamicField( "no_such_field" ) );
@@ -90,7 +90,7 @@ public class IndexSchemaTest extends Sol
@Test
public void testProperties() throws Exception{
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
assertFalse(schema.getField("id").multiValued());
}
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/MultiTermTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/MultiTermTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/MultiTermTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/MultiTermTest.java Tue Apr 23 14:29:10 2013
@@ -26,7 +26,7 @@ import org.apache.lucene.analysis.miscel
import org.apache.lucene.analysis.miscellaneous.TrimFilterFactory;
import org.apache.lucene.analysis.util.TokenFilterFactory;
import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.analysis.*;
+import org.apache.solr.analysis.TokenizerChain;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -42,7 +42,7 @@ public class MultiTermTest extends SolrT
@Test
public void testMultiFound() {
- SchemaField field = h.getCore().getSchema().getField("content_multi");
+ SchemaField field = h.getCore().getLatestSchema().getField("content_multi");
Analyzer analyzer = ((TextField)field.getType()).getMultiTermAnalyzer();
assertTrue(analyzer instanceof TokenizerChain);
assertTrue(((TokenizerChain) analyzer).getTokenizerFactory() instanceof WhitespaceTokenizerFactory);
@@ -64,7 +64,7 @@ public class MultiTermTest extends SolrT
@Test
public void testQueryCopiedToMulti() {
- SchemaField field = h.getCore().getSchema().getField("content_charfilter");
+ SchemaField field = h.getCore().getLatestSchema().getField("content_charfilter");
Analyzer analyzer = ((TextField)field.getType()).getMultiTermAnalyzer();
assertTrue(analyzer instanceof TokenizerChain);
assertTrue(((TokenizerChain) analyzer).getTokenizerFactory() instanceof KeywordTokenizerFactory);
@@ -79,7 +79,7 @@ public class MultiTermTest extends SolrT
@Test
public void testDefaultCopiedToMulti() {
- SchemaField field = h.getCore().getSchema().getField("content_ws");
+ SchemaField field = h.getCore().getLatestSchema().getField("content_ws");
Analyzer analyzer = ((TextField)field.getType()).getMultiTermAnalyzer();
assertTrue(analyzer instanceof TokenizerChain);
assertTrue(((TokenizerChain) analyzer).getTokenizerFactory() instanceof KeywordTokenizerFactory);
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/NotRequiredUniqueKeyTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/NotRequiredUniqueKeyTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/NotRequiredUniqueKeyTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/NotRequiredUniqueKeyTest.java Tue Apr 23 14:29:10 2013
@@ -19,7 +19,6 @@ package org.apache.solr.schema;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.core.SolrCore;
-import org.apache.solr.schema.SchemaField;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -40,7 +39,7 @@ public class NotRequiredUniqueKeyTest ex
public void testSchemaLoading()
{
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
SchemaField uniqueKey = schema.getUniqueKeyField();
assertFalse( uniqueKey.isRequired() );
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/PolyFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/PolyFieldTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/PolyFieldTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/PolyFieldTest.java Tue Apr 23 14:29:10 2013
@@ -41,7 +41,7 @@ public class PolyFieldTest extends SolrT
@Test
public void testSchemaBasics() throws Exception {
- IndexSchema schema = h.getCore().getSchema();
+ IndexSchema schema = h.getCore().getLatestSchema();
SchemaField home = schema.getField("home");
@@ -75,7 +75,7 @@ public class PolyFieldTest extends SolrT
@Test
public void testPointFieldType() throws Exception {
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
SchemaField home = schema.getField("home");
assertNotNull(home);
assertTrue("home is not a poly field", home.isPolyField());
@@ -161,7 +161,7 @@ public class PolyFieldTest extends SolrT
@Test
public void testSearchDetails() throws Exception {
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
double[] xy = new double[]{35.0, -79.34};
String point = xy[0] + "," + xy[1];
//How about some queries?
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/PreAnalyzedFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/PreAnalyzedFieldTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/PreAnalyzedFieldTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/PreAnalyzedFieldTest.java Tue Apr 23 14:29:10 2013
@@ -21,9 +21,7 @@ import java.util.Collections;
import java.util.HashMap;
import org.apache.lucene.document.Field;
-import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.common.util.Base64;
import org.apache.solr.schema.PreAnalyzedField.PreAnalyzedParser;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -89,7 +87,7 @@ public class PreAnalyzedFieldTest extend
// use Simple format
HashMap<String,String> args = new HashMap<String,String>();
args.put(PreAnalyzedField.PARSER_IMPL, SimplePreAnalyzedParser.class.getName());
- paf.init(h.getCore().getSchema(), args);
+ paf.init(h.getCore().getLatestSchema(), args);
PreAnalyzedParser parser = new SimplePreAnalyzedParser();
for (int i = 0; i < valid.length; i++) {
String s = valid[i];
@@ -107,7 +105,7 @@ public class PreAnalyzedFieldTest extend
@Test
public void testInvalidSimple() {
PreAnalyzedField paf = new PreAnalyzedField();
- paf.init(h.getCore().getSchema(), Collections.<String,String>emptyMap());
+ paf.init(h.getCore().getLatestSchema(), Collections.<String,String>emptyMap());
for (String s : invalid) {
try {
paf.fromString(field, s, 1.0f);
@@ -132,7 +130,7 @@ public class PreAnalyzedFieldTest extend
// use Simple format
HashMap<String,String> args = new HashMap<String,String>();
args.put(PreAnalyzedField.PARSER_IMPL, SimplePreAnalyzedParser.class.getName());
- paf.init(h.getCore().getSchema(), args);
+ paf.init(h.getCore().getLatestSchema(), args);
try {
Field f = (Field)paf.fromString(field, valid[0], 1.0f);
} catch (Exception e) {
@@ -140,7 +138,7 @@ public class PreAnalyzedFieldTest extend
}
// use JSON format
args.put(PreAnalyzedField.PARSER_IMPL, JsonPreAnalyzedParser.class.getName());
- paf.init(h.getCore().getSchema(), args);
+ paf.init(h.getCore().getLatestSchema(), args);
try {
Field f = (Field)paf.fromString(field, valid[0], 1.0f);
fail("Should fail JSON parsing: '" + valid[0]);
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/RequiredFieldsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/RequiredFieldsTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/RequiredFieldsTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/RequiredFieldsTest.java Tue Apr 23 14:29:10 2013
@@ -21,7 +21,6 @@ import java.util.Collection;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.core.SolrCore;
-import org.apache.solr.schema.SchemaField;
import org.junit.BeforeClass;
import org.junit.Test;
/**
@@ -42,7 +41,7 @@ public class RequiredFieldsTest extends
@Test
public void testRequiredFieldsConfig() {
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
SchemaField uniqueKey = schema.getUniqueKeyField();
// Make sure the uniqueKey is required
@@ -73,12 +72,12 @@ public class RequiredFieldsTest extends
assertU(commit());
// Add another document without a subject, which has a default in schema
- String subjectDefault = core.getSchema().getField("subject").getDefaultValue();
+ String subjectDefault = core.getLatestSchema().getField("subject").getDefaultValue();
assertNotNull("subject has no default value", subjectDefault);
assertQ("should find one with subject="+subjectDefault, req("id:530 subject:"+subjectDefault) ,"//result[@numFound=1]" );
// Add another document without a required name, which has no default
- assertNull(core.getSchema().getField("name").getDefaultValue());
+ assertNull(core.getLatestSchema().getField("name").getDefaultValue());
ignoreException("missing required field");
assertFailedU("adding doc without required field",
adoc("id", "531", "subject", "no name document", "field_t", "what's inside?") );
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/SchemaVersionSpecificBehaviorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/SchemaVersionSpecificBehaviorTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/SchemaVersionSpecificBehaviorTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/SchemaVersionSpecificBehaviorTest.java Tue Apr 23 14:29:10 2013
@@ -18,12 +18,6 @@
package org.apache.solr.schema;
import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.core.SolrCore;
-import org.apache.solr.schema.IndexSchema;
-
-
-import java.util.HashMap;
-import java.util.Map;
public class SchemaVersionSpecificBehaviorTest extends SolrTestCaseJ4 {
@@ -189,7 +183,7 @@ public class SchemaVersionSpecificBehavi
try {
System.setProperty("solr.schema.test.ver", String.valueOf(ver));
initCore( "solrconfig-basic.xml", "schema-behavior.xml" );
- IndexSchema s = h.getCore().getSchema();
+ IndexSchema s = h.getCore().getLatestSchema();
assertEquals("Schema version not set correctly",
String.valueOf(ver),
String.valueOf(s.getVersion()));
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/SynonymTokenizerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/SynonymTokenizerTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/SynonymTokenizerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/SynonymTokenizerTest.java Tue Apr 23 14:29:10 2013
@@ -38,7 +38,7 @@ public class SynonymTokenizerTest extend
@Test
public void testSchemaLoading() {
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
assertTrue( schema.getFieldTypes().containsKey("text_synonyms") );
}
}
Copied: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaAddField.java (from r1470539, lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaAddField.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaAddField.java?p2=lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaAddField.java&p1=lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaAddField.java&r1=1470539&r2=1470979&rev=1470979&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaAddField.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchemaAddField.java Tue Apr 23 14:29:10 2013
@@ -91,12 +91,15 @@ public class TestCloudManagedSchemaAddFi
+ " content=" + content + " response=" + response);
}
- int maxAttempts = 10;
+ int maxAttempts = 20;
+ long retryPauseMillis = 10;
+
for (RestTestHarness client : restTestHarnesses) {
boolean stillTrying = true;
for (int attemptNum = 1; stillTrying && attemptNum <= maxAttempts ; ++attemptNum) {
request = "/schema/fields/" + newFieldName + "?wt=xml";
response = client.query(request);
+ long elapsedTimeMillis = System.currentTimeMillis() - addFieldTime;
result = client.validateXPath(response,
"/response/lst[@name='responseHeader']/int[@name='status'][.='0']",
"/response/lst[@name='field']/str[@name='name'][.='" + newFieldName + "']");
@@ -104,16 +107,18 @@ public class TestCloudManagedSchemaAddFi
stillTrying = false;
if (attemptNum > 1) {
log.info("On attempt #" + attemptNum + ", successful request " + request + " against server "
- + client.getBaseURL() + " after " + (System.currentTimeMillis() - addFieldTime) + " ms");
+ + client.getBaseURL() + " after " + elapsedTimeMillis + " ms");
}
} else {
if (attemptNum == maxAttempts || ! response.contains("Field '" + newFieldName + "' not found.")) {
String msg = "QUERY FAILED: xpath=" + result + " request=" + request + " response=" + response;
if (attemptNum == maxAttempts) {
- msg = "Max retry count " + maxAttempts + " exceeded. " + msg;
+ msg = "Max retry count " + maxAttempts + " exceeded after " + elapsedTimeMillis +" ms. " + msg;
}
+ log.error(msg);
fail(msg);
}
+ Thread.sleep(retryPauseMillis);
}
}
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java Tue Apr 23 14:29:10 2013
@@ -17,8 +17,15 @@ package org.apache.solr.schema;
*/
import java.io.File;
+import java.io.FileInputStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CoreAdminParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.AbstractBadConfigTestBase;
@@ -45,9 +52,14 @@ public class TestManagedSchema extends A
tmpSolrHome = new File(tmpSolrHomePath).getAbsoluteFile();
tmpConfDir = new File(tmpSolrHome, confDir);
File testHomeConfDir = new File(TEST_HOME(), confDir);
+ FileUtils.copyFileToDirectory(new File(testHomeConfDir, "solrconfig-mutable-managed-schema.xml"), tmpConfDir);
FileUtils.copyFileToDirectory(new File(testHomeConfDir, "solrconfig-managed-schema.xml"), tmpConfDir);
FileUtils.copyFileToDirectory(new File(testHomeConfDir, "solrconfig-basic.xml"), tmpConfDir);
+ FileUtils.copyFileToDirectory(new File(testHomeConfDir, "schema-one-field-no-dynamic-field.xml"), tmpConfDir);
FileUtils.copyFileToDirectory(new File(testHomeConfDir, "schema-minimal.xml"), tmpConfDir);
+ FileUtils.copyFileToDirectory(new File(testHomeConfDir, "schema_codec.xml"), tmpConfDir);
+ FileUtils.copyFileToDirectory(new File(testHomeConfDir, "schema-bm25.xml"), tmpConfDir);
+
// initCore will trigger an upgrade to managed schema, since the solrconfig has
// <schemaFactory class="ManagedIndexSchemaFactory" ... />
initCore("solrconfig-managed-schema.xml", "schema-minimal.xml", tmpSolrHome.getPath());
@@ -120,4 +132,257 @@ public class TestManagedSchema extends A
String collectionSchema = (String)collectionStatus.get(CoreAdminParams.SCHEMA);
assertEquals("Schema resource name differs from expected name", expectedSchemaResource, collectionSchema);
}
+
+ public void testAddFieldWhenNotMutable() throws Exception {
+ assertSchemaResource(collection, "managed-schema");
+ String errString = "This ManagedIndexSchema is not mutable.";
+ ignoreException(Pattern.quote(errString));
+ try {
+ IndexSchema oldSchema = h.getCore().getLatestSchema();
+ String fieldName = "new_field";
+ String fieldType = "string";
+ Map<String,?> options = Collections.emptyMap();
+ SchemaField newField = oldSchema.newField(fieldName, fieldType, options);
+ IndexSchema newSchema = oldSchema.addField(newField);
+ h.getCore().setLatestSchema(newSchema);
+ fail();
+ } catch (Exception e) {
+ for (Throwable t = e; t != null; t = t.getCause()) {
+ // short circuit out if we found what we expected
+ if (t.getMessage() != null && -1 != t.getMessage().indexOf(errString)) return;
+ }
+ // otherwise, rethrow it, possibly completely unrelated
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+ "Unexpected error, expected error matching: " + errString, e);
+ } finally {
+ resetExceptionIgnores();
+ }
+ }
+
+ public void testAddFieldPersistence() throws Exception {
+ assertSchemaResource(collection, "managed-schema");
+ deleteCore();
+ File managedSchemaFile = new File(tmpConfDir, "managed-schema");
+ assertTrue(managedSchemaFile.delete()); // Delete managed-schema so it won't block parsing a new schema
+ initCore("solrconfig-mutable-managed-schema.xml", "schema-one-field-no-dynamic-field.xml", tmpSolrHome.getPath());
+
+ assertTrue(managedSchemaFile.exists());
+ String managedSchemaContents = FileUtils.readFileToString(managedSchemaFile, "UTF-8");
+ assertFalse(managedSchemaContents.contains("\"new_field\""));
+
+ Map<String,Object> options = new HashMap<String,Object>();
+ options.put("stored", "false");
+ IndexSchema oldSchema = h.getCore().getLatestSchema();
+ String fieldName = "new_field";
+ String fieldType = "string";
+ SchemaField newField = oldSchema.newField(fieldName, fieldType, options);
+ IndexSchema newSchema = oldSchema.addField(newField);
+ h.getCore().setLatestSchema(newSchema);
+
+ assertTrue(managedSchemaFile.exists());
+ FileInputStream stream = new FileInputStream(managedSchemaFile);
+ managedSchemaContents = IOUtils.toString(stream, "UTF-8");
+ stream.close(); // Explicitly close so that Windows can delete this file
+ assertTrue(managedSchemaContents.contains("<field name=\"new_field\" type=\"string\" stored=\"false\"/>"));
+ }
+
+ public void testAddedFieldIndexableAndQueryable() throws Exception {
+ assertSchemaResource(collection, "managed-schema");
+ deleteCore();
+ File managedSchemaFile = new File(tmpConfDir, "managed-schema");
+ assertTrue(managedSchemaFile.delete()); // Delete managed-schema so it won't block parsing a new schema
+ initCore("solrconfig-mutable-managed-schema.xml", "schema-one-field-no-dynamic-field.xml", tmpSolrHome.getPath());
+
+ assertTrue(managedSchemaFile.exists());
+ String managedSchemaContents = FileUtils.readFileToString(managedSchemaFile, "UTF-8");
+ assertFalse(managedSchemaContents.contains("\"new_field\""));
+
+ clearIndex();
+
+ String errString = "unknown field 'new_field'";
+ ignoreException(Pattern.quote(errString));
+ try {
+ assertU(adoc("new_field", "thing1 thing2", "str", "X"));
+ fail();
+ } catch (Exception e) {
+ for (Throwable t = e; t != null; t = t.getCause()) {
+ // short circuit out if we found what we expected
+ if (t.getMessage() != null && -1 != t.getMessage().indexOf(errString)) return;
+ }
+ // otherwise, rethrow it, possibly completely unrelated
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+ "Unexpected error, expected error matching: " + errString, e);
+ } finally {
+ resetExceptionIgnores();
+ }
+ assertU(commit());
+ assertQ(req("new_field:thing1"), "//*[@numFound='0']");
+
+ Map<String,Object> options = new HashMap<String,Object>();
+ options.put("stored", "false");
+ IndexSchema oldSchema = h.getCore().getLatestSchema();
+ String fieldName = "new_field";
+ String fieldType = "text";
+ SchemaField newField = oldSchema.newField(fieldName, fieldType, options);
+ IndexSchema newSchema = oldSchema.addField(newField);
+ h.getCore().setLatestSchema(newSchema);
+
+ assertU(adoc("new_field", "thing1 thing2", "str", "X"));
+ assertU(commit());
+
+ assertQ(req("new_field:thing1"), "//*[@numFound='1']");
+ }
+
+ public void testAddFieldWhenItAlreadyExists() throws Exception{
+ deleteCore();
+ File managedSchemaFile = new File(tmpConfDir, "managed-schema");
+ assertTrue(managedSchemaFile.delete()); // Delete managed-schema so it won't block parsing a new schema
+ initCore("solrconfig-mutable-managed-schema.xml", "schema-one-field-no-dynamic-field.xml", tmpSolrHome.getPath());
+
+ assertNotNull("Field 'str' is not present in the schema", h.getCore().getLatestSchema().getFieldOrNull("str"));
+
+ String errString = "Field 'str' already exists.";
+ ignoreException(Pattern.quote(errString));
+ try {
+ Map<String,Object> options = new HashMap<String,Object>();
+ IndexSchema oldSchema = h.getCore().getLatestSchema();
+ String fieldName = "str";
+ String fieldType = "string";
+ SchemaField newField = oldSchema.newField(fieldName, fieldType, options);
+ IndexSchema newSchema = oldSchema.addField(newField);
+ h.getCore().setLatestSchema(newSchema);
+ fail("Should fail when adding a field that already exists");
+ } catch (Exception e) {
+ for (Throwable t = e; t != null; t = t.getCause()) {
+ // short circuit out if we found what we expected
+ if (t.getMessage() != null && -1 != t.getMessage().indexOf(errString)) return;
+ }
+ // otherwise, rethrow it, possibly completely unrelated
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+ "Unexpected error, expected error matching: " + errString, e);
+ } finally {
+ resetExceptionIgnores();
+ }
+ }
+
+ public void testAddSameFieldTwice() throws Exception{
+ deleteCore();
+ File managedSchemaFile = new File(tmpConfDir, "managed-schema");
+ assertTrue(managedSchemaFile.delete()); // Delete managed-schema so it won't block parsing a new schema
+ initCore("solrconfig-mutable-managed-schema.xml", "schema-one-field-no-dynamic-field.xml", tmpSolrHome.getPath());
+
+ Map<String,Object> options = new HashMap<String,Object>();
+ options.put("stored", "false");
+ IndexSchema oldSchema = h.getCore().getLatestSchema();
+ String fieldName = "new_field";
+ String fieldType = "text";
+ SchemaField newField = oldSchema.newField(fieldName, fieldType, options);
+ IndexSchema newSchema = oldSchema.addField(newField);
+ h.getCore().setLatestSchema(newSchema);
+
+ String errString = "Field 'new_field' already exists.";
+ ignoreException(Pattern.quote(errString));
+ try {
+ newSchema = newSchema.addField(newField);
+ h.getCore().setLatestSchema(newSchema);
+ fail("Should fail when adding the same field twice");
+ } catch (Exception e) {
+ for (Throwable t = e; t != null; t = t.getCause()) {
+ // short circuit out if we found what we expected
+ if (t.getMessage() != null && -1 != t.getMessage().indexOf(errString)) return;
+ }
+ // otherwise, rethrow it, possibly completely unrelated
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+ "Unexpected error, expected error matching: " + errString, e);
+ } finally {
+ resetExceptionIgnores();
+ }
+ }
+
+ public void testAddDynamicField() throws Exception{
+ deleteCore();
+ File managedSchemaFile = new File(tmpConfDir, "managed-schema");
+ assertTrue(managedSchemaFile.delete()); // Delete managed-schema so it won't block parsing a new schema
+ initCore("solrconfig-mutable-managed-schema.xml", "schema-one-field-no-dynamic-field.xml", tmpSolrHome.getPath());
+
+ assertNull("Field '*_s' is present in the schema", h.getCore().getLatestSchema().getFieldOrNull("*_s"));
+
+ String errString = "Can't add dynamic field '*_s'.";
+ ignoreException(Pattern.quote(errString));
+ try {
+ Map<String,Object> options = new HashMap<String,Object>();
+ IndexSchema oldSchema = h.getCore().getLatestSchema();
+ String fieldName = "*_s";
+ String fieldType = "string";
+ SchemaField newField = oldSchema.newField(fieldName, fieldType, options);
+ IndexSchema newSchema = oldSchema.addField(newField);
+ h.getCore().setLatestSchema(newSchema);
+ fail("Should fail when adding a dynamic field");
+ } catch (Exception e) {
+ for (Throwable t = e; t != null; t = t.getCause()) {
+ // short circuit out if we found what we expected
+ if (t.getMessage() != null && -1 != t.getMessage().indexOf(errString)) return;
+ }
+ // otherwise, rethrow it, possibly completely unrelated
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+ "Unexpected error, expected error matching: " + errString, e);
+ } finally {
+ resetExceptionIgnores();
+ }
+ }
+
+ public void testAddWithSchemaCodecFactory() throws Exception {
+ deleteCore();
+ File managedSchemaFile = new File(tmpConfDir, "managed-schema");
+ assertTrue(managedSchemaFile.delete()); // Delete managed-schema so it won't block parsing a new schema
+ initCore("solrconfig-mutable-managed-schema.xml", "schema_codec.xml", tmpSolrHome.getPath());
+
+ String uniqueKey = "string_f";
+ assertNotNull("Unique key field '" + uniqueKey + "' is not present in the schema",
+ h.getCore().getLatestSchema().getFieldOrNull(uniqueKey));
+
+ String fieldName = "string_disk_new_field";
+ assertNull("Field '" + fieldName + "' is present in the schema",
+ h.getCore().getLatestSchema().getFieldOrNull(fieldName));
+
+ Map<String,Object> options = new HashMap<String,Object>();
+ IndexSchema oldSchema = h.getCore().getLatestSchema();
+ String fieldType = "string_disk";
+ SchemaField newField = oldSchema.newField(fieldName, fieldType, options);
+ IndexSchema newSchema = oldSchema.addField(newField);
+ h.getCore().setLatestSchema(newSchema);
+
+ assertU(adoc(fieldName, "thing", uniqueKey, "aBc"));
+ assertU(commit());
+
+ assertQ(req(fieldName + ":thing"), "//*[@numFound='1']");
+ }
+
+ public void testAddWithSchemaSimilarityFactory() throws Exception {
+ deleteCore();
+ File managedSchemaFile = new File(tmpConfDir, "managed-schema");
+ assertTrue(managedSchemaFile.delete()); // Delete managed-schema so it won't block parsing a new schema
+ initCore("solrconfig-mutable-managed-schema.xml", "schema-bm25.xml", tmpSolrHome.getPath());
+
+ String uniqueKey = "id";
+ assertNotNull("Unique key field '" + uniqueKey + "' is not present in the schema",
+ h.getCore().getLatestSchema().getFieldOrNull(uniqueKey));
+
+ String fieldName = "new_text_field";
+ assertNull("Field '" + fieldName + "' is present in the schema",
+ h.getCore().getLatestSchema().getFieldOrNull(fieldName));
+
+ Map<String,Object> options = new HashMap<String,Object>();
+ IndexSchema oldSchema = h.getCore().getLatestSchema();
+ String fieldType = "text";
+ SchemaField newField = oldSchema.newField(fieldName, fieldType, options);
+ IndexSchema newSchema = oldSchema.addField(newField);
+ h.getCore().setLatestSchema(newSchema);
+
+ assertU(adoc(fieldName, "thing", uniqueKey, "123"));
+ assertU(commit());
+
+ assertQ(req(fieldName + ":thing"), "//*[@numFound='1']");
+ }
+
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java Tue Apr 23 14:29:10 2013
@@ -22,7 +22,6 @@ import org.apache.lucene.search.SortFiel
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.SolrException;
import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.schema.IndexSchema;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -75,7 +74,6 @@ public class QueryParsingTest extends So
Sort sort;
SolrQueryRequest req = req();
- IndexSchema schema = h.getCore().getSchema();
sort = QueryParsing.parseSort("score desc", req);
assertNull("sort", sort);//only 1 thing in the list, no Sort specified
@@ -188,7 +186,6 @@ public class QueryParsingTest extends So
Sort sort;
SolrQueryRequest req = req();
- IndexSchema schema = h.getCore().getSchema();
//test some bad vals
try {
sort = QueryParsing.parseSort("weight, desc", req);
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java Tue Apr 23 14:29:10 2013
@@ -69,7 +69,7 @@ public class TestPseudoReturnFields exte
// score as psuedo field - precondition checks
for (String name : new String[] {"score", "val_ss"}) {
- SchemaField sf = h.getCore().getSchema().getFieldOrNull(name);
+ SchemaField sf = h.getCore().getLatestSchema().getFieldOrNull(name);
assertNotNull("Test depends on a (dynamic) field mtching '"+name+
"', schema was changed out from under us!",sf);
assertTrue("Test depends on a multivalued dynamic field matching '"+name+
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java Tue Apr 23 14:29:10 2013
@@ -87,7 +87,7 @@ public class DirectUpdateHandlerTest ext
assertNull("This test requires a schema that has no version field, " +
"it appears the schema file in use has been edited to violate " +
"this requirement",
- h.getCore().getSchema().getFieldOrNull(VersionInfo.VERSION_FIELD));
+ h.getCore().getLatestSchema().getFieldOrNull(VersionInfo.VERSION_FIELD));
assertU(adoc("id","5"));
assertU(adoc("id","6"));
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java Tue Apr 23 14:29:10 2013
@@ -60,7 +60,7 @@ public class DocumentBuilderTest extends
try {
SolrInputDocument doc = new SolrInputDocument();
doc.setField( "unknown field", 12345, 1.0f );
- DocumentBuilder.toDocument( doc, core.getSchema() );
+ DocumentBuilder.toDocument( doc, core.getLatestSchema() );
fail( "should throw an error" );
}
catch( SolrException ex ) {
@@ -76,7 +76,7 @@ public class DocumentBuilderTest extends
// make sure a null value is not indexed
SolrInputDocument doc = new SolrInputDocument();
doc.addField( "name", null, 1.0f );
- Document out = DocumentBuilder.toDocument( doc, core.getSchema() );
+ Document out = DocumentBuilder.toDocument( doc, core.getLatestSchema() );
assertNull( out.get( "name" ) );
}
@@ -90,7 +90,7 @@ public class DocumentBuilderTest extends
doc.addField( "id", "123", 1.0f );
doc.addField( "unknown", "something", 1.0f );
try {
- DocumentBuilder.toDocument( doc, core.getSchema() );
+ DocumentBuilder.toDocument( doc, core.getLatestSchema() );
fail( "added an unknown field" );
}
catch( Exception ex ) {
@@ -101,7 +101,7 @@ public class DocumentBuilderTest extends
doc.addField( "weight", "not a number", 1.0f );
try {
- DocumentBuilder.toDocument( doc, core.getSchema() );
+ DocumentBuilder.toDocument( doc, core.getLatestSchema() );
fail( "invalid 'float' field value" );
}
catch( Exception ex ) {
@@ -111,7 +111,7 @@ public class DocumentBuilderTest extends
// now make sure it is OK
doc.setField( "weight", "1.34", 1.0f );
- DocumentBuilder.toDocument( doc, core.getSchema() );
+ DocumentBuilder.toDocument( doc, core.getLatestSchema() );
}
@Test
@@ -121,7 +121,7 @@ public class DocumentBuilderTest extends
// make sure a null value is not indexed
SolrInputDocument doc = new SolrInputDocument();
doc.addField( "home", "2.2,3.3", 1.0f );
- Document out = DocumentBuilder.toDocument( doc, core.getSchema() );
+ Document out = DocumentBuilder.toDocument( doc, core.getLatestSchema() );
assertNotNull( out.get( "home" ) );//contains the stored value and term vector, if there is one
assertNotNull( out.getField( "home_0" + FieldType.POLY_FIELD_SEPARATOR + "double" ) );
assertNotNull( out.getField( "home_1" + FieldType.POLY_FIELD_SEPARATOR + "double" ) );
@@ -130,13 +130,13 @@ public class DocumentBuilderTest extends
@Test
public void testCopyFieldWithDocumentBoost() {
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
assertFalse(schema.getField("title").omitNorms());
assertTrue(schema.getField("title_stringNoNorms").omitNorms());
SolrInputDocument doc = new SolrInputDocument();
doc.setDocumentBoost(3f);
doc.addField( "title", "mytitle");
- Document out = DocumentBuilder.toDocument( doc, core.getSchema() );
+ Document out = DocumentBuilder.toDocument( doc, schema );
assertNotNull( out.get( "title_stringNoNorms" ) );
assertTrue("title_stringNoNorms has the omitNorms attribute set to true, if the boost is different than 1.0, it will fail",1.0f == out.getField( "title_stringNoNorms" ).boost() );
assertTrue("It is OK that title has a boost of 3",3.0f == out.getField( "title" ).boost() );
@@ -146,12 +146,12 @@ public class DocumentBuilderTest extends
@Test
public void testCopyFieldWithFieldBoost() {
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
assertFalse(schema.getField("title").omitNorms());
assertTrue(schema.getField("title_stringNoNorms").omitNorms());
SolrInputDocument doc = new SolrInputDocument();
doc.addField( "title", "mytitle", 3.0f );
- Document out = DocumentBuilder.toDocument( doc, core.getSchema() );
+ Document out = DocumentBuilder.toDocument( doc, schema );
assertNotNull( out.get( "title_stringNoNorms" ) );
assertTrue("title_stringNoNorms has the omitNorms attribute set to true, if the boost is different than 1.0, it will fail",1.0f == out.getField( "title_stringNoNorms" ).boost() );
assertTrue("It is OK that title has a boost of 3",3.0f == out.getField( "title" ).boost() );
@@ -160,7 +160,7 @@ public class DocumentBuilderTest extends
@Test
public void testWithPolyFieldsAndFieldBoost() {
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
assertFalse(schema.getField("store").omitNorms());
assertTrue(schema.getField("store_0_coordinate").omitNorms());
assertTrue(schema.getField("store_1_coordinate").omitNorms());
@@ -171,7 +171,7 @@ public class DocumentBuilderTest extends
SolrInputDocument doc = new SolrInputDocument();
doc.addField( "store", "40.7143,-74.006", 3.0f );
doc.addField( "amount", "10.5", 3.0f );
- Document out = DocumentBuilder.toDocument( doc, core.getSchema() );
+ Document out = DocumentBuilder.toDocument( doc, schema );
assertNotNull( out.get( "store" ) );
assertNotNull( out.get( "amount" ) );
assertNotNull(out.getField("store_0_coordinate"));
@@ -185,7 +185,7 @@ public class DocumentBuilderTest extends
@Test
public void testWithPolyFieldsAndDocumentBoost() {
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
assertFalse(schema.getField("store").omitNorms());
assertTrue(schema.getField("store_0_coordinate").omitNorms());
assertTrue(schema.getField("store_1_coordinate").omitNorms());
@@ -197,7 +197,7 @@ public class DocumentBuilderTest extends
doc.setDocumentBoost(3.0f);
doc.addField( "store", "40.7143,-74.006");
doc.addField( "amount", "10.5");
- Document out = DocumentBuilder.toDocument( doc, core.getSchema() );
+ Document out = DocumentBuilder.toDocument( doc, schema );
assertNotNull( out.get( "store" ) );
assertNotNull(out.getField("store_0_coordinate"));
//NOTE: As the subtypes have omitNorm=true, they must have boost=1F, otherwise this is going to fail when adding the doc to Lucene.
@@ -221,7 +221,7 @@ public class DocumentBuilderTest extends
public void testMultiValuedFieldAndDocBoosts() throws Exception {
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
SolrInputDocument doc = new SolrInputDocument();
doc.setDocumentBoost(3.0f);
SolrInputField field = new SolrInputField( "foo_t" );
@@ -230,7 +230,7 @@ public class DocumentBuilderTest extends
field.addValue( "living is easy" , 1.0f );
doc.put( field.getName(), field );
- Document out = DocumentBuilder.toDocument( doc, core.getSchema() );
+ Document out = DocumentBuilder.toDocument( doc, schema );
IndexableField[] outF = out.getFields( field.getName() );
assertEquals("wrong number of field values",
3, outF.length);
@@ -247,7 +247,7 @@ public class DocumentBuilderTest extends
public void testCopyFieldsAndFieldBoostsAndDocBoosts() throws Exception {
SolrCore core = h.getCore();
- IndexSchema schema = core.getSchema();
+ IndexSchema schema = core.getLatestSchema();
SolrInputDocument doc = new SolrInputDocument();
final float DOC_BOOST = 3.0F;
@@ -269,7 +269,7 @@ public class DocumentBuilderTest extends
assertEquals(FOO_BOOST, inFoo.getBoost(), 0.0F);
doc.put( inFoo.getName(), inFoo );
- Document out = DocumentBuilder.toDocument( doc, core.getSchema() );
+ Document out = DocumentBuilder.toDocument( doc, schema );
IndexableField[] outTitle = out.getFields( inTitle.getName() );
assertEquals("wrong number of title values",
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/TestIndexingPerformance.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/TestIndexingPerformance.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/TestIndexingPerformance.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/TestIndexingPerformance.java Tue Apr 23 14:29:10 2013
@@ -17,10 +17,8 @@
package org.apache.solr.update;
-import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.schema.IndexSchema;
import org.apache.solr.util.AbstractSolrTestCase;
import org.apache.solr.common.util.StrUtils;
import org.junit.AfterClass;
@@ -73,7 +71,6 @@ public class TestIndexingPerformance ext
SolrQueryRequest req = lrf.makeRequest();
- IndexSchema schema = req.getSchema();
UpdateHandler updateHandler = req.getCore().getUpdateHandler();
String field = "textgap";
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java Tue Apr 23 14:29:10 2013
@@ -17,36 +17,15 @@
package org.apache.solr.update.processor;
-import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.TreeSet;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Arrays;
-import java.io.IOException;
-
-import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.SolrInputField;
-import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.common.params.SolrParams;
-
-import org.apache.solr.core.SolrCore;
import org.apache.solr.schema.IndexSchema;
-
-import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.request.LocalSolrQueryRequest;
-import org.apache.solr.response.SolrQueryResponse;
-
-import org.apache.solr.update.AddUpdateCommand;
-import org.apache.solr.update.processor.UpdateRequestProcessor;
-import org.apache.solr.update.processor.UpdateRequestProcessorChain;
-
-import org.junit.Before;
import org.junit.BeforeClass;
-import org.junit.Test;
/**
* Tests the basics of configuring FieldMutatingUpdateProcessors
@@ -570,7 +549,7 @@ public class FieldMutatingUpdateProcesso
public void testIgnore() throws Exception {
- IndexSchema schema = h.getCore().getSchema();
+ IndexSchema schema = h.getCore().getLatestSchema();
assertNull("test expects 'foo_giberish' to not be a valid field, looks like schema was changed out from under us",
schema.getFieldTypeNoEx("foo_giberish"));
assertNotNull("test expects 't_raw' to be a valid field, looks like schema was changed out from under us",
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/util/SolrPluginUtilsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/util/SolrPluginUtilsTest.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/util/SolrPluginUtilsTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/util/SolrPluginUtilsTest.java Tue Apr 23 14:29:10 2013
@@ -20,7 +20,6 @@ package org.apache.solr.util;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.search.QParser;
-import org.apache.solr.util.SolrPluginUtils;
import org.apache.solr.util.SolrPluginUtils.DisjunctionMaxQueryParser;
import org.apache.solr.search.SolrIndexSearcher;
import org.apache.solr.search.DocList;
@@ -200,7 +199,7 @@ public class SolrPluginUtilsTest extends
assertTrue(t+" sanity test isn't TermQuery: " + out.getClass(),
out instanceof TermQuery);
assertEquals(t+" sanity test is wrong field",
- h.getCore().getSchema().getDefaultSearchFieldName(),
+ h.getCore().getLatestSchema().getDefaultSearchFieldName(),
((TermQuery)out).getTerm().field());
t = "subject:XXXXXXXX";
Modified: lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java?rev=1470979&r1=1470978&r2=1470979&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java (original)
+++ lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java Tue Apr 23 14:29:10 2013
@@ -29,6 +29,7 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
+import java.util.SortedMap;
import java.util.concurrent.atomic.AtomicInteger;
import junit.framework.Assert;
@@ -52,6 +53,7 @@ import org.apache.solr.common.params.Sol
import org.apache.solr.common.util.NamedList;
import org.apache.solr.schema.TrieDateField;
import org.apache.solr.util.AbstractSolrTestCase;
+import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
@@ -363,7 +365,9 @@ public abstract class BaseDistributedSea
public JettySolrRunner createJetty(File solrHome, String dataDir, String shardList, String solrConfigOverride, String schemaOverride, boolean explicitCoreNodeName) throws Exception {
- JettySolrRunner jetty = new JettySolrRunner(solrHome.getAbsolutePath(), context, 0, solrConfigOverride, schemaOverride);
+ boolean stopAtShutdown = true;
+ JettySolrRunner jetty = new JettySolrRunner
+ (solrHome.getAbsolutePath(), context, 0, solrConfigOverride, schemaOverride, stopAtShutdown, getExtraServlets());
jetty.setShards(shardList);
jetty.setDataDir(dataDir);
if (explicitCoreNodeName) {
@@ -374,12 +378,17 @@ public abstract class BaseDistributedSea
return jetty;
}
+ /** Override this method to insert extra servlets into the JettySolrRunners that are created using createJetty() */
+ public SortedMap<ServletHolder,String> getExtraServlets() {
+ return null;
+ }
+
protected SolrServer createNewSolrServer(int port) {
try {
// setup the server...
String url = "http://127.0.0.1:" + port + context;
HttpSolrServer s = new HttpSolrServer(url);
- s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);;
+ s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
s.setSoTimeout(60000);
s.setDefaultMaxConnectionsPerHost(100);
s.setMaxTotalConnections(100);