You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2013/05/30 09:53:46 UTC
svn commit: r1487777 [47/50] - in /lucene/dev/branches/security: ./
dev-tools/ dev-tools/eclipse/dot.settings/ dev-tools/idea/.idea/
dev-tools/idea/.idea/libraries/ dev-tools/idea/lucene/replicator/
dev-tools/maven/ dev-tools/maven/lucene/ dev-tools/ma...
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java Thu May 30 07:53:18 2013
@@ -32,8 +32,8 @@ import org.junit.BeforeClass;
/**
* Sanity checks that queries (generated by the QParser and ValueSourceParser
- * framework) are appropraitely {@link Object#equals} and
- * {@link Object#hashCode()} equivilent. If you are adding a new default
+ * framework) are appropriately {@link Object#equals} and
+ * {@link Object#hashCode()} equivalent. If you are adding a new default
* QParser or ValueSourceParser, you will most likely get a failure from
* {@link #testParserCoverage} until you add a new test method to this class.
*
@@ -75,7 +75,20 @@ public class QueryEqualityTest extends S
private static final Set<String> valParsersTested = new HashSet<String>();
+ public void testDateMathParsingEquality() throws Exception {
+ // regardless of parser, these should all be equivalent queries
+ assertQueryEquals
+ (null
+ ,"{!lucene}f_tdt:2013-09-11T00\\:00\\:00Z"
+ ,"{!lucene}f_tdt:2013-03-08T00\\:46\\:15Z/DAY+6MONTHS+3DAYS"
+ ,"{!lucene}f_tdt:\"2013-03-08T00:46:15Z/DAY+6MONTHS+3DAYS\""
+ ,"{!field f=f_tdt}2013-03-08T00:46:15Z/DAY+6MONTHS+3DAYS"
+ ,"{!field f=f_tdt}2013-09-11T00:00:00Z"
+ ,"{!term f=f_tdt}2013-03-08T00:46:15Z/DAY+6MONTHS+3DAYS"
+ ,"{!term f=f_tdt}2013-09-11T00:00:00Z"
+ );
+ }
public void testQueryLucene() throws Exception {
assertQueryEquals("lucene", "{!lucene}apache solr",
"apache solr", "apache solr ");
@@ -691,6 +704,18 @@ public class QueryEqualityTest extends S
assertFuncEquals("sleep(1,5)", "sleep(1,5)");
assertFuncEquals("threadid()", "threadid()");
}
+
+ // TODO: more tests
+ public void testQueryMaxScore() throws Exception {
+ assertQueryEquals("maxscore", "{!maxscore}A OR B OR C",
+ "A OR B OR C");
+ assertQueryEquals("maxscore", "{!maxscore}A AND B",
+ "A AND B");
+ assertQueryEquals("maxscore", "{!maxscore}apache -solr",
+ "apache -solr", "apache -solr ");
+ assertQueryEquals("maxscore", "+apache +solr", "apache AND solr",
+ "+apache +solr");
+ }
/**
* this test does not assert anything itself, it simply toggles a static
@@ -720,8 +745,8 @@ public class QueryEqualityTest extends S
}
/**
- * NOTE: defType is not only used to pick the parser, but also to record
- * the parser being tested for coverage sanity checking
+ * NOTE: defType is not only used to pick the parser, but, if non-null it is
+ * also to record the parser being tested for coverage sanity checking
*
* @see QueryUtils#check
* @see QueryUtils#checkEqual
@@ -730,7 +755,8 @@ public class QueryEqualityTest extends S
protected void assertQueryEquals(final String defType,
final SolrQueryRequest req,
final String... inputs) throws Exception {
- qParsersTested.add(defType);
+
+ if (null != defType) qParsersTested.add(defType);
final Query[] queries = new Query[inputs.length];
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/QueryParsingTest.java Thu May 30 07:53:18 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/security/solr/core/src/test/org/apache/solr/search/TestDocSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestDocSet.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestDocSet.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestDocSet.java Thu May 30 07:53:18 2013
@@ -364,11 +364,6 @@ public class TestDocSet extends LuceneTe
}
@Override
- public boolean hasDeletions() {
- return false;
- }
-
- @Override
public FieldInfos getFieldInfos() {
return new FieldInfos(new FieldInfo[0]);
}
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java Thu May 30 07:53:18 2013
@@ -847,6 +847,15 @@ public class TestExtendedDismaxParser ex
"defType", "edismax")
, "*[count(//doc)=1]");
+ assertQ(
+ "Might be double-escaping a client-escaped colon",
+ req("q", "text_sw:(theos OR thistokenhasa\\:preescapedcolon OR theou)", "defType", "edismax", "qf", "id"),
+ "*[count(//doc)=3]");
+ assertQ(
+ "Might be double-escaping a client-escaped colon",
+ req("q", "text_sw:(theos OR thistokenhasa\\:preescapedcolon OR theou)", "defType", "edismax", "qf", "text"),
+ "*[count(//doc)=3]");
+
}
/**
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java Thu May 30 07:53:18 2013
@@ -18,6 +18,7 @@
package org.apache.solr.search;
import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.schema.SchemaField;
import org.apache.commons.lang.StringUtils;
@@ -66,6 +67,20 @@ public class TestPseudoReturnFields exte
// a multi valued field (the field value is copied first, then
// if the type lookup is done again later, we get the wrong thing). SOLR-4036
+ // score as psuedo field - precondition checks
+ for (String name : new String[] {"score", "val_ss"}) {
+ 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+
+ "', schema was changed out from under us!", sf.multiValued());
+ }
+
+ // score as psuedo field
+ assertJQ(req("q","*:*", "fq", "id:42", "fl","id,score")
+ ,"/response/docs==[{'id':'42','score':1.0}]");
+
+ // single value int using alias that matches multivalued dynamic field
assertJQ(req("q","id:42", "fl","val_ss:val_i, val2_ss:10")
,"/response/docs==[{'val2_ss':10,'val_ss':1}]"
);
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestQueryTypes.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestQueryTypes.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestQueryTypes.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestQueryTypes.java Thu May 30 07:53:18 2013
@@ -56,6 +56,7 @@ public class TestQueryTypes extends Abst
assertU(adoc("id","7", "v_f","1.5"));
assertU(adoc("id","8", "v_ti","5"));
assertU(adoc("id","9", "v_s","internal\"quote"));
+ assertU(adoc("id","10","text_no_analyzer","should just work"));
Object[] arr = new Object[] {
"id",999.0
@@ -423,6 +424,8 @@ public class TestQueryTypes extends Abst
req("q","_query_:\"{!query defType=query v=$q1}\"", "q1","{!v=$q2}","q2","{!prefix f=v_t v=$qqq}","qqq","hel")
,"//result[@numFound='2']"
);
+ assertQ("Test text field with no analysis doesn't NPE with wildcards (SOLR-4318)",
+ req("q", "text_no_analyzer:should*"), "//result[@numFound='1']");
}
}
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java Thu May 30 07:53:18 2013
@@ -18,7 +18,7 @@ package org.apache.solr.search;
import org.apache.lucene.util.LuceneTestCase.Slow;
-import org.apache.noggit.ObjectBuilder;
+import org.noggit.ObjectBuilder;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.request.SolrQueryRequest;
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestRecovery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestRecovery.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestRecovery.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestRecovery.java Thu May 30 07:53:18 2013
@@ -17,7 +17,7 @@
package org.apache.solr.search;
-import org.apache.noggit.ObjectBuilder;
+import org.noggit.ObjectBuilder;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.update.DirectUpdateHandler2;
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java Thu May 30 07:53:18 2013
@@ -104,7 +104,61 @@ public class TestSolrQueryParser extends
);
assertJQ(req("q","doesnotexist_s:( * * * )")
,"/response/numFound==0" // nothing should be found
+ );
+
+ // length of date math caused issues...
+ assertJQ(req("q","foo_dt:\"2013-03-08T00:46:15Z/DAY+000MILLISECONDS+00SECONDS+00MINUTES+00HOURS+0000000000YEARS+6MONTHS+3DAYS\"", "debug","query")
+ ,"/debug/parsedquery=='foo_dt:2013-09-11T00:00:00Z'"
);
}
+ @Test
+ public void testNestedQueryModifiers() throws Exception {
+ // One previous error was that for nested queries, outer parameters overrode nested parameters.
+ // For example _query_:"\"a b\"~2" was parsed as "a b"
+
+ String subqq="_query_:\"{!v=$qq}\"";
+
+ assertJQ(req("q","_query_:\"\\\"how brown\\\"~2\""
+ , "debug","query"
+ )
+ ,"/response/docs/[0]/id=='1'"
+ );
+
+ assertJQ(req("q",subqq, "qq","\"how brown\"~2"
+ , "debug","query"
+ )
+ ,"/response/docs/[0]/id=='1'"
+ );
+
+ // Should explicit slop override? It currently does not, but that could be considered a bug.
+ assertJQ(req("q",subqq+"~1", "qq","\"how brown\"~2"
+ , "debug","query"
+ )
+ ,"/response/docs/[0]/id=='1'"
+ );
+
+ // Should explicit slop override? It currently does not, but that could be considered a bug.
+ assertJQ(req("q"," {!v=$qq}~1", "qq","\"how brown\"~2"
+ , "debug","query"
+ )
+ ,"/response/docs/[0]/id=='1'"
+ );
+
+ // boost should multiply
+ assertJQ(req("fq","id:1", "fl","id,score", "q", subqq+"^3", "qq","text:x^2"
+ , "debug","query"
+ )
+ ,"/debug/parsedquery=='text:x^6.0'"
+ );
+
+ // boost should multiply
+ assertJQ(req("fq","id:1", "fl","id,score", "q", " {!v=$qq}^3", "qq","text:x^2"
+ , "debug","query"
+ )
+ ,"/debug/parsedquery=='text:x^6.0'"
+ );
+
+ }
+
}
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java Thu May 30 07:53:18 2013
@@ -18,7 +18,7 @@ package org.apache.solr.search;
import org.apache.lucene.util.Constants;
-import org.apache.noggit.ObjectBuilder;
+import org.noggit.ObjectBuilder;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.update.UpdateHandler;
import org.apache.solr.update.UpdateLog;
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestStressReorder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestStressReorder.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestStressReorder.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestStressReorder.java Thu May 30 07:53:18 2013
@@ -17,7 +17,7 @@
package org.apache.solr.search;
-import org.apache.noggit.ObjectBuilder;
+import org.noggit.ObjectBuilder;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.util.TestHarness;
import org.junit.BeforeClass;
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestStressVersions.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestStressVersions.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestStressVersions.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/search/TestStressVersions.java Thu May 30 07:53:18 2013
@@ -17,7 +17,7 @@
package org.apache.solr.search;
-import org.apache.noggit.ObjectBuilder;
+import org.noggit.ObjectBuilder;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.util.TestHarness;
import org.junit.BeforeClass;
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/servlet/SolrRequestParserTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/servlet/SolrRequestParserTest.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/servlet/SolrRequestParserTest.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/servlet/SolrRequestParserTest.java Thu May 30 07:53:18 2013
@@ -30,6 +30,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Vector;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
@@ -314,4 +315,32 @@ public class SolrRequestParserTest exten
assertEquals(500, solre.code());
}
}
+
+ @Test
+ public void testAddHttpRequestToContext() throws Exception {
+ HttpServletRequest request = createMock(HttpServletRequest.class);
+ expect(request.getMethod()).andReturn("GET").anyTimes();
+ expect(request.getContentType()).andReturn( "application/x-www-form-urlencoded" ).anyTimes();
+ expect(request.getQueryString()).andReturn("q=title:solr").anyTimes();
+ Map<String, String> headers = new HashMap<String,String>();
+ headers.put("X-Forwarded-For", "10.0.0.1");
+ expect(request.getHeaderNames()).andReturn(new Vector<String>(headers.keySet()).elements()).anyTimes();
+ for(Map.Entry<String,String> entry:headers.entrySet()) {
+ Vector<String> v = new Vector<String>();
+ v.add(entry.getValue());
+ expect(request.getHeaders(entry.getKey())).andReturn(v.elements()).anyTimes();
+ }
+ replay(request);
+
+ SolrRequestParsers parsers = new SolrRequestParsers(h.getCore().getSolrConfig());
+ assertFalse(parsers.isAddRequestHeadersToContext());
+ SolrQueryRequest solrReq = parsers.parse(h.getCore(), "/select", request);
+ assertFalse(solrReq.getContext().containsKey("httpRequest"));
+
+ parsers.setAddRequestHeadersToContext(true);
+ solrReq = parsers.parse(h.getCore(), "/select", request);
+ assertEquals(request, solrReq.getContext().get("httpRequest"));
+ assertEquals("10.0.0.1", ((HttpServletRequest)solrReq.getContext().get("httpRequest")).getHeaders("X-Forwarded-For").nextElement());
+
+ }
}
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java Thu May 30 07:53:18 2013
@@ -42,21 +42,24 @@ import org.junit.Test;
public class SpellCheckCollatorTest extends SolrTestCaseJ4 {
@BeforeClass
public static void beforeClass() throws Exception {
- initCore("solrconfig-spellcheckcomponent.xml", "schema.xml");
- assertNull(h.validateUpdate(adoc("id", "0", "lowerfilt", "faith hope and love")));
+ 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")));
+ 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")));
+ 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()));
}
@@ -430,4 +433,71 @@ public class SpellCheckCollatorTest exte
);
}
}
+ @Test
+ 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"
+ );
+ }
+
}
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/spelling/TestSuggestSpellingConverter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/spelling/TestSuggestSpellingConverter.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/spelling/TestSuggestSpellingConverter.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/spelling/TestSuggestSpellingConverter.java Thu May 30 07:53:18 2013
@@ -53,7 +53,7 @@ public class TestSuggestSpellingConverte
TokenStream filter = new PatternReplaceFilter(tokenizer,
Pattern.compile("([^\\p{L}\\p{M}\\p{N}\\p{Cs}]*[\\p{L}\\p{M}\\p{N}\\p{Cs}\\_]+:)|([^\\p{L}\\p{M}\\p{N}\\p{Cs}])+"), " ", true);
filter = new LowerCaseFilter(TEST_VERSION_CURRENT, filter);
- filter = new TrimFilter(filter, false);
+ filter = new TrimFilter(TEST_VERSION_CURRENT, filter);
return new TokenStreamComponents(tokenizer, filter);
}
});
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerTest.java Thu May 30 07:53:18 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/security/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java Thu May 30 07:53:18 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/security/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java Thu May 30 07:53:18 2013
@@ -133,7 +133,7 @@ public class SoftAutoCommitTest extends
// however slow the machine was to do the soft commit compared to expected,
// assume newSearcher had some magnitude of that much overhead as well
- long slowTestFudge = Math.max(200, 12 * (soft529 - add529 - softCommitWaitMillis));
+ long slowTestFudge = Math.max(300, 12 * (soft529 - add529 - softCommitWaitMillis));
assertTrue("searcher529 wasn't soon enough after soft529: " +
searcher529 + " !< " + soft529 + " + " + slowTestFudge + " (fudge)",
searcher529 < soft529 + slowTestFudge );
@@ -261,7 +261,7 @@ public class SoftAutoCommitTest extends
// however slow the machine was to do the soft commit compared to expected,
// assume newSearcher had some magnitude of that much overhead as well
- long slowTestFudge = Math.max(100, 3 * (soft529 - del529 - softCommitWaitMillis));
+ long slowTestFudge = Math.max(150, 3 * (soft529 - del529 - softCommitWaitMillis));
assertTrue("searcher529 wasn't soon enough after soft529: " +
searcher529 + " !< " + soft529 + " + " + slowTestFudge + " (fudge)",
searcher529 < soft529 + slowTestFudge );
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java Thu May 30 07:53:18 2013
@@ -19,9 +19,12 @@ package org.apache.solr.update;
import java.io.File;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.SimpleMergedSegmentWarmer;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.core.SolrConfig;
import org.apache.solr.schema.IndexSchema;
+import org.apache.solr.schema.IndexSchemaFactory;
import org.junit.Test;
/**
@@ -34,7 +37,7 @@ public class SolrIndexConfigTest extends
try {
SolrConfig solrConfig = new SolrConfig("bad-mp-solrconfig.xml");
SolrIndexConfig solrIndexConfig = new SolrIndexConfig(solrConfig, null, null);
- IndexSchema indexSchema = new IndexSchema(solrConfig, "schema.xml", null);
+ IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema("schema.xml", solrConfig);
solrIndexConfig.toIndexWriterConfig(indexSchema);
fail("a mergePolicy should have an empty constructor in order to be instantiated in Solr thus this should fail ");
} catch (Exception e) {
@@ -51,8 +54,21 @@ public class SolrIndexConfigTest extends
assertNotNull(solrIndexConfig);
assertEquals("org.apache.lucene.index.TieredMergePolicy",
solrIndexConfig.defaultMergePolicyClassName);
- IndexSchema indexSchema = new IndexSchema(solrConfig, "schema.xml", null);
+ IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema("schema.xml", solrConfig);
solrIndexConfig.toIndexWriterConfig(indexSchema);
}
+
+ public void testMergedSegmentWarmerIndexConfigCreation() throws Exception {
+ SolrConfig solrConfig = new SolrConfig("solr" + File.separator
+ + "collection1", "solrconfig-warmer.xml", null);
+ SolrIndexConfig solrIndexConfig = new SolrIndexConfig(solrConfig, null, null);
+ assertNotNull(solrIndexConfig);
+ assertNotNull(solrIndexConfig.mergedSegmentWarmerInfo);
+ assertEquals(SimpleMergedSegmentWarmer.class.getName(),
+ solrIndexConfig.mergedSegmentWarmerInfo.className);
+ IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema("schema.xml", solrConfig);
+ IndexWriterConfig iwc = solrIndexConfig.toIndexWriterConfig(indexSchema);
+ assertEquals(SimpleMergedSegmentWarmer.class, iwc.getMergedSegmentWarmer().getClass());
+ }
}
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java Thu May 30 07:53:18 2013
@@ -41,7 +41,7 @@ import java.io.UnsupportedEncodingExcept
import java.util.List;
public class SolrIndexSplitterTest extends SolrTestCaseJ4 {
- File indexDir1 = null, indexDir2 = null;
+ File indexDir1 = null, indexDir2 = null, indexDir3 = null;
@BeforeClass
public static void beforeClass() throws Exception {
@@ -58,6 +58,8 @@ public class SolrIndexSplitterTest exten
+ "_testSplit1");
indexDir2 = new File(TEMP_DIR, this.getClass().getName()
+ "_testSplit2");
+ indexDir3 = new File(TEMP_DIR, this.getClass().getName()
+ + "_testSplit3");
if (indexDir1.exists()) {
FileUtils.deleteDirectory(indexDir1);
@@ -68,6 +70,11 @@ public class SolrIndexSplitterTest exten
FileUtils.deleteDirectory(indexDir2);
}
assertTrue("Failed to mkdirs indexDir2 for split index", indexDir2.mkdirs());
+
+ if (indexDir3.exists()) {
+ FileUtils.deleteDirectory(indexDir3);
+ }
+ assertTrue("Failed to mkdirs indexDir3 for split index", indexDir3.mkdirs());
}
@Test
@@ -88,7 +95,7 @@ public class SolrIndexSplitterTest exten
request = lrf.makeRequest("q", "dummy");
SplitIndexCommand command = new SplitIndexCommand(request,
- Lists.newArrayList(indexDir1.getAbsolutePath(), indexDir2.getAbsolutePath()), null, ranges);
+ Lists.newArrayList(indexDir1.getAbsolutePath(), indexDir2.getAbsolutePath()), null, ranges, new PlainIdRouter());
new SolrIndexSplitter(command).split();
Directory directory = h.getCore().getDirectoryFactory().get(indexDir1.getAbsolutePath(),
@@ -141,7 +148,7 @@ public class SolrIndexSplitterTest exten
try {
request = lrf.makeRequest("q", "dummy");
- SplitIndexCommand command = new SplitIndexCommand(request, null, Lists.newArrayList(core1, core2), ranges);
+ SplitIndexCommand command = new SplitIndexCommand(request, null, Lists.newArrayList(core1, core2), ranges, new PlainIdRouter());
new SolrIndexSplitter(command).split();
} finally {
if (request != null) request.close();
@@ -162,6 +169,53 @@ public class SolrIndexSplitterTest exten
}
}
+ @Test
+ public void testSplitAlternately() throws Exception {
+ LocalSolrQueryRequest request = null;
+ Directory directory = null;
+ try {
+ // add an even number of docs
+ int max = (1 + random().nextInt(10)) * 3;
+ log.info("Adding {} number of documents", max);
+ for (int i = 0; i < max; i++) {
+ assertU(adoc("id", String.valueOf(i)));
+ }
+ assertU(commit());
+
+ request = lrf.makeRequest("q", "dummy");
+
+ SplitIndexCommand command = new SplitIndexCommand(request,
+ Lists.newArrayList(indexDir1.getAbsolutePath(), indexDir2.getAbsolutePath(), indexDir3.getAbsolutePath()), null, null, new PlainIdRouter());
+ new SolrIndexSplitter(command).split();
+
+ directory = h.getCore().getDirectoryFactory().get(indexDir1.getAbsolutePath(),
+ DirectoryFactory.DirContext.DEFAULT, h.getCore().getSolrConfig().indexConfig.lockType);
+ DirectoryReader reader = DirectoryReader.open(directory);
+ assertEquals("split index1 has wrong number of documents", max / 3, 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("split index2 has wrong number of documents", max / 3, reader.numDocs());
+ reader.close();
+ h.getCore().getDirectoryFactory().release(directory);
+ directory = h.getCore().getDirectoryFactory().get(indexDir3.getAbsolutePath(),
+ DirectoryFactory.DirContext.DEFAULT, h.getCore().getSolrConfig().indexConfig.lockType);
+ reader = DirectoryReader.open(directory);
+ assertEquals("split index3 has wrong number of documents", max / 3, reader.numDocs());
+ reader.close();
+ h.getCore().getDirectoryFactory().release(directory);
+ directory = null;
+ } finally {
+ if (request != null) request.close(); // decrefs the searcher
+ if (directory != null) {
+ // perhaps an assert failed, release the directory
+ h.getCore().getDirectoryFactory().release(directory);
+ }
+ }
+ }
+
private List<DocRouter.Range> getRanges(String id1, String id2) throws UnsupportedEncodingException {
// find minHash/maxHash hash ranges
byte[] bytes = id1.getBytes("UTF-8");
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/TestIndexingPerformance.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/TestIndexingPerformance.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/TestIndexingPerformance.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/TestIndexingPerformance.java Thu May 30 07:53:18 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/security/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java Thu May 30 07:53:18 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/security/solr/core/src/test/org/apache/solr/update/processor/RegexBoostProcessorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/RegexBoostProcessorTest.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/RegexBoostProcessorTest.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/RegexBoostProcessorTest.java Thu May 30 07:53:18 2013
@@ -24,6 +24,7 @@ import org.apache.solr.request.SolrQuery
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.servlet.SolrRequestParsers;
import org.apache.solr.update.AddUpdateCommand;
+import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -50,6 +51,15 @@ public class RegexBoostProcessorTest ext
factory.init(parameters.toNamedList());
reProcessor = (RegexpBoostProcessor) factory.getInstance(req, resp, null);
}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ // null static members for gc
+ reProcessor = null;
+ _parser = null;
+ parameters = null;
+ factory = null;
+ }
@Before
public void setUp() throws Exception {
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/ScriptEngineTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/ScriptEngineTest.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/ScriptEngineTest.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/ScriptEngineTest.java Thu May 30 07:53:18 2013
@@ -69,7 +69,7 @@ public class ScriptEngineTest extends Lu
ScriptEngine engine = manager.getEngineByName("JavaScript");
assertNotNull(engine);
engine.eval("function add(a,b) { return a + b }");
- Double result = (Double) ((Invocable)engine).invokeFunction("add", 1, 2);
+ Number result = (Number) ((Invocable)engine).invokeFunction("add", 1, 2);
assertNotNull(result);
assertEquals(3, result.intValue());
}
@@ -79,7 +79,7 @@ public class ScriptEngineTest extends Lu
assertNotNull(engine);
StringReader reader = new StringReader("function add(a,b) { return a + b }");
engine.eval(reader);
- Double result = (Double) ((Invocable)engine).invokeFunction("add", 1, 2);
+ Number result = (Number) ((Invocable)engine).invokeFunction("add", 1, 2);
assertNotNull(result);
assertEquals(3, result.intValue());
}
@@ -90,7 +90,7 @@ public class ScriptEngineTest extends Lu
engine.put("b", 2);
assertNotNull(engine);
engine.eval("function add() { return a + b }");
- Double result = (Double) ((Invocable)engine).invokeFunction("add", 1, 2);
+ Number result = (Number) ((Invocable)engine).invokeFunction("add", 1, 2);
assertNotNull(result);
assertEquals(3, result.intValue());
}
@@ -103,7 +103,7 @@ public class ScriptEngineTest extends Lu
assertNotNull(engine);
engine.eval("def add(a,b); a + b; end");
- Long result = (Long) ((Invocable)engine).invokeFunction("add", 1, 2);
+ Number result = (Number) ((Invocable)engine).invokeFunction("add", 1, 2);
assertNotNull(result);
assertEquals(3, result.intValue());
}
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java Thu May 30 07:53:18 2013
@@ -81,7 +81,6 @@ public class StatelessScriptUpdateProces
factory.setScriptEngineCustomizer(new ScriptEngineCustomizer() {
@Override
public void customize(ScriptEngine engine) {
- engine.put("testCase", StatelessScriptUpdateProcessorFactoryTest.this);
engine.put("functionMessages", functionMessages);
}
});
@@ -127,7 +126,6 @@ public class StatelessScriptUpdateProces
ScriptEngineCustomizer customizer = new ScriptEngineCustomizer() {
@Override
public void customize(ScriptEngine engine) {
- engine.put("testCase", StatelessScriptUpdateProcessorFactoryTest.this);
engine.put("functionMessages", functionMessages);
}
};
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/TestPartialUpdateDeduplication.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/TestPartialUpdateDeduplication.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/TestPartialUpdateDeduplication.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/update/processor/TestPartialUpdateDeduplication.java Thu May 30 07:53:18 2013
@@ -18,7 +18,7 @@ package org.apache.solr.update.processor
*/
import com.google.common.collect.Maps;
-import org.apache.noggit.ObjectBuilder;
+import org.noggit.ObjectBuilder;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.common.SolrInputDocument;
Modified: lucene/dev/branches/security/solr/core/src/test/org/apache/solr/util/SolrPluginUtilsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/core/src/test/org/apache/solr/util/SolrPluginUtilsTest.java?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/core/src/test/org/apache/solr/util/SolrPluginUtilsTest.java (original)
+++ lucene/dev/branches/security/solr/core/src/test/org/apache/solr/util/SolrPluginUtilsTest.java Thu May 30 07:53:18 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/security/solr/example/README.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/README.txt?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/README.txt (original)
+++ lucene/dev/branches/security/solr/example/README.txt Thu May 30 07:53:18 2013
@@ -70,13 +70,9 @@ solrconfig.xml.
* Logging *
-By default, Jetty & Solr will log to the console. This can be convenient when
-first getting started, but eventually you will want to log to a file. To
-configure logging, you can just pass a system property to Jetty on startup:
-
- java -Djava.util.logging.config.file=etc/logging.properties -jar start.jar
+By default, Jetty & Solr will log to the console a logs/solr.log. This can be convenient when
+first getting started, but eventually you will want to log just to a file. To
+configure logging, edit the log4j.properties file in "resources".
-This will use Java Util Logging to log to a file based on the config in
-etc/logging.properties. Logs will be written in the logs directory. It is
-also possible to setup log4j or other popular logging frameworks.
+It is also possible to setup log4j or other popular logging frameworks.
Modified: lucene/dev/branches/security/solr/example/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/build.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/build.xml (original)
+++ lucene/dev/branches/security/solr/example/build.xml Thu May 30 07:53:18 2013
@@ -52,6 +52,8 @@
<sequential>
<!-- jetty libs in lib/ -->
<ivy:retrieve conf="jetty" type="jar" log="download-only"/>
+ <ivy:retrieve conf="logging" type="jar,bundle" log="download-only"
+ pattern="lib/ext/[artifact]-[revision].[ext]"/>
<!-- start.jar -->
<ivy:retrieve conf="start" type="jar" log="download-only"
pattern="start.jar"/>
Modified: lucene/dev/branches/security/solr/example/cloud-scripts/zkcli.bat
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/cloud-scripts/zkcli.bat?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/cloud-scripts/zkcli.bat (original)
+++ lucene/dev/branches/security/solr/example/cloud-scripts/zkcli.bat Thu May 30 07:53:18 2013
@@ -8,5 +8,4 @@ REM Find location of this script
set SDIR=%~dp0
if "%SDIR:~-1%"=="\" set SDIR=%SDIR:~0,-1%
-
-"%JVM%" -classpath "%SDIR%\..\solr-webapp\webapp\WEB-INF\lib\*" org.apache.solr.cloud.ZkCLI %*
+"%JVM%" -Dlog4j.configuration=file:%SDIR%\log4j.properties -classpath "%SDIR%\..\solr-webapp\webapp\WEB-INF\lib\*;%SDIR%\..\lib\ext\*" org.apache.solr.cloud.ZkCLI %*
Modified: lucene/dev/branches/security/solr/example/cloud-scripts/zkcli.sh
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/cloud-scripts/zkcli.sh?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/cloud-scripts/zkcli.sh (original)
+++ lucene/dev/branches/security/solr/example/cloud-scripts/zkcli.sh Thu May 30 07:53:18 2013
@@ -9,6 +9,5 @@ JVM="java"
sdir="`dirname \"$0\"`"
-
-$JVM -classpath "$sdir/../solr-webapp/webapp/WEB-INF/lib/*" org.apache.solr.cloud.ZkCLI ${1+"$@"}
+PATH=$JAVA_HOME/bin:$PATH $JVM -Dlog4j.configuration=file:$sdir/log4j.properties -classpath "$sdir/../solr-webapp/webapp/WEB-INF/lib/*:$sdir/../lib/ext/*" org.apache.solr.cloud.ZkCLI ${1+"$@"}
Modified: lucene/dev/branches/security/solr/example/etc/jetty.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/etc/jetty.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/etc/jetty.xml (original)
+++ lucene/dev/branches/security/solr/example/etc/jetty.xml Thu May 30 07:53:18 2013
@@ -51,6 +51,7 @@
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.bio.SocketConnector">
+ <Call class="java.lang.System" name="setProperty"> <Arg>log4j.configuration</Arg> <Arg>etc/log4j.properties</Arg> </Call>
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
<Set name="maxIdleTime">50000</Set>
Modified: lucene/dev/branches/security/solr/example/example-DIH/solr/db/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/example-DIH/solr/db/conf/schema.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/example-DIH/solr/db/conf/schema.xml (original)
+++ lucene/dev/branches/security/solr/example/example-DIH/solr/db/conf/schema.xml Thu May 30 07:53:18 2013
@@ -224,7 +224,7 @@
See the Java Regular Expression documentation for more
infomation on pattern and replacement string syntax.
- http://java.sun.com/j2se/1.6.0/docs/api/java/util/regex/package-summary.html
+ http://docs.oracle.com/javase/7/docs/api/java/util/regex/package-summary.html
-->
<filter class="solr.PatternReplaceFilterFactory"
pattern="([^a-z])" replacement="" replace="all"
@@ -246,9 +246,6 @@
type: mandatory - the name of a previously defined type from the <types> section
indexed: true if this field should be indexed (searchable or sortable)
stored: true if this field should be retrievable
- compressed: [false] if this field should be stored using gzip compression
- (this will only apply if the field type is compressable; among
- the standard field types, only TextField and StrField are)
multiValued: true if this field may contain multiple values per document
omitNorms: (expert) set to true to omit the norms associated with
this field (this disables length normalization and index-time
Modified: lucene/dev/branches/security/solr/example/example-DIH/solr/db/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/example-DIH/solr/db/conf/solrconfig.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/example-DIH/solr/db/conf/solrconfig.xml (original)
+++ lucene/dev/branches/security/solr/example/example-DIH/solr/db/conf/solrconfig.xml Thu May 30 07:53:18 2013
@@ -30,6 +30,28 @@
<lib dir="../../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
+ <!-- To enable dynamic schema REST APIs, use the following for <schemaFactory>:
+
+ <schemaFactory class="ManagedIndexSchemaFactory">
+ <bool name="mutable">true</bool>
+ <str name="managedSchemaResourceName">managed-schema</str>
+ </schemaFactory>
+
+ When ManagedIndexSchemaFactory is specified, Solr will load the schema from
+ he resource named in 'managedSchemaResourceName', rather than from schema.xml.
+ Note that the managed schema resource CANNOT be named schema.xml. If the managed
+ schema does not exist, Solr will create it after reading schema.xml, then rename
+ 'schema.xml' to 'schema.xml.bak'.
+
+ Do NOT hand edit the managed schema - external modifications will be ignored and
+ overwritten as a result of schema modification REST API calls.
+
+ When ManagedIndexSchemaFactory is specified with mutable = true, schema
+ modification REST API calls will be allowed; otherwise, error responses will be
+ sent back for these requests.
+ -->
+ <schemaFactory class="ClassicIndexSchemaFactory"/>
+
<!-- <indexConfig> section could go here, but we want the defaults -->
<!-- the default high-performance update handler -->
Modified: lucene/dev/branches/security/solr/example/example-DIH/solr/mail/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/example-DIH/solr/mail/conf/schema.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/example-DIH/solr/mail/conf/schema.xml (original)
+++ lucene/dev/branches/security/solr/example/example-DIH/solr/mail/conf/schema.xml Thu May 30 07:53:18 2013
@@ -202,13 +202,10 @@
<filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
-->
<!-- Case insensitive stop word removal.
- add enablePositionIncrements=true in both the index and query
- analyzers to leave a 'gap' for more accurate phrase queries.
-->
<filter class="solr.StopFilterFactory"
ignoreCase="true"
words="stopwords.txt"
- enablePositionIncrements="true"
/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
@@ -222,7 +219,6 @@
<filter class="solr.StopFilterFactory"
ignoreCase="true"
words="stopwords.txt"
- enablePositionIncrements="true"
/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
@@ -294,7 +290,7 @@
See the Java Regular Expression documentation for more
infomation on pattern and replacement string syntax.
- http://java.sun.com/j2se/1.6.0/docs/api/java/util/regex/package-summary.html
+ http://docs.oracle.com/javase/7/docs/api/java/util/regex/package-summary.html
-->
<filter class="solr.PatternReplaceFilterFactory"
pattern="([^a-z])" replacement="" replace="all"
@@ -324,9 +320,6 @@
type: mandatory - the name of a previously defined type from the <types> section
indexed: true if this field should be indexed (searchable or sortable)
stored: true if this field should be retrievable
- compressed: [false] if this field should be stored using gzip compression
- (this will only apply if the field type is compressable; among
- the standard field types, only TextField and StrField are)
multiValued: true if this field may contain multiple values per document
omitNorms: (expert) set to true to omit the norms associated with
this field (this disables length normalization and index-time
Modified: lucene/dev/branches/security/solr/example/example-DIH/solr/mail/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/example-DIH/solr/mail/conf/solrconfig.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/example-DIH/solr/mail/conf/solrconfig.xml (original)
+++ lucene/dev/branches/security/solr/example/example-DIH/solr/mail/conf/solrconfig.xml Thu May 30 07:53:18 2013
@@ -52,6 +52,28 @@
-->
<jmx />
+ <!-- To enable dynamic schema REST APIs, use the following for <schemaFactory>:
+
+ <schemaFactory class="ManagedIndexSchemaFactory">
+ <bool name="mutable">true</bool>
+ <str name="managedSchemaResourceName">managed-schema</str>
+ </schemaFactory>
+
+ When ManagedIndexSchemaFactory is specified, Solr will load the schema from
+ he resource named in 'managedSchemaResourceName', rather than from schema.xml.
+ Note that the managed schema resource CANNOT be named schema.xml. If the managed
+ schema does not exist, Solr will create it after reading schema.xml, then rename
+ 'schema.xml' to 'schema.xml.bak'.
+
+ Do NOT hand edit the managed schema - external modifications will be ignored and
+ overwritten as a result of schema modification REST API calls.
+
+ When ManagedIndexSchemaFactory is specified with mutable = true, schema
+ modification REST API calls will be allowed; otherwise, error responses will be
+ sent back for these requests.
+ -->
+ <schemaFactory class="ClassicIndexSchemaFactory"/>
+
<!-- the default high-performance update handler -->
<updateHandler class="solr.DirectUpdateHandler2">
Modified: lucene/dev/branches/security/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml (original)
+++ lucene/dev/branches/security/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml Thu May 30 07:53:18 2013
@@ -5,22 +5,22 @@
pk="link"
url="http://rss.slashdot.org/Slashdot/slashdot"
processor="XPathEntityProcessor"
- forEach="/rss/channel | /rss/item"
+ forEach="/rss/channel/item"
transformer="DateFormatTransformer">
<field column="source" xpath="/rss/channel/title" commonField="true" />
<field column="source-link" xpath="/rss/channel/link" commonField="true" />
<field column="subject" xpath="/rss/channel/subject" commonField="true" />
- <field column="title" xpath="/rss/item/title" />
- <field column="link" xpath="/rss/item/link" />
- <field column="description" xpath="/rss/item/description" />
- <field column="creator" xpath="/rss/item/creator" />
- <field column="item-subject" xpath="/rss/item/subject" />
- <field column="date" xpath="/rss/item/date" dateTimeFormat="yyyy-MM-dd'T'HH:mm:ss" />
- <field column="slash-department" xpath="/rss/item/department" />
- <field column="slash-section" xpath="/rss/item/section" />
- <field column="slash-comments" xpath="/rss/item/comments" />
+ <field column="title" xpath="/rss/channel/item/title" />
+ <field column="link" xpath="/rss/channel/item/link" />
+ <field column="description" xpath="/rss/channel/item/description" />
+ <field column="creator" xpath="/rss/channel/item/creator" />
+ <field column="item-subject" xpath="/rss/channel/item/subject" />
+ <field column="date" xpath="/rss/channel/item/date" dateTimeFormat="yyyy-MM-dd'T'HH:mm:ss" />
+ <field column="slash-department" xpath="/rss/channel/item/department" />
+ <field column="slash-section" xpath="/rss/channel/item/section" />
+ <field column="slash-comments" xpath="/rss/channel/item/comments" />
</entity>
</document>
</dataConfig>
Modified: lucene/dev/branches/security/solr/example/example-DIH/solr/rss/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/example-DIH/solr/rss/conf/schema.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/example-DIH/solr/rss/conf/schema.xml (original)
+++ lucene/dev/branches/security/solr/example/example-DIH/solr/rss/conf/schema.xml Thu May 30 07:53:18 2013
@@ -224,7 +224,7 @@
See the Java Regular Expression documentation for more
infomation on pattern and replacement string syntax.
- http://java.sun.com/j2se/1.6.0/docs/api/java/util/regex/package-summary.html
+ http://docs.oracle.com/javase/7/docs/api/java/util/regex/package-summary.html
-->
<filter class="solr.PatternReplaceFilterFactory"
pattern="([^a-z])" replacement="" replace="all"
@@ -273,9 +273,6 @@
type: mandatory - the name of a previously defined type from the <types> section
indexed: true if this field should be indexed (searchable or sortable)
stored: true if this field should be retrievable
- compressed: [false] if this field should be stored using gzip compression
- (this will only apply if the field type is compressable; among
- the standard field types, only TextField and StrField are)
multiValued: true if this field may contain multiple values per document
omitNorms: (expert) set to true to omit the norms associated with
this field (this disables length normalization and index-time
Modified: lucene/dev/branches/security/solr/example/example-DIH/solr/rss/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/example-DIH/solr/rss/conf/solrconfig.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/example-DIH/solr/rss/conf/solrconfig.xml (original)
+++ lucene/dev/branches/security/solr/example/example-DIH/solr/rss/conf/solrconfig.xml Thu May 30 07:53:18 2013
@@ -30,6 +30,28 @@
<lib dir="../../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
+ <!-- To enable dynamic schema REST APIs, use the following for <schemaFactory>:
+
+ <schemaFactory class="ManagedIndexSchemaFactory">
+ <bool name="mutable">true</bool>
+ <str name="managedSchemaResourceName">managed-schema</str>
+ </schemaFactory>
+
+ When ManagedIndexSchemaFactory is specified, Solr will load the schema from
+ he resource named in 'managedSchemaResourceName', rather than from schema.xml.
+ Note that the managed schema resource CANNOT be named schema.xml. If the managed
+ schema does not exist, Solr will create it after reading schema.xml, then rename
+ 'schema.xml' to 'schema.xml.bak'.
+
+ Do NOT hand edit the managed schema - external modifications will be ignored and
+ overwritten as a result of schema modification REST API calls.
+
+ When ManagedIndexSchemaFactory is specified with mutable = true, schema
+ modification REST API calls will be allowed; otherwise, error responses will be
+ sent back for these requests.
+ -->
+ <schemaFactory class="ClassicIndexSchemaFactory"/>
+
<!-- <indexConfig> section could go here, but we want the defaults -->
<!-- the default high-performance update handler -->
Modified: lucene/dev/branches/security/solr/example/example-DIH/solr/solr.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/example-DIH/solr/solr.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/example-DIH/solr/solr.xml (original)
+++ lucene/dev/branches/security/solr/example/example-DIH/solr/solr.xml Thu May 30 07:53:18 2013
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<solr sharedLib="lib" persistent="true">
- <cores adminPath="/admin/cores">
+ <cores adminPath="/admin/cores" hostPort="${jetty.port:8983}" hostContext="${hostContext:solr}">
<core default="true" instanceDir="db" name="db"/>
<core default="false" instanceDir="rss" name="rss"/>
<core default="false" instanceDir="mail" name="mail"/>
Modified: lucene/dev/branches/security/solr/example/example-DIH/solr/solr/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/example-DIH/solr/solr/conf/schema.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/example-DIH/solr/solr/conf/schema.xml (original)
+++ lucene/dev/branches/security/solr/example/example-DIH/solr/solr/conf/schema.xml Thu May 30 07:53:18 2013
@@ -224,7 +224,7 @@
See the Java Regular Expression documentation for more
infomation on pattern and replacement string syntax.
- http://java.sun.com/j2se/1.6.0/docs/api/java/util/regex/package-summary.html
+ http://docs.oracle.com/javase/7/docs/api/java/util/regex/package-summary.html
-->
<filter class="solr.PatternReplaceFilterFactory"
pattern="([^a-z])" replacement="" replace="all"
@@ -246,9 +246,6 @@
type: mandatory - the name of a previously defined type from the <types> section
indexed: true if this field should be indexed (searchable or sortable)
stored: true if this field should be retrievable
- compressed: [false] if this field should be stored using gzip compression
- (this will only apply if the field type is compressable; among
- the standard field types, only TextField and StrField are)
multiValued: true if this field may contain multiple values per document
omitNorms: (expert) set to true to omit the norms associated with
this field (this disables length normalization and index-time
Modified: lucene/dev/branches/security/solr/example/example-DIH/solr/solr/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/example-DIH/solr/solr/conf/solrconfig.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/example-DIH/solr/solr/conf/solrconfig.xml (original)
+++ lucene/dev/branches/security/solr/example/example-DIH/solr/solr/conf/solrconfig.xml Thu May 30 07:53:18 2013
@@ -30,6 +30,28 @@
<lib dir="../../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
+ <!-- To enable dynamic schema REST APIs, use the following for <schemaFactory>:
+
+ <schemaFactory class="ManagedIndexSchemaFactory">
+ <bool name="mutable">true</bool>
+ <str name="managedSchemaResourceName">managed-schema</str>
+ </schemaFactory>
+
+ When ManagedIndexSchemaFactory is specified, Solr will load the schema from
+ he resource named in 'managedSchemaResourceName', rather than from schema.xml.
+ Note that the managed schema resource CANNOT be named schema.xml. If the managed
+ schema does not exist, Solr will create it after reading schema.xml, then rename
+ 'schema.xml' to 'schema.xml.bak'.
+
+ Do NOT hand edit the managed schema - external modifications will be ignored and
+ overwritten as a result of schema modification REST API calls.
+
+ When ManagedIndexSchemaFactory is specified with mutable = true, schema
+ modification REST API calls will be allowed; otherwise, error responses will be
+ sent back for these requests.
+ -->
+ <schemaFactory class="ClassicIndexSchemaFactory"/>
+
<!-- <indexConfig> section could go here, but we want the defaults -->
<!-- the default high-performance update handler -->
Modified: lucene/dev/branches/security/solr/example/example-DIH/solr/tika/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/example-DIH/solr/tika/conf/solrconfig.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/example-DIH/solr/tika/conf/solrconfig.xml (original)
+++ lucene/dev/branches/security/solr/example/example-DIH/solr/tika/conf/solrconfig.xml Thu May 30 07:53:18 2013
@@ -36,6 +36,28 @@
<lib dir="../../../../contrib/dataimporthandler/lib/" regex=".*jar$" />
<lib dir="../../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
+ <!-- To enable dynamic schema REST APIs, use the following for <schemaFactory>:
+
+ <schemaFactory class="ManagedIndexSchemaFactory">
+ <bool name="mutable">true</bool>
+ <str name="managedSchemaResourceName">managed-schema</str>
+ </schemaFactory>
+
+ When ManagedIndexSchemaFactory is specified, Solr will load the schema from
+ he resource named in 'managedSchemaResourceName', rather than from schema.xml.
+ Note that the managed schema resource CANNOT be named schema.xml. If the managed
+ schema does not exist, Solr will create it after reading schema.xml, then rename
+ 'schema.xml' to 'schema.xml.bak'.
+
+ Do NOT hand edit the managed schema - external modifications will be ignored and
+ overwritten as a result of schema modification REST API calls.
+
+ When ManagedIndexSchemaFactory is specified with mutable = true, schema
+ modification REST API calls will be allowed; otherwise, error responses will be
+ sent back for these requests.
+ -->
+ <schemaFactory class="ClassicIndexSchemaFactory"/>
+
<!-- <indexConfig> section could go here, but we want the defaults -->
<!-- the default high-performance update handler -->
Modified: lucene/dev/branches/security/solr/example/ivy.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/ivy.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/ivy.xml (original)
+++ lucene/dev/branches/security/solr/example/ivy.xml Thu May 30 07:53:18 2013
@@ -17,7 +17,7 @@
under the License.
-->
<!DOCTYPE ivy-module [
- <!ENTITY jetty.version "8.1.8.v20121106">
+ <!ENTITY jetty.version "8.1.10.v20130312">
]>
<ivy-module version="2.0">
<info organisation="org.apache.solr" module="example"/>
@@ -25,9 +25,16 @@
<conf name="jetty" description="jetty jars"/>
<conf name="start" description="jetty start jar"/>
<conf name="servlet" description="servlet-api jar"/>
+ <conf name="logging" description="logging setup"/>
</configurations>
<dependencies>
+
+ <dependency org="log4j" name="log4j" rev="1.2.16" transitive="false" conf="logging->default"/>
+ <dependency org="org.slf4j" name="slf4j-api" rev="1.6.6" transitive="false" conf="logging->default"/>
+ <dependency org="org.slf4j" name="jcl-over-slf4j" rev="1.6.6" transitive="false" conf="logging->default"/>
+ <dependency org="org.slf4j" name="jul-to-slf4j" rev="1.6.6" transitive="false" conf="logging->default"/>
+ <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.6.6" transitive="false" conf="logging->default"/>
<dependency org="org.eclipse.jetty" name="jetty-continuation" rev="&jetty.version;" transitive="false" conf="jetty->default"/>
<dependency org="org.eclipse.jetty" name="jetty-deploy" rev="&jetty.version;" transitive="false" conf="jetty->default"/>
<dependency org="org.eclipse.jetty" name="jetty-http" rev="&jetty.version;" transitive="false" conf="jetty->default"/>
Modified: lucene/dev/branches/security/solr/example/multicore/core0/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/multicore/core0/conf/solrconfig.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/multicore/core0/conf/solrconfig.xml (original)
+++ lucene/dev/branches/security/solr/example/multicore/core0/conf/solrconfig.xml Thu May 30 07:53:18 2013
@@ -29,6 +29,28 @@
<dataDir>${solr.core0.data.dir:}</dataDir>
+ <!-- To enable dynamic schema REST APIs, use the following for <schemaFactory>:
+
+ <schemaFactory class="ManagedIndexSchemaFactory">
+ <bool name="mutable">true</bool>
+ <str name="managedSchemaResourceName">managed-schema</str>
+ </schemaFactory>
+
+ When ManagedIndexSchemaFactory is specified, Solr will load the schema from
+ he resource named in 'managedSchemaResourceName', rather than from schema.xml.
+ Note that the managed schema resource CANNOT be named schema.xml. If the managed
+ schema does not exist, Solr will create it after reading schema.xml, then rename
+ 'schema.xml' to 'schema.xml.bak'.
+
+ Do NOT hand edit the managed schema - external modifications will be ignored and
+ overwritten as a result of schema modification REST API calls.
+
+ When ManagedIndexSchemaFactory is specified with mutable = true, schema
+ modification REST API calls will be allowed; otherwise, error responses will be
+ sent back for these requests.
+ -->
+ <schemaFactory class="ClassicIndexSchemaFactory"/>
+
<updateHandler class="solr.DirectUpdateHandler2">
<updateLog>
<str name="dir">${solr.core0.data.dir:}</str>
Modified: lucene/dev/branches/security/solr/example/multicore/core1/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/security/solr/example/multicore/core1/conf/solrconfig.xml?rev=1487777&r1=1487776&r2=1487777&view=diff
==============================================================================
--- lucene/dev/branches/security/solr/example/multicore/core1/conf/solrconfig.xml (original)
+++ lucene/dev/branches/security/solr/example/multicore/core1/conf/solrconfig.xml Thu May 30 07:53:18 2013
@@ -29,6 +29,28 @@
<dataDir>${solr.core1.data.dir:}</dataDir>
+ <!-- To enable dynamic schema REST APIs, use the following for <schemaFactory>:
+
+ <schemaFactory class="ManagedIndexSchemaFactory">
+ <bool name="mutable">true</bool>
+ <str name="managedSchemaResourceName">managed-schema</str>
+ </schemaFactory>
+
+ When ManagedIndexSchemaFactory is specified, Solr will load the schema from
+ he resource named in 'managedSchemaResourceName', rather than from schema.xml.
+ Note that the managed schema resource CANNOT be named schema.xml. If the managed
+ schema does not exist, Solr will create it after reading schema.xml, then rename
+ 'schema.xml' to 'schema.xml.bak'.
+
+ Do NOT hand edit the managed schema - external modifications will be ignored and
+ overwritten as a result of schema modification REST API calls.
+
+ When ManagedIndexSchemaFactory is specified with mutable = true, schema
+ modification REST API calls will be allowed; otherwise, error responses will be
+ sent back for these requests.
+ -->
+ <schemaFactory class="ClassicIndexSchemaFactory"/>
+
<updateHandler class="solr.DirectUpdateHandler2">
<updateLog>
<str name="dir">${solr.core1.data.dir:}</str>