You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ro...@apache.org on 2013/01/18 19:31:23 UTC
svn commit: r1435287 [37/41] - in /lucene/dev/branches/LUCENE-2878: ./
dev-tools/ dev-tools/eclipse/ dev-tools/idea/.idea/libraries/
dev-tools/idea/lucene/analysis/icu/ dev-tools/maven/
dev-tools/maven/lucene/benchmark/ dev-tools/maven/solr/ dev-tools/...
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java Fri Jan 18 18:30:54 2013
@@ -17,8 +17,21 @@
package org.apache.solr.search;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.lucene.search.BooleanClause;
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.DisjunctionMaxQuery;
+import org.apache.lucene.search.FuzzyQuery;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.TermQuery;
import org.apache.solr.common.SolrException;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.params.SolrParams;
+import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.util.AbstractSolrTestCase;
+import org.apache.solr.util.SolrPluginUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -510,37 +523,42 @@ public class TestExtendedDismaxParser ex
public void testCyclicAliasing() throws Exception {
try {
- h.query(req("defType","edismax", "q","ignore_exception", "qf","who", "f.who.qf","name","f.name.qf","who"));
- fail("Simple cyclic alising");
- } catch (SolrException e) {
- assertTrue(e.getCause().getMessage().contains("Field aliases lead to a cycle"));
- }
-
- try {
- h.query(req("defType","edismax", "q","ignore_exception", "qf","who", "f.who.qf","name","f.name.qf","myalias", "f.myalias.qf","who"));
- fail();
- } catch (SolrException e) {
- assertTrue(e.getCause().getMessage().contains("Field aliases lead to a cycle"));
- }
-
- try {
- h.query(req("defType","edismax", "q","ignore_exception", "qf","field1", "f.field1.qf","field2 field3","f.field2.qf","field4 field5", "f.field4.qf","field5", "f.field5.qf","field6", "f.field3.qf","field6"));
- } catch (SolrException e) {
- fail("This is not cyclic alising");
- }
-
- try {
- h.query(req("defType","edismax", "q","ignore_exception", "qf","field1", "f.field1.qf","field2 field3", "f.field2.qf","field4 field5", "f.field4.qf","field5", "f.field5.qf","field4"));
- fail();
- } catch (SolrException e) {
- assertTrue(e.getCause().getMessage().contains("Field aliases lead to a cycle"));
- }
-
- try {
- h.query(req("defType","edismax", "q","who:(Zapp Pig) ignore_exception", "qf","field1", "f.who.qf","name","f.name.qf","myalias", "f.myalias.qf","who"));
- fail();
- } catch (SolrException e) {
- assertTrue(e.getCause().getMessage().contains("Field aliases lead to a cycle"));
+ ignoreException(".*Field aliases lead to a cycle.*");
+ try {
+ h.query(req("defType","edismax", "q","blarg", "qf","who", "f.who.qf","name","f.name.qf","who"));
+ fail("Simple cyclic alising not detected");
+ } catch (SolrException e) {
+ assertTrue(e.getCause().getMessage().contains("Field aliases lead to a cycle"));
+ }
+
+ try {
+ h.query(req("defType","edismax", "q","blarg", "qf","who", "f.who.qf","name","f.name.qf","myalias", "f.myalias.qf","who"));
+ fail("Cyclic alising not detected");
+ } catch (SolrException e) {
+ assertTrue(e.getCause().getMessage().contains("Field aliases lead to a cycle"));
+ }
+
+ try {
+ h.query(req("defType","edismax", "q","blarg", "qf","field1", "f.field1.qf","field2 field3","f.field2.qf","field4 field5", "f.field4.qf","field5", "f.field5.qf","field6", "f.field3.qf","field6"));
+ } catch (SolrException e) {
+ fail("This is not cyclic alising");
+ }
+
+ try {
+ h.query(req("defType","edismax", "q","blarg", "qf","field1", "f.field1.qf","field2 field3", "f.field2.qf","field4 field5", "f.field4.qf","field5", "f.field5.qf","field4"));
+ fail("Cyclic alising not detected");
+ } catch (SolrException e) {
+ assertTrue(e.getCause().getMessage().contains("Field aliases lead to a cycle"));
+ }
+
+ try {
+ h.query(req("defType","edismax", "q","who:(Zapp Pig)", "qf","field1", "f.who.qf","name","f.name.qf","myalias", "f.myalias.qf","who"));
+ fail("Cyclic alising not detected");
+ } catch (SolrException e) {
+ assertTrue(e.getCause().getMessage().contains("Field aliases lead to a cycle"));
+ }
+ } finally {
+ resetExceptionIgnores();
}
}
@@ -772,7 +790,7 @@ public class TestExtendedDismaxParser ex
"defType", "edismax")
, "*[count(//doc)=1]");
- // Query string field 'cat_s' for special char / - causes ParseException without patch SOLR-3467
+ // Query string field 'cat_s' for special char / - causes SyntaxError without patch SOLR-3467
assertQ("Escaping string with reserved / character",
req("q", "foo/",
"qf", "cat_s",
@@ -930,4 +948,157 @@ public class TestExtendedDismaxParser ex
"defType", "edismax")
, "*[count(//doc)=1]");
}
+
+ public void testEdismaxSimpleExtension() throws SyntaxError {
+ ModifiableSolrParams params = new ModifiableSolrParams();
+ params.set("q", "foo bar");
+ params.set("qf", "subject title^5");
+ params.set("qf_fr", "subject_fr title_fr^5");
+ params.set("qf_en", "subject_en title_en^5");
+ params.set("qf_es", "subject_es title_es^5");
+
+ MultilanguageQueryParser parser = new MultilanguageQueryParser("foo bar", new ModifiableSolrParams(), params, req(params));
+ Query query = parser.parse();
+ assertNotNull(query);
+ assertTrue(containsClause(query, "title", "foo", 5, false));
+ assertTrue(containsClause(query, "title", "bar", 5, false));
+ assertTrue(containsClause(query, "subject", "foo", 1, false));
+ assertTrue(containsClause(query, "subject", "bar", 1, false));
+
+ params.set("language", "es");
+ parser = new MultilanguageQueryParser("foo bar", new ModifiableSolrParams(), params, req(params));
+ query = parser.parse();
+ assertNotNull(query);
+ assertTrue(containsClause(query, "title_es", "foo", 5, false));
+ assertTrue(containsClause(query, "title_es", "bar", 5, false));
+ assertTrue(containsClause(query, "subject_es", "foo", 1, false));
+ assertTrue(containsClause(query, "subject_es", "bar", 1, false));
+
+ FuzzyDismaxQParser parser2 = new FuzzyDismaxQParser("foo bar absence", new ModifiableSolrParams(), params, req(params));
+ query = parser2.parse();
+ assertNotNull(query);
+ assertTrue(containsClause(query, "title", "foo", 5, false));
+ assertTrue(containsClause(query, "title", "bar", 5, false));
+ assertTrue(containsClause(query, "title", "absence", 5, true));
+
+ }
+
+ private boolean containsClause(Query query, String field, String value,
+ int boost, boolean fuzzy) {
+
+ if(query instanceof BooleanQuery) {
+ return containsClause((BooleanQuery)query, field, value, boost, fuzzy);
+ }
+ if(query instanceof DisjunctionMaxQuery) {
+ return containsClause((DisjunctionMaxQuery)query, field, value, boost, fuzzy);
+ }
+ if(query instanceof TermQuery && !fuzzy) {
+ return containsClause((TermQuery)query, field, value, boost);
+ }
+ if(query instanceof FuzzyQuery && fuzzy) {
+ return containsClause((FuzzyQuery)query, field, value, boost);
+ }
+ return false;
+ }
+
+ private boolean containsClause(FuzzyQuery query, String field, String value,
+ int boost) {
+ if(query.getTerm().field().equals(field) &&
+ query.getTerm().bytes().utf8ToString().equals(value) &&
+ query.getBoost() == boost) {
+ return true;
+ }
+ return false;
+ }
+
+ private boolean containsClause(BooleanQuery query, String field, String value, int boost, boolean fuzzy) {
+ for(BooleanClause clause:query.getClauses()) {
+ if(containsClause(clause.getQuery(), field, value, boost, fuzzy)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean containsClause(TermQuery query, String field, String value, int boost) {
+ if(query.getTerm().field().equals(field) &&
+ query.getTerm().bytes().utf8ToString().equals(value) &&
+ query.getBoost() == boost) {
+ return true;
+ }
+ return false;
+ }
+
+ private boolean containsClause(DisjunctionMaxQuery query, String field, String value, int boost, boolean fuzzy) {
+ for(Query disjunct:query.getDisjuncts()) {
+ if(containsClause(disjunct, field, value, boost, fuzzy)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ class MultilanguageQueryParser extends ExtendedDismaxQParser {
+
+ public MultilanguageQueryParser(String qstr, SolrParams localParams,
+ SolrParams params, SolrQueryRequest req) {
+ super(qstr, localParams, params, req);
+ }
+
+ @Override
+ protected ExtendedDismaxConfiguration createConfiguration(String qstr,
+ SolrParams localParams, SolrParams params, SolrQueryRequest req) {
+ return new MultilanguageDismaxConfiguration(localParams, params, req);
+ }
+
+ class MultilanguageDismaxConfiguration extends ExtendedDismaxConfiguration {
+
+ public MultilanguageDismaxConfiguration(SolrParams localParams,
+ SolrParams params, SolrQueryRequest req) {
+ super(localParams, params, req);
+ String language = params.get("language");
+ if(language != null) {
+ super.queryFields = SolrPluginUtils.parseFieldBoosts(solrParams.getParams("qf_" + language));
+ }
+ }
+
+ }
+
+ }
+
+
+
+ class FuzzyDismaxQParser extends ExtendedDismaxQParser {
+
+ public FuzzyDismaxQParser(String qstr, SolrParams localParams,
+ SolrParams params, SolrQueryRequest req) {
+ super(qstr, localParams, params, req);
+ }
+
+ @Override
+ protected ExtendedSolrQueryParser createEdismaxQueryParser(QParser qParser,
+ String field) {
+ return new FuzzyQueryParser(qParser, field);
+ }
+
+ class FuzzyQueryParser extends ExtendedSolrQueryParser{
+
+ private Set<String> frequentlyMisspelledWords;
+
+ public FuzzyQueryParser(QParser parser, String defaultField) {
+ super(parser, defaultField);
+ frequentlyMisspelledWords = new HashSet<String>();
+ frequentlyMisspelledWords.add("absence");
+ }
+
+ @Override
+ protected Query getFieldQuery(String field,
+ String val, boolean quoted) throws SyntaxError {
+ if(frequentlyMisspelledWords.contains(val)) {
+ return getFuzzyQuery(field, val, 0.75F);
+ }
+ return super.getFieldQuery(field, val, quoted);
+ }
+ }
+ }
}
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestFastLRUCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestFastLRUCache.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestFastLRUCache.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestFastLRUCache.java Fri Jan 18 18:30:54 2013
@@ -176,6 +176,7 @@ public class TestFastLRUCache extends Lu
private CacheRegenerator createCodeRegenerator() {
CacheRegenerator cr = new CacheRegenerator() {
+ @Override
public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache,
SolrCache oldCache, Object oldKey, Object oldVal) {
newCache.put(oldKey, oldVal);
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestLFUCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestLFUCache.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestLFUCache.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestLFUCache.java Fri Jan 18 18:30:54 2013
@@ -39,6 +39,7 @@ import java.util.Map;
public class TestLFUCache extends SolrTestCaseJ4 {
private class LFURegenerator implements CacheRegenerator {
+ @Override
public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache,
SolrCache oldCache, Object oldKey, Object oldVal) throws IOException {
newCache.put(oldKey, oldVal);
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestLRUCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestLRUCache.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestLRUCache.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestLRUCache.java Fri Jan 18 18:30:54 2013
@@ -124,6 +124,7 @@ public class TestLRUCache extends Lucene
private CacheRegenerator createCodeRegenerator() {
CacheRegenerator cr = new CacheRegenerator() {
+ @Override
@SuppressWarnings("unchecked")
public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache,
SolrCache oldCache, Object oldKey, Object oldVal) {
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestRTGBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestRTGBase.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestRTGBase.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestRTGBase.java Fri Jan 18 18:30:54 2013
@@ -89,6 +89,7 @@ public class TestRTGBase extends SolrTes
this.val = val;
}
+ @Override
public String toString() {
return "{version="+version+",val="+val+"}";
}
@@ -134,7 +135,7 @@ public class TestRTGBase extends SolrTes
if (!termsEnum.seekExact(termBytes, false)) {
return -1;
}
- DocsEnum docs = termsEnum.docs(MultiFields.getLiveDocs(r), null, 0);
+ DocsEnum docs = termsEnum.docs(MultiFields.getLiveDocs(r), null, DocsEnum.FLAG_NONE);
int id = docs.nextDoc();
if (id != DocIdSetIterator.NO_MORE_DOCS) {
int next = docs.nextDoc();
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestRangeQuery.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestRangeQuery.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestRangeQuery.java Fri Jan 18 18:30:54 2013
@@ -211,6 +211,7 @@ public class TestRangeQuery extends Solr
createIndex(15, new DocProcessor() {
+ @Override
public void process(SolrInputDocument doc) {
addInt(doc, l,u, fields);
}
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java Fri Jan 18 18:30:54 2013
@@ -22,6 +22,7 @@ import com.carrotsearch.randomizedtestin
import com.spatial4j.core.context.SpatialContext;
import com.spatial4j.core.distance.DistanceUtils;
import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.SolrException;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -52,6 +53,7 @@ public class TestSolr4Spatial extends So
initCore("solrconfig-basic.xml", "schema-spatial.xml");
}
+ @Override
@Before
public void setUp() throws Exception {
super.setUp();
@@ -59,6 +61,26 @@ public class TestSolr4Spatial extends So
assertU(commit());
}
+ @Test
+ public void testBadShapeParse400() {
+ assertQEx(null, req(
+ "fl", "id," + fieldName, "q", "*:*", "rows", "1000",
+ "fq", "{!field f="+fieldName+"}Intersects(NonexistentShape(89.9,-130 d=9))"), 400);
+ assertQEx(null, req(
+ "fl", "id," + fieldName, "q", "*:*", "rows", "1000",
+ "fq", "{!field f="+fieldName+"}Intersects(NonexistentShape(89.9,-130 d=9"), 400);//missing parens
+ assertQEx(null, req(
+ "fl", "id," + fieldName, "q", "*:*", "rows", "1000",
+ "fq", "{!field f="+fieldName+"}Intersectssss"), 400);
+
+ try {
+ assertU(adoc("id", "-1", fieldName, "NonexistentShape"));
+ fail();
+ } catch (SolrException e) {
+ assertEquals(400, e.code());
+ }
+ }
+
private void setupDocs() {
assertU(adoc("id", "1", fieldName, "32.7693246, -79.9289094"));
assertU(adoc("id", "2", fieldName, "33.7693246, -80.9289094"));
@@ -127,7 +149,7 @@ public class TestSolr4Spatial extends So
assertQ(req(
"fl", "id," + fieldName, "q", "*:*", "rows", "1000",
- "fq", "{!field needScore=false f="+fieldName+"}Intersects(Circle(89.9,-130 d=9))"),
+ "fq", "{!field f="+fieldName+"}Intersects(Circle(89.9,-130 d=9))"),
"//result/doc/*[@name='" + fieldName + "']//text()='" + OUT + "'");
}
@@ -153,26 +175,37 @@ public class TestSolr4Spatial extends So
// that there may be a more specific detailed id to investigate.
tests[i++] = "*[count(//doc)=" + count + "]";
- //never actually need the score but lets test
- String score = new String[]{null, "none","distance","recipDistance"}[random().nextInt(4)];
+ //Test using the Solr 4 syntax
+ {
+ //never actually need the score but lets test
+ String score = new String[]{null, "none","distance","recipDistance"}[random().nextInt(4)];
+
+ double distDEG = DistanceUtils.dist2Degrees(distKM, DistanceUtils.EARTH_MEAN_RADIUS_KM);
+ String circleStr = "Circle(" + ptStr.replaceAll(" ", "") + " d=" + distDEG + ")";
+ String shapeStr;
+ if (exact) {
+ shapeStr = circleStr;
+ } else {//bbox
+ //the GEO is an assumption
+ SpatialContext ctx = SpatialContext.GEO;
+ shapeStr = ctx.toString( ctx.readShape(circleStr).getBoundingBox() );
+ }
- double distDEG = DistanceUtils.dist2Degrees(distKM, DistanceUtils.EARTH_MEAN_RADIUS_KM);
- String circleStr = "Circle(" + ptStr.replaceAll(" ", "") + " d=" + distDEG + ")";
- String shapeStr;
- if (exact) {
- shapeStr = circleStr;
- } else {//bbox
- //the GEO is an assumption
- SpatialContext ctx = SpatialContext.GEO;
- shapeStr = ctx.toString( ctx.readShape(circleStr).getBoundingBox() );
+ //FYI default distErrPct=0.025 works with the tests in this file
+ assertQ(req(
+ "fl", "id", "q","*:*", "rows", "1000",
+ "fq", "{!field f=" + fieldName + (score==null?"":" score="+score)
+ + "}Intersects(" + shapeStr + ")"),
+ tests);
+ }
+ //Test using the Solr 3 syntax
+ {
+ assertQ(req(
+ "fl", "id", "q", "*:*", "rows", "1000",
+ "fq", "{!" + (exact ? "geofilt" : "bbox") + " sfield=" + fieldName + " pt='" + ptStr + "' d=" + distKM + "}"),
+ tests);
}
- //FYI default distErrPct=0.025 works with the tests in this file
- assertQ(req(
- "fl", "id", "q","*:*", "rows", "1000",
- "fq", "{!field f=" + fieldName + (score==null?"":" score="+score)
- + "}Intersects(" + shapeStr + ")"),
- tests);
}
@Test
@@ -181,10 +214,11 @@ public class TestSolr4Spatial extends So
//match docId 1
int docId = 1;
int count = 1;
- boolean needScore = random().nextBoolean();//never actually need the score but lets test
+
+ String score = random().nextBoolean() ? "none" : "distance";//never actually need the score but lets test
assertQ(req(
"fl", "id", "q","*:*", "rows", "1000",
- "fq", "{! needScore="+needScore+" df="+fieldName+"}[32,-80 TO 33,-79]"),//lower-left to upper-right
+ "fq", "{! score="+score+" df="+fieldName+"}[32,-80 TO 33,-79]"),//lower-left to upper-right
"//result/doc/*[@name='id'][.='" + docId + "']",
"*[count(//doc)=" + count + "]");
@@ -229,6 +263,19 @@ public class TestSolr4Spatial extends So
, "/response/docs/[1]/score==0.19970943"
);
+ //score by distance and don't filter
+ assertJQ(req(
+ //circle radius is small and shouldn't match either, but we disable filtering
+ "q", "{! score=distance filter=false}"+fieldName +":\"Intersects(Circle(3,4 d=0.000001))\"",
+ "fl","id,score",
+ "sort","score asc")//want ascending due to increasing distance
+ , 1e-3
+ , "/response/docs/[0]/id=='100'"
+ , "/response/docs/[0]/score==2.827493"
+ , "/response/docs/[1]/id=='101'"
+ , "/response/docs/[1]/score==5.089807"
+ );
+
//query again with the query point closer to #101, and check the new ordering
assertJQ(req(
"q", "{! score=distance}"+fieldName +":\"Intersects(Circle(4,0 d=9))\"",
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSolrJ.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSolrJ.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSolrJ.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSolrJ.java Fri Jan 18 18:30:54 2013
@@ -74,6 +74,7 @@ public class TestSolrJ extends SolrTestC
final int base = threadNum * docsPerThread;
threads[threadNum] = new Thread("add-thread"+i) {
+ @Override
public void run(){
try {
indexDocs(base, docsPerThread, maxSleep);
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java Fri Jan 18 18:30:54 2013
@@ -35,6 +35,13 @@ public class TestSolrQueryParser extends
assertU(adoc("id","1", "text",v, "text_np",v));
v="now cow";
assertU(adoc("id","2", "text",v, "text_np",v));
+ assertU(adoc("id","3", "foo_s","a ' \" \\ {! ) } ( { z")); // A value filled with special chars
+
+ assertU(adoc("id","10", "qqq_s","X"));
+ assertU(adoc("id","11", "www_s","X"));
+ assertU(adoc("id","12", "eee_s","X"));
+ assertU(adoc("id","13", "eee_s","'balance'"));
+
assertU(commit());
}
@@ -49,4 +56,40 @@ public class TestSolrQueryParser extends
,"//*[@numFound='2']"
);
}
+
+ @Test
+ public void testLocalParamsInQP() throws Exception {
+ assertJQ(req("q","qaz {!term f=text v=$qq} wsx", "qq","now")
+ ,"/response/numFound==2"
+ );
+
+ assertJQ(req("q","qaz {!term f=text v=$qq} wsx", "qq","nomatch")
+ ,"/response/numFound==0"
+ );
+
+ assertJQ(req("q","qaz {!term f=text}now wsx", "qq","now")
+ ,"/response/numFound==2"
+ );
+
+ assertJQ(req("q","qaz {!term f=foo_s v='a \\' \" \\\\ {! ) } ( { z'} wsx") // single quote escaping
+ ,"/response/numFound==1"
+ );
+
+ assertJQ(req("q","qaz {!term f=foo_s v=\"a ' \\\" \\\\ {! ) } ( { z\"} wsx") // double quote escaping
+ ,"/response/numFound==1"
+ );
+
+ // double-join to test back-to-back local params
+ assertJQ(req("q","qaz {!join from=www_s to=eee_s}{!join from=qqq_s to=www_s}id:10" )
+ ,"/response/docs/[0]/id=='12'"
+ );
+ }
+
+ @Test
+ public void testSolr4121() throws Exception {
+ // At one point, balanced quotes messed up the parser(SOLR-4121)
+ assertJQ(req("q","eee_s:'balance'", "indent","true")
+ ,"/response/numFound==1"
+ );
+ }
}
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSort.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSort.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestSort.java Fri Jan 18 18:30:54 2013
@@ -270,6 +270,7 @@ public class TestSort extends SolrTestCa
searcher.search(new MatchAllDocsQuery(), filt, myCollector);
Collections.sort(collectedDocs, new Comparator<MyDoc>() {
+ @Override
public int compare(MyDoc o1, MyDoc o2) {
String v1 = o1.val==null ? nullRep : o1.val;
String v2 = o2.val==null ? nullRep : o2.val;
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestValueSourceCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestValueSourceCache.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestValueSourceCache.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/TestValueSourceCache.java Fri Jan 18 18:30:54 2013
@@ -17,7 +17,6 @@ package org.apache.solr.search;
* limitations under the License.
*/
-import org.apache.lucene.queryparser.classic.ParseException;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.QueryUtils;
import org.apache.solr.SolrTestCaseJ4;
@@ -41,14 +40,14 @@ public class TestValueSourceCache extend
_func = null;
}
- Query getQuery(String query) throws ParseException {
+ Query getQuery(String query) throws SyntaxError {
_func.setString(query);
return _func.parse();
}
// This is actually also tested by the tests for val_d1 below, but the bug was reported against geodist()...
@Test
- public void testGeodistSource() throws ParseException {
+ public void testGeodistSource() throws SyntaxError {
Query q_home = getQuery("geodist(home_ll, 45.0, 43.0)");
Query q_work = getQuery("geodist(work_ll, 45.0, 43.0)");
Query q_home2 = getQuery("geodist(home_ll, 45.0, 43.0)");
@@ -57,7 +56,7 @@ public class TestValueSourceCache extend
}
@Test
- public void testNumerics() throws ParseException {
+ public void testNumerics() throws SyntaxError {
String[] templates = new String[]{
"sum(#v0, #n0)",
"product(pow(#v0,#n0),#v1,#n1)",
@@ -94,7 +93,7 @@ public class TestValueSourceCache extend
// This test should will fail because q1 and q3 evaluate as equal unless
// fixes for bug 2829 are in place.
- void tryQuerySameTypes(String template, String numbers, String type) throws ParseException {
+ void tryQuerySameTypes(String template, String numbers, String type) throws SyntaxError {
String s1 = template;
String s2 = template;
String s3 = template;
@@ -120,7 +119,7 @@ public class TestValueSourceCache extend
// These should always and forever fail, and would have failed without the fixes for 2829, but why not make
// some more tests just in case???
- void tryQueryDiffTypes(String template, String numbers, String[] types) throws ParseException {
+ void tryQueryDiffTypes(String template, String numbers, String[] types) throws SyntaxError {
String s1 = template;
String s2 = template;
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/function/NvlValueSourceParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/function/NvlValueSourceParser.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/function/NvlValueSourceParser.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/search/function/NvlValueSourceParser.java Fri Jan 18 18:30:54 2013
@@ -20,9 +20,9 @@ package org.apache.solr.search.function;
import org.apache.lucene.queries.function.FunctionValues;
import org.apache.lucene.queries.function.ValueSource;
import org.apache.lucene.queries.function.valuesource.SimpleFloatFunction;
-import org.apache.lucene.queryparser.classic.ParseException;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.search.FunctionQParser;
+import org.apache.solr.search.SyntaxError;
import org.apache.solr.search.ValueSourceParser;
/**
@@ -46,7 +46,7 @@ public class NvlValueSourceParser extend
private float nvlFloatValue = 0.0f;
@Override
- public ValueSource parse(FunctionQParser fp) throws ParseException {
+ public ValueSource parse(FunctionQParser fp) throws SyntaxError {
ValueSource source = fp.parseValueSource();
final float nvl = fp.parseFloat();
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java Fri Jan 18 18:30:54 2013
@@ -246,9 +246,8 @@ public class CacheHeaderTest extends Cac
protected File makeFile(String contents, String charset) {
try {
- File f = _TestUtil.getTempDir("cachetest_csv");
- Writer out = new OutputStreamWriter(new FileOutputStream(f),
- charset);
+ File f = _TestUtil.createTempFile("cachetest_csv", null, TEMP_DIR);
+ Writer out = new OutputStreamWriter(new FileOutputStream(f), charset);
out.write(contents);
out.close();
return f;
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/servlet/DirectSolrConnectionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/servlet/DirectSolrConnectionTest.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/servlet/DirectSolrConnectionTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/servlet/DirectSolrConnectionTest.java Fri Jan 18 18:30:54 2013
@@ -17,6 +17,8 @@
package org.apache.solr.servlet;
+import java.net.URLEncoder;
+
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.util.AbstractSolrTestCase;
import org.junit.BeforeClass;
@@ -74,7 +76,7 @@ public class DirectSolrConnectionTest ex
// Test using the Stream body parameter
for( String cmd : cmds ) {
- direct.request( "/update?"+CommonParams.STREAM_BODY+"="+cmd, null );
+ direct.request( "/update?"+CommonParams.STREAM_BODY+"="+URLEncoder.encode(cmd, "UTF-8"), null );
}
String got = direct.request( getIt, null );
assertTrue( got.indexOf( value ) > 0 );
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/servlet/SolrRequestParserTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/servlet/SolrRequestParserTest.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/servlet/SolrRequestParserTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/servlet/SolrRequestParserTest.java Fri Jan 18 18:30:54 2013
@@ -21,20 +21,22 @@ import static org.easymock.EasyMock.crea
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
+import java.io.ByteArrayInputStream;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
import java.net.URL;
-import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.io.IOUtils;
import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.MultiMapSolrParams;
import org.apache.solr.common.params.SolrParams;
@@ -112,7 +114,6 @@ public class SolrRequestParserTest exten
@Test
public void testStreamURL() throws Exception
{
- boolean ok = false;
String url = "http://www.apache.org/dist/lucene/solr/";
byte[] bytes = null;
try {
@@ -149,31 +150,62 @@ public class SolrRequestParserTest exten
}
@Test
- public void testUrlParamParsing()
+ public void testUrlParamParsing() throws Exception
{
- String[][] teststr = new String[][] {
+ final String[][] teststr = new String[][] {
{ "this is simple", "this%20is%20simple" },
{ "this is simple", "this+is+simple" },
{ "\u00FC", "%C3%BC" }, // lower-case "u" with diaeresis/umlaut
{ "\u0026", "%26" }, // &
- { "\u20AC", "%E2%82%AC" } // euro
+ { "", "" }, // empty
+ { "\u20AC", "%E2%82%ac" } // euro, also with lowercase escapes
};
for( String[] tst : teststr ) {
- MultiMapSolrParams params = SolrRequestParsers.parseQueryString( "val="+tst[1] );
+ SolrParams params = SolrRequestParsers.parseQueryString( "val="+tst[1] );
assertEquals( tst[0], params.get( "val" ) );
+ params = SolrRequestParsers.parseQueryString( "val="+tst[1]+"&" );
+ assertEquals( tst[0], params.get( "val" ) );
+ params = SolrRequestParsers.parseQueryString( "&&val="+tst[1]+"&" );
+ assertEquals( tst[0], params.get( "val" ) );
+ params = SolrRequestParsers.parseQueryString( "&&val="+tst[1]+"&&&val="+tst[1]+"&" );
+ assertArrayEquals(new String[]{tst[0],tst[0]}, params.getParams("val") );
+ }
+
+ SolrParams params = SolrRequestParsers.parseQueryString("val");
+ assertEquals("", params.get("val"));
+
+ params = SolrRequestParsers.parseQueryString("val&foo=bar=bar&muh&");
+ assertEquals("", params.get("val"));
+ assertEquals("bar=bar", params.get("foo"));
+ assertEquals("", params.get("muh"));
+
+ final String[] invalid = {
+ "q=h%FCllo", // non-UTF-8
+ "q=h\u00FCllo", // encoded string is not pure US-ASCII
+ "q=hallo%", // incomplete escape
+ "q=hallo%1", // incomplete escape
+ "q=hallo%XX123", // invalid digit 'X' in escape
+ "=hallo" // missing key
+ };
+ for (String s : invalid) {
+ try {
+ SolrRequestParsers.parseQueryString(s);
+ fail("Should throw SolrException");
+ } catch (SolrException se) {
+ // pass
+ }
}
}
@Test
public void testStandardParseParamsAndFillStreams() throws Exception
{
- ArrayList<ContentStream> streams = new ArrayList<ContentStream>();
- Map<String,String[]> params = new HashMap<String, String[]>();
- params.put( "q", new String[] { "hello" } );
+ final String getParams = "qt=%C3%BC&dup=foo", postParams = "q=hello&d%75p=bar";
+ final byte[] postBytes = postParams.getBytes("US-ASCII");
// Set up the expected behavior
- String[] ct = new String[] {
+ final String[] ct = new String[] {
"application/x-www-form-urlencoded",
"Application/x-www-form-urlencoded",
"application/x-www-form-urlencoded; charset=utf-8",
@@ -184,16 +216,102 @@ public class SolrRequestParserTest exten
HttpServletRequest request = createMock(HttpServletRequest.class);
expect(request.getMethod()).andReturn("POST").anyTimes();
expect(request.getContentType()).andReturn( contentType ).anyTimes();
- expect(request.getParameterMap()).andReturn(params).anyTimes();
+ expect(request.getQueryString()).andReturn(getParams).anyTimes();
+ expect(request.getContentLength()).andReturn(postBytes.length).anyTimes();
+ expect(request.getInputStream()).andReturn(new ServletInputStream() {
+ private final ByteArrayInputStream in = new ByteArrayInputStream(postBytes);
+ @Override public int read() { return in.read(); }
+ });
replay(request);
- MultipartRequestParser multipart = new MultipartRequestParser( 1000000 );
+ MultipartRequestParser multipart = new MultipartRequestParser( 2048 );
RawRequestParser raw = new RawRequestParser();
- StandardRequestParser standard = new StandardRequestParser( multipart, raw );
+ FormDataRequestParser formdata = new FormDataRequestParser( 2048 );
+ StandardRequestParser standard = new StandardRequestParser( multipart, raw, formdata );
- SolrParams p = standard.parseParamsAndFillStreams( request, streams );
+ SolrParams p = standard.parseParamsAndFillStreams(request, new ArrayList<ContentStream>());
assertEquals( "contentType: "+contentType, "hello", p.get("q") );
+ assertEquals( "contentType: "+contentType, "\u00FC", p.get("qt") );
+ assertArrayEquals( "contentType: "+contentType, new String[]{"foo","bar"}, p.getParams("dup") );
+ }
+ }
+
+ @Test
+ public void testStandardFormdataUploadLimit() throws Exception
+ {
+ final int limitKBytes = 128;
+
+ final StringBuilder large = new StringBuilder("q=hello");
+ // grow exponentially to reach 128 KB limit:
+ while (large.length() <= limitKBytes * 1024) {
+ large.append('&').append(large);
+ }
+ HttpServletRequest request = createMock(HttpServletRequest.class);
+ expect(request.getMethod()).andReturn("POST").anyTimes();
+ expect(request.getContentType()).andReturn("application/x-www-form-urlencoded").anyTimes();
+ // we dont pass a content-length to let the security mechanism limit it:
+ expect(request.getContentLength()).andReturn(-1).anyTimes();
+ expect(request.getQueryString()).andReturn(null).anyTimes();
+ expect(request.getInputStream()).andReturn(new ServletInputStream() {
+ private final ByteArrayInputStream in = new ByteArrayInputStream(large.toString().getBytes("US-ASCII"));
+ @Override public int read() { return in.read(); }
+ });
+ replay(request);
+
+ FormDataRequestParser formdata = new FormDataRequestParser( limitKBytes );
+ try {
+ formdata.parseParamsAndFillStreams(request, new ArrayList<ContentStream>());
+ fail("should throw SolrException");
+ } catch (SolrException solre) {
+ assertTrue(solre.getMessage().contains("upload limit"));
+ assertEquals(400, solre.code());
+ }
+ }
+
+ @Test
+ public void testParameterIncompatibilityException1() throws Exception
+ {
+ HttpServletRequest request = createMock(HttpServletRequest.class);
+ expect(request.getMethod()).andReturn("POST").anyTimes();
+ expect(request.getContentType()).andReturn("application/x-www-form-urlencoded").anyTimes();
+ expect(request.getContentLength()).andReturn(100).anyTimes();
+ expect(request.getQueryString()).andReturn(null).anyTimes();
+ // we emulate Jetty that returns empty stream when parameters were parsed before:
+ expect(request.getInputStream()).andReturn(new ServletInputStream() {
+ @Override public int read() { return -1; }
+ });
+ replay(request);
+
+ FormDataRequestParser formdata = new FormDataRequestParser( 2048 );
+ try {
+ formdata.parseParamsAndFillStreams(request, new ArrayList<ContentStream>());
+ fail("should throw SolrException");
+ } catch (SolrException solre) {
+ assertTrue(solre.getMessage().startsWith("Solr requires that request parameters"));
+ assertEquals(500, solre.code());
+ }
+ }
+
+ @Test
+ public void testParameterIncompatibilityException2() throws Exception
+ {
+ HttpServletRequest request = createMock(HttpServletRequest.class);
+ expect(request.getMethod()).andReturn("POST").anyTimes();
+ expect(request.getContentType()).andReturn("application/x-www-form-urlencoded").anyTimes();
+ expect(request.getContentLength()).andReturn(100).anyTimes();
+ expect(request.getQueryString()).andReturn(null).anyTimes();
+ // we emulate Tomcat that throws IllegalStateException when parameters were parsed before:
+ expect(request.getInputStream()).andThrow(new IllegalStateException());
+ replay(request);
+
+ FormDataRequestParser formdata = new FormDataRequestParser( 2048 );
+ try {
+ formdata.parseParamsAndFillStreams(request, new ArrayList<ContentStream>());
+ fail("should throw SolrException");
+ } catch (SolrException solre) {
+ assertTrue(solre.getMessage().startsWith("Solr requires that request parameters"));
+ assertEquals(500, solre.code());
}
}
}
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java Fri Jan 18 18:30:54 2013
@@ -376,13 +376,14 @@ public class SpellCheckCollatorTest exte
public void testContextSensitiveCollate() throws Exception {
// DirectSolrSpellChecker IndexBasedSpellChecker
String[] dictionary = {"direct", "default_teststop" };
- for(int i=0 ; i<1 ; i++) {
+ for(int i=0 ; i<=1 ; i++) {
assertQ(
req(
"q", "teststop:(flew AND form AND heathrow)",
"qt", "spellCheckCompRH",
"indent", "true",
SpellCheckComponent.COMPONENT_NAME, "true",
+ SpellCheckComponent.SPELLCHECK_BUILD, "true",
SpellCheckComponent.SPELLCHECK_DICT, dictionary[i],
SpellCheckComponent.SPELLCHECK_EXTENDED_RESULTS, "true",
SpellCheckComponent.SPELLCHECK_COUNT, "10",
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/AutoCommitTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/AutoCommitTest.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/AutoCommitTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/AutoCommitTest.java Fri Jan 18 18:30:54 2013
@@ -290,7 +290,7 @@ public class AutoCommitTest extends Abst
SolrQueryResponse rsp = new SolrQueryResponse();
SolrQueryRequestBase req = new SolrQueryRequestBase( core, params ) {};
req.setContentStreams( toContentStreams(
- adoc(1000, "id", "529", "field_t", "what's inside?", "subject", "info"), null ) );
+ adoc(2000, "id", "529", "field_t", "what's inside?", "subject", "info"), null ) );
trigger.reset();
handler.handleRequest( req, rsp );
@@ -331,7 +331,7 @@ public class AutoCommitTest extends Abst
// now make the call 10 times really fast and make sure it
// only commits once
req.setContentStreams( toContentStreams(
- adoc(1000, "id", "500" ), null ) );
+ adoc(2000, "id", "500" ), null ) );
for( int i=0;i<10; i++ ) {
handler.handleRequest( req, rsp );
}
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerOptimizeTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerOptimizeTest.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerOptimizeTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/DirectUpdateHandlerOptimizeTest.java Fri Jan 18 18:30:54 2013
@@ -87,6 +87,7 @@ public class DirectUpdateHandlerOptimize
private void assertNumSegments(String indexDir, int numSegs) {
File file = new File(indexDir);
File[] segs = file.listFiles(new FileFilter() {
+ @Override
public boolean accept(File file) {
return file.getName().endsWith("cfs");
}
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java Fri Jan 18 18:30:54 2013
@@ -235,7 +235,7 @@ public class SoftAutoCommitTest extends
monitor.assertSaneOffers();
// Wait for the soft commit with some fudge
- soft529 = monitor.soft.poll(softCommitWaitMillis * 2, MILLISECONDS);
+ soft529 = monitor.soft.poll(softCommitWaitMillis * 3, MILLISECONDS);
assertNotNull("soft529 wasn't fast enough", soft529);
monitor.assertSaneOffers();
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java Fri Jan 18 18:30:54 2013
@@ -21,9 +21,6 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.solr.BaseDistributedSearchTestCase;
@@ -37,7 +34,6 @@ import org.apache.solr.common.cloud.ZkCo
import org.apache.solr.common.cloud.ZkNodeProps;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.common.util.ExecutorUtil;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.SolrCore;
@@ -48,10 +44,9 @@ import org.apache.solr.update.SolrCmdDis
import org.apache.solr.update.SolrCmdDistributor.Response;
import org.apache.solr.update.SolrCmdDistributor.StdNode;
import org.apache.solr.update.processor.DistributedUpdateProcessor;
-import org.apache.solr.util.DefaultSolrThreadFactory;
public class SolrCmdDistributorTest extends BaseDistributedSearchTestCase {
- private ThreadPoolExecutor executor;
+ private UpdateShardHandler updateShardHandler;
public SolrCmdDistributorTest() {
fixShardCount = true;
@@ -70,6 +65,7 @@ public class SolrCmdDistributorTest exte
// TODO: for now we redefine this method so that it pulls from the above
// we don't get helpful override behavior due to the method being static
+ @Override
protected void createServers(int numShards) throws Exception {
controlJetty = createJetty(new File(getSolrHome()), testDir + "/control/data", null, getSolrConfigFile(), getSchemaFile());
@@ -96,7 +92,7 @@ public class SolrCmdDistributorTest exte
public void doTest() throws Exception {
del("*:*");
- SolrCmdDistributor cmdDistrib = new SolrCmdDistributor(5, executor);
+ SolrCmdDistributor cmdDistrib = new SolrCmdDistributor(5, updateShardHandler);
ModifiableSolrParams params = new ModifiableSolrParams();
@@ -136,7 +132,7 @@ public class SolrCmdDistributorTest exte
nodes.add(new StdNode(new ZkCoreNodeProps(nodeProps)));
// add another 2 docs to control and 3 to client
- cmdDistrib = new SolrCmdDistributor(5, executor);
+ cmdDistrib = new SolrCmdDistributor(5, updateShardHandler);
cmd.solrDoc = sdoc("id", 2);
params = new ModifiableSolrParams();
params.set(DistributedUpdateProcessor.COMMIT_END_POINT, true);
@@ -179,7 +175,7 @@ public class SolrCmdDistributorTest exte
- cmdDistrib = new SolrCmdDistributor(5, executor);
+ cmdDistrib = new SolrCmdDistributor(5, updateShardHandler);
params = new ModifiableSolrParams();
params.set(DistributedUpdateProcessor.COMMIT_END_POINT, true);
@@ -212,7 +208,7 @@ public class SolrCmdDistributorTest exte
int id = 5;
- cmdDistrib = new SolrCmdDistributor(5, executor);
+ cmdDistrib = new SolrCmdDistributor(5, updateShardHandler);
int cnt = atLeast(303);
for (int i = 0; i < cnt; i++) {
@@ -288,15 +284,12 @@ public class SolrCmdDistributorTest exte
@Override
public void setUp() throws Exception {
super.setUp();
- executor = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 5,
- TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
- new DefaultSolrThreadFactory("cmdDistribExecutor"));
+ updateShardHandler = new UpdateShardHandler(10000, 10000);
}
@Override
public void tearDown() throws Exception {
- ExecutorUtil.shutdownNowAndAwaitTermination(executor);
- executor = null;
+ updateShardHandler = null;
super.tearDown();
}
}
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/processor/ScriptEngineTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/processor/ScriptEngineTest.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/processor/ScriptEngineTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/processor/ScriptEngineTest.java Fri Jan 18 18:30:54 2013
@@ -17,6 +17,7 @@
package org.apache.solr.update.processor;
+import org.apache.lucene.util.Constants;
import org.apache.lucene.util.LuceneTestCase;
import javax.script.Invocable;
@@ -38,6 +39,8 @@ public class ScriptEngineTest extends Lu
@BeforeClass
public static void beforeClass() throws Exception {
+ assumeFalse("https://twitter.com/UweSays/status/260487231880433664 / SOLR-4233: OS X bogusly starts AWT!",
+ Constants.MAC_OS_X);
Assume.assumeNotNull((new ScriptEngineManager()).getEngineByExtension("js"));
Assume.assumeNotNull((new ScriptEngineManager()).getEngineByName("JavaScript"));
}
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java Fri Jan 18 18:30:54 2013
@@ -64,7 +64,7 @@ public class SignatureUpdateProcessorFac
chain = "dedupe"; // set the default that most tests expect
}
- void checkNumDocs(int n) {
+ static void checkNumDocs(int n) {
SolrQueryRequest req = req();
try {
assertEquals(n, req.getSearcher().getIndexReader().numDocs());
@@ -347,12 +347,17 @@ public class SignatureUpdateProcessorFac
public UnusualList(int size) {
super(size);
}
+ @Override
public String toString() {
return "UNUSUAL:" + super.toString();
}
}
- private void addDoc(String doc) throws Exception {
+ private void addDoc(String doc) throws Exception {
+ addDoc(doc, chain);
+ }
+
+ static void addDoc(String doc, String chain) throws Exception {
Map<String, String[]> params = new HashMap<String, String[]>();
MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
params.put(UpdateParams.UPDATE_CHAIN, new String[] { chain });
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java Fri Jan 18 18:30:54 2013
@@ -79,6 +79,7 @@ public class StatelessScriptUpdateProces
final StatelessScriptUpdateProcessorFactory factory = ((StatelessScriptUpdateProcessorFactory) chained.getFactories()[0]);
final List<String> functionMessages = new ArrayList<String>();
factory.setScriptEngineCustomizer(new ScriptEngineCustomizer() {
+ @Override
public void customize(ScriptEngine engine) {
engine.put("testCase", StatelessScriptUpdateProcessorFactoryTest.this);
engine.put("functionMessages", functionMessages);
@@ -124,6 +125,7 @@ public class StatelessScriptUpdateProces
((StatelessScriptUpdateProcessorFactory) chained.getFactories()[0]);
final List<String> functionMessages = new ArrayList<String>();
ScriptEngineCustomizer customizer = new ScriptEngineCustomizer() {
+ @Override
public void customize(ScriptEngine engine) {
engine.put("testCase", StatelessScriptUpdateProcessorFactoryTest.this);
engine.put("functionMessages", functionMessages);
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/util/DateMathParserTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/util/DateMathParserTest.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/util/DateMathParserTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/util/DateMathParserTest.java Fri Jan 18 18:30:54 2013
@@ -329,7 +329,7 @@ public class DateMathParserTest extends
for (String command : badCommands.keySet()) {
try {
Date out = p.parseMath(command);
- fail("Didn't generate ParseException for: " + command);
+ fail("Didn't generate SyntaxError for: " + command);
} catch (ParseException e) {
assertEquals("Wrong pos for: " + command + " => " + e.getMessage(),
badCommands.get(command).intValue(), e.getErrorOffset());
Modified: lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/util/SimplePostToolTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/util/SimplePostToolTest.java?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/util/SimplePostToolTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/solr/core/src/test/org/apache/solr/util/SimplePostToolTest.java Fri Jan 18 18:30:54 2013
@@ -38,6 +38,7 @@ public class SimplePostToolTest extends
SimplePostTool t_file, t_file_auto, t_file_rec, t_web, t_test;
PageFetcher pf;
+ @Override
@Before
public void setUp() throws Exception {
super.setUp();
@@ -55,6 +56,7 @@ public class SimplePostToolTest extends
t_web = SimplePostTool.parseArgsAndInit(args);
System.setProperty("params", "param1=foo¶m2=bar");
+ System.setProperty("url", "http://localhost:5150/solr/update");
t_test = SimplePostTool.parseArgsAndInit(args);
pf = new MockPageFetcher();
@@ -75,7 +77,7 @@ public class SimplePostToolTest extends
assertEquals(1, t_web.recursive);
assertEquals(10, t_web.delay);
- assertNotNull(t_test.solrUrl);
+ assertEquals("http://localhost:5150/solr/update?param1=foo¶m2=bar",t_test.solrUrl.toExternalForm());
}
@Test
Modified: lucene/dev/branches/LUCENE-2878/solr/example/contexts/solr.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/contexts/solr.xml?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/contexts/solr.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/contexts/solr.xml Fri Jan 18 18:30:54 2013
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
- <Set name="contextPath">/solr</Set>
+ <Set name="contextPath"><SystemProperty name="hostContext" default="/solr"/></Set>
<Set name="war"><SystemProperty name="jetty.home"/>/webapps/solr.war</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home"/>/etc/webdefault.xml</Set>
<Set name="tempDirectory"><Property name="jetty.home" default="."/>/solr-webapp</Set>
-</Configure>
\ No newline at end of file
+</Configure>
Modified: lucene/dev/branches/LUCENE-2878/solr/example/etc/jetty.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/etc/jetty.xml?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/etc/jetty.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/etc/jetty.xml Fri Jan 18 18:30:54 2013
@@ -12,12 +12,6 @@
<Configure id="Server" class="org.eclipse.jetty.server.Server">
- <!-- Increase the maximum POST size to 1 MB to be able to handle large shard requests -->
- <Call name="setAttribute">
- <Arg>org.eclipse.jetty.server.Request.maxFormContentSize</Arg>
- <Arg>200000</Arg>
- </Call>
-
<!-- =========================================================== -->
<!-- Server Thread Pool -->
<!-- =========================================================== -->
@@ -100,7 +94,7 @@
<Set name="filename">
logs/request.yyyy_mm_dd.log
</Set>
- <Set name="filenameDateFormat">yyyy_mm_dd</Set>
+ <Set name="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">false</Set>
Modified: lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/db/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/db/conf/solrconfig.xml?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/db/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/db/conf/solrconfig.xml Fri Jan 18 18:30:54 2013
@@ -28,7 +28,7 @@
<jmx />
- <lib dir="../../../../dist/" regex="apache-solr-dataimporthandler-.*\.jar" />
+ <lib dir="../../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
<!-- <indexConfig> section could go here, but we want the defaults -->
@@ -217,7 +217,7 @@
-->
<requestDispatcher handleSelect="true" >
<!--Make sure your system has some authentication before enabling remote streaming! -->
- <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
<!-- Set HTTP caching related parameters (for proxy caches and clients).
Modified: lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/mail/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/mail/conf/solrconfig.xml?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/mail/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/mail/conf/solrconfig.xml Fri Jan 18 18:30:54 2013
@@ -34,7 +34,7 @@
<lib dir="../../../../contrib/extraction/lib" />
<lib dir="../../../../contrib/dataimporthandler/lib/" regex=".*jar$" />
- <lib dir="../../../../dist/" regex="apache-solr-dataimporthandler-.*\.jar" />
+ <lib dir="../../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
<!-- <indexConfig> section could go here, but we want the defaults -->
@@ -249,7 +249,7 @@
-->
<requestDispatcher handleSelect="true" >
<!--Make sure your system has some authentication before enabling remote streaming! -->
- <requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048000" />
+ <requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048000" formdataUploadLimitInKB="2048" />
<!-- Set HTTP caching related parameters (for proxy caches and clients).
Modified: lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml Fri Jan 18 18:30:54 2013
@@ -5,22 +5,22 @@
pk="link"
url="http://rss.slashdot.org/Slashdot/slashdot"
processor="XPathEntityProcessor"
- forEach="/RDF/channel | /RDF/item"
+ forEach="/rss/channel | /rss/item"
transformer="DateFormatTransformer">
- <field column="source" xpath="/RDF/channel/title" commonField="true" />
- <field column="source-link" xpath="/RDF/channel/link" commonField="true" />
- <field column="subject" xpath="/RDF/channel/subject" commonField="true" />
+ <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="/RDF/item/title" />
- <field column="link" xpath="/RDF/item/link" />
- <field column="description" xpath="/RDF/item/description" />
- <field column="creator" xpath="/RDF/item/creator" />
- <field column="item-subject" xpath="/RDF/item/subject" />
- <field column="date" xpath="/RDF/item/date" dateTimeFormat="yyyy-MM-dd'T'HH:mm:ss" />
- <field column="slash-department" xpath="/RDF/item/department" />
- <field column="slash-section" xpath="/RDF/item/section" />
- <field column="slash-comments" xpath="/RDF/item/comments" />
+ <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" />
</entity>
</document>
</dataConfig>
Modified: lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/rss/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/rss/conf/solrconfig.xml?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/rss/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/rss/conf/solrconfig.xml Fri Jan 18 18:30:54 2013
@@ -28,7 +28,7 @@
<jmx />
- <lib dir="../../../../dist/" regex="apache-solr-dataimporthandler-.*\.jar" />
+ <lib dir="../../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
<!-- <indexConfig> section could go here, but we want the defaults -->
@@ -217,7 +217,7 @@
-->
<requestDispatcher handleSelect="true" >
<!--Make sure your system has some authentication before enabling remote streaming! -->
- <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
<!-- Set HTTP caching related parameters (for proxy caches and clients).
Modified: lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/solr/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/solr/conf/solrconfig.xml?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/solr/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/solr/conf/solrconfig.xml Fri Jan 18 18:30:54 2013
@@ -28,7 +28,7 @@
<jmx />
- <lib dir="../../../../dist/" regex="apache-solr-dataimporthandler-.*\.jar" />
+ <lib dir="../../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
<!-- <indexConfig> section could go here, but we want the defaults -->
@@ -217,7 +217,7 @@
-->
<requestDispatcher handleSelect="true" >
<!--Make sure your system has some authentication before enabling remote streaming! -->
- <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
<!-- Set HTTP caching related parameters (for proxy caches and clients).
Modified: lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/tika/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/tika/conf/solrconfig.xml?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/tika/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/example-DIH/solr/tika/conf/solrconfig.xml Fri Jan 18 18:30:54 2013
@@ -34,7 +34,7 @@
<lib dir="../../../../contrib/extraction/lib" />
<lib dir="../../../../contrib/dataimporthandler/lib/" regex=".*jar$" />
- <lib dir="../../../../dist/" regex="apache-solr-dataimporthandler-.*\.jar" />
+ <lib dir="../../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
<!-- <indexConfig> section could go here, but we want the defaults -->
@@ -188,7 +188,7 @@
-->
<requestDispatcher handleSelect="true" >
<!--Make sure your system has some authentication before enabling remote streaming! -->
- <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
<!-- Set HTTP caching related parameters (for proxy caches and clients).
Modified: lucene/dev/branches/LUCENE-2878/solr/example/ivy.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/ivy.xml?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/ivy.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/ivy.xml Fri Jan 18 18:30:54 2013
@@ -16,6 +16,9 @@
specific language governing permissions and limitations
under the License.
-->
+<!DOCTYPE ivy-module [
+ <!ENTITY jetty.version "8.1.8.v20121106">
+]>
<ivy-module version="2.0">
<info organisation="org.apache.solr" module="example"/>
<configurations>
@@ -25,18 +28,18 @@
</configurations>
<dependencies>
- <dependency org="org.eclipse.jetty" name="jetty-continuation" rev="8.1.7.v20120910" transitive="false" conf="jetty->default"/>
- <dependency org="org.eclipse.jetty" name="jetty-deploy" rev="8.1.7.v20120910" transitive="false" conf="jetty->default"/>
- <dependency org="org.eclipse.jetty" name="jetty-http" rev="8.1.7.v20120910" transitive="false" conf="jetty->default"/>
- <dependency org="org.eclipse.jetty" name="jetty-io" rev="8.1.7.v20120910" transitive="false" conf="jetty->default"/>
- <dependency org="org.eclipse.jetty" name="jetty-jmx" rev="8.1.7.v20120910" transitive="false" conf="jetty->default"/>
- <dependency org="org.eclipse.jetty" name="jetty-security" rev="8.1.7.v20120910" transitive="false" conf="jetty->default"/>
- <dependency org="org.eclipse.jetty" name="jetty-server" rev="8.1.7.v20120910" transitive="false" conf="jetty->default"/>
- <dependency org="org.eclipse.jetty" name="jetty-servlet" rev="8.1.7.v20120910" transitive="false" conf="jetty->default"/>
- <dependency org="org.eclipse.jetty" name="jetty-util" rev="8.1.7.v20120910" transitive="false" conf="jetty->default"/>
- <dependency org="org.eclipse.jetty" name="jetty-webapp" rev="8.1.7.v20120910" transitive="false" conf="jetty->default"/>
- <dependency org="org.eclipse.jetty" name="jetty-xml" rev="8.1.7.v20120910" transitive="false" conf="jetty->default"/>
- <dependency org="org.eclipse.jetty" name="jetty-start" rev="8.1.7.v20120910" transitive="false" conf="start->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"/>
+ <dependency org="org.eclipse.jetty" name="jetty-io" rev="&jetty.version;" transitive="false" conf="jetty->default"/>
+ <dependency org="org.eclipse.jetty" name="jetty-jmx" rev="&jetty.version;" transitive="false" conf="jetty->default"/>
+ <dependency org="org.eclipse.jetty" name="jetty-security" rev="&jetty.version;" transitive="false" conf="jetty->default"/>
+ <dependency org="org.eclipse.jetty" name="jetty-server" rev="&jetty.version;" transitive="false" conf="jetty->default"/>
+ <dependency org="org.eclipse.jetty" name="jetty-servlet" rev="&jetty.version;" transitive="false" conf="jetty->default"/>
+ <dependency org="org.eclipse.jetty" name="jetty-util" rev="&jetty.version;" transitive="false" conf="jetty->default"/>
+ <dependency org="org.eclipse.jetty" name="jetty-webapp" rev="&jetty.version;" transitive="false" conf="jetty->default"/>
+ <dependency org="org.eclipse.jetty" name="jetty-xml" rev="&jetty.version;" transitive="false" conf="jetty->default"/>
+ <dependency org="org.eclipse.jetty" name="jetty-start" rev="&jetty.version;" transitive="false" conf="start->default"/>
<dependency org="org.eclipse.jetty.orbit" name="javax.servlet" rev="3.0.0.v201112011016" transitive="false" conf="servlet->default">
<artifact name="javax.servlet" type="orbit" ext="jar"/>
</dependency>
Modified: lucene/dev/branches/LUCENE-2878/solr/example/multicore/core0/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/multicore/core0/conf/solrconfig.xml?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/multicore/core0/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/multicore/core0/conf/solrconfig.xml Fri Jan 18 18:30:54 2013
@@ -47,7 +47,7 @@
<requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />
<requestDispatcher handleSelect="true" >
- <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
</requestDispatcher>
<requestHandler name="standard" class="solr.StandardRequestHandler" default="true" />
Modified: lucene/dev/branches/LUCENE-2878/solr/example/multicore/core1/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/multicore/core1/conf/solrconfig.xml?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/multicore/core1/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/multicore/core1/conf/solrconfig.xml Fri Jan 18 18:30:54 2013
@@ -47,7 +47,7 @@
<requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />
<requestDispatcher handleSelect="true" >
- <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
</requestDispatcher>
<requestHandler name="standard" class="solr.StandardRequestHandler" default="true" />
Modified: lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/lang/contractions_fr.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/lang/contractions_fr.txt?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/lang/contractions_fr.txt (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/lang/contractions_fr.txt Fri Jan 18 18:30:54 2013
@@ -7,3 +7,9 @@ qu
n
s
j
+d
+c
+jusqu
+quoiqu
+lorsqu
+puisqu
Modified: lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/solrconfig.xml?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/solrconfig.xml (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/solrconfig.xml Fri Jan 18 18:30:54 2013
@@ -70,16 +70,16 @@
with their external dependencies.
-->
<lib dir="../../../contrib/extraction/lib" regex=".*\.jar" />
- <lib dir="../../../dist/" regex="apache-solr-cell-\d.*\.jar" />
+ <lib dir="../../../dist/" regex="solr-cell-\d.*\.jar" />
<lib dir="../../../contrib/clustering/lib/" regex=".*\.jar" />
- <lib dir="../../../dist/" regex="apache-solr-clustering-\d.*\.jar" />
+ <lib dir="../../../dist/" regex="solr-clustering-\d.*\.jar" />
<lib dir="../../../contrib/langid/lib/" regex=".*\.jar" />
- <lib dir="../../../dist/" regex="apache-solr-langid-\d.*\.jar" />
+ <lib dir="../../../dist/" regex="solr-langid-\d.*\.jar" />
<lib dir="../../../contrib/velocity/lib" regex=".*\.jar" />
- <lib dir="../../../dist/" regex="apache-solr-velocity-\d.*\.jar" />
+ <lib dir="../../../dist/" regex="solr-velocity-\d.*\.jar" />
<!-- If a 'dir' option (with or without a regex) is used and nothing
is found that matches, it will be ignored
@@ -154,7 +154,7 @@
before flushing.
If both ramBufferSizeMB and maxBufferedDocs is set, then
Lucene will flush based on whichever limit is hit first. -->
- <!-- <ramBufferSizeMB>32</ramBufferSizeMB> -->
+ <!-- <ramBufferSizeMB>100</ramBufferSizeMB> -->
<!-- <maxBufferedDocs>1000</maxBufferedDocs> -->
<!-- Expert: Merge Policy
@@ -239,12 +239,9 @@
-->
<!-- Commit Deletion Policy
-
Custom deletion policies can be specified here. The class must
implement org.apache.lucene.index.IndexDeletionPolicy.
- http://lucene.apache.org/java/3_5_0/api/core/org/apache/lucene/index/IndexDeletionPolicy.html
-
The default Solr IndexDeletionPolicy implementation supports
deleting index commit points on number of commits, age of
commit point and optimized status.
@@ -304,6 +301,16 @@
<!-- The default high-performance update handler -->
<updateHandler class="solr.DirectUpdateHandler2">
+ <!-- Enables a transaction log, used for real-time get, durability, and
+ and solr cloud replica recovery. The log can grow as big as
+ uncommitted changes to the index, so use of a hard autoCommit
+ is recommended (see below).
+ "dir" - the target directory for transaction logs, defaults to the
+ solr data directory. -->
+ <updateLog>
+ <str name="dir">${solr.ulog.dir:}</str>
+ </updateLog>
+
<!-- AutoCommit
Perform a hard commit automatically under certain conditions.
@@ -319,8 +326,11 @@
since a document was added before automaticly
triggering a new commit.
openSearcher - if false, the commit causes recent index changes
- to be flushed to stable storage, but does not cause a new
- searcher to be opened to make those changes visible.
+ to be flushed to stable storage, but does not cause a new
+ searcher to be opened to make those changes visible.
+
+ If the updateLog is enabled, then it's highly recommended to
+ have some sort of hard autoCommit to limit the log size.
-->
<autoCommit>
<maxTime>15000</maxTime>
@@ -370,14 +380,6 @@
</listener>
-->
- <!-- Enables a transaction log, currently used for real-time get.
- "dir" - the target directory for transaction logs, defaults to the
- solr data directory. -->
- <updateLog>
- <str name="dir">${solr.data.dir:}</str>
- </updateLog>
-
-
</updateHandler>
<!-- IndexReaderFactory
@@ -657,9 +659,14 @@
enableRemoteStreaming - enables use of the stream.file
and stream.url parameters for specifying remote streams.
- multipartUploadLimitInKB - specifies the max size of
+ multipartUploadLimitInKB - specifies the max size (in KiB) of
Multipart File Uploads that Solr will allow in a Request.
+ formdataUploadLimitInKB - specifies the max size (in KiB) of
+ form data (application/x-www-form-urlencoded) sent via
+ POST. You can use POST to pass request parameters not
+ fitting into the URL.
+
*** WARNING ***
The settings below authorize Solr to fetch remote files, You
should make sure your system has some authentication before
@@ -667,7 +674,8 @@
-->
<requestParsers enableRemoteStreaming="true"
- multipartUploadLimitInKB="2048000" />
+ multipartUploadLimitInKB="2048000"
+ formdataUploadLimitInKB="2048"/>
<!-- HTTP Caching
@@ -1338,7 +1346,7 @@
http://wiki.apache.org/solr/ClusteringComponent
- You'll need to set the solr.cluster.enabled system property
+ You'll need to set the solr.clustering.enabled system property
when running solr to run with clustering enabled:
java -Dsolr.clustering.enabled=true -jar start.jar
Modified: lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/velocity/head.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/velocity/head.vm?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/velocity/head.vm (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/velocity/head.vm Fri Jan 18 18:30:54 2013
@@ -20,7 +20,11 @@
'v.template': 'suggest'
}
}
- );
+ ).keydown(function(e){
+ if (e.keyCode === 13){
+ $("#query-form").trigger('submit');
+ }
+ });
// http://localhost:8983/solr/terms?terms.fl=name&terms.prefix=i&terms.sort=count
});
Modified: lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/velocity/jquery.autocomplete.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/velocity/jquery.autocomplete.js?rev=1435287&r1=1435286&r2=1435287&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/velocity/jquery.autocomplete.js (original)
+++ lucene/dev/branches/LUCENE-2878/solr/example/solr/collection1/conf/velocity/jquery.autocomplete.js Fri Jan 18 18:30:54 2013
@@ -325,6 +325,7 @@ $.Autocompleter = function(input, option
if (!options.matchCase)
term = term.toLowerCase();
var data = cache.load(term);
+ data = null; // Avoid buggy cache and go to Solr every time
// recieve the cached data
if (data && data.length) {
success(term, data);
@@ -398,7 +399,7 @@ $.Autocompleter.defaults = {
max: 100,
mustMatch: false,
extraParams: {},
- selectFirst: true,
+ selectFirst: false,
formatItem: function(row) { return row[0]; },
formatMatch: null,
autoFill: false,