You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ry...@apache.org on 2011/03/09 20:48:33 UTC
svn commit: r1079963 - in /lucene/dev/trunk/solr: ./
src/java/org/apache/solr/response/ src/test/org/apache/solr/
src/test/org/apache/solr/cloud/ src/test/org/apache/solr/core/
src/test/org/apache/solr/handler/ src/test/org/apache/solr/util/
Author: ryan
Date: Wed Mar 9 19:48:33 2011
New Revision: 1079963
URL: http://svn.apache.org/viewvc?rev=1079963&view=rev
Log:
SOLR-2413: Support for returning multi-valued fields w/o <arr> tag in the XMLResponseWriter was removed. XMLResponseWriter only no longer work with values less then 2.2
Replaced "version" string with CommonParams.VERSION where possible
Modified:
lucene/dev/trunk/solr/CHANGES.txt
lucene/dev/trunk/solr/src/java/org/apache/solr/response/XMLWriter.java
lucene/dev/trunk/solr/src/test/org/apache/solr/BasicFunctionalityTest.java
lucene/dev/trunk/solr/src/test/org/apache/solr/ConvertedLegacyTest.java
lucene/dev/trunk/solr/src/test/org/apache/solr/DisMaxRequestHandlerTest.java
lucene/dev/trunk/solr/src/test/org/apache/solr/EchoParamsTest.java
lucene/dev/trunk/solr/src/test/org/apache/solr/MinimalSchemaTest.java
lucene/dev/trunk/solr/src/test/org/apache/solr/OutputWriterTest.java
lucene/dev/trunk/solr/src/test/org/apache/solr/SampleTest.java
lucene/dev/trunk/solr/src/test/org/apache/solr/SolrTestCaseJ4.java
lucene/dev/trunk/solr/src/test/org/apache/solr/cloud/BasicZkTest.java
lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java
lucene/dev/trunk/solr/src/test/org/apache/solr/handler/TestCSVLoader.java
lucene/dev/trunk/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java
Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1079963&r1=1079962&r2=1079963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Wed Mar 9 19:48:33 2011
@@ -184,6 +184,11 @@ Other Changes
and load it back on init. This means that large tries don't have to be
rebuilt on every commit or core reload. (ab)
+* SOLR-2413: Support for returning multi-valued fields w/o <arr> tag
+ in the XMLResponseWriter was removed. XMLResponseWriter only
+ no longer work with values less then 2.2 (ryan)
+
+
Documentation
----------------------
Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/response/XMLWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/response/XMLWriter.java?rev=1079963&r1=1079962&r2=1079963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/response/XMLWriter.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/response/XMLWriter.java Wed Mar 9 19:48:33 2011
@@ -19,6 +19,7 @@ package org.apache.solr.response;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
+import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.XML;
@@ -76,9 +77,13 @@ public final class XMLWriter extends Tex
public XMLWriter(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) {
super(writer, req, rsp);
- String version = req.getParams().get("version");
+ String version = req.getParams().get(CommonParams.VERSION);
float ver = version==null? CURRENT_VERSION : Float.parseFloat(version);
this.version = (int)(ver*1000);
+ if( this.version < 2200 ) {
+ throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
+ "XMLWriter does not support version: "+version );
+ }
}
@@ -110,28 +115,6 @@ public final class XMLWriter extends Tex
int sz = lst.size();
int start=0;
- // special case the response header if the version is 2.1 or less
- if (version<=2100 && sz>0) {
- Object header = lst.getVal(0);
- if (header instanceof NamedList && "responseHeader".equals(lst.getName(0))) {
- writer.write("<responseHeader>");
- incLevel();
- NamedList nl = (NamedList)header;
- for (int i=0; i<nl.size(); i++) {
- String name = nl.getName(i);
- Object val = nl.getVal(i);
- if ("status".equals(name) || "QTime".equals(name)) {
- writePrim(name,null,val.toString(),false);
- } else {
- writeVal(name,val);
- }
- }
- decLevel();
- writer.write("</responseHeader>");
- start=1;
- }
- }
-
for (int i=start; i<sz; i++) {
writeVal(lst.getName(i),lst.getVal(i));
}
@@ -248,7 +231,7 @@ public final class XMLWriter extends Tex
}
if (fidx1+1 == fidx2) {
// single field value
- if (version>=2100 && sf.multiValued()) {
+ if (sf.multiValued()) {
startTag("arr",fname,false);
doIndent=false;
sf.write(this, null, f1);
@@ -301,7 +284,7 @@ public final class XMLWriter extends Tex
} else {
// single valued... figure out if we should put <arr> tags around it anyway
SchemaField sf = schema.getFieldOrNull(fname);
- if (version>=2100 && sf!=null && sf.multiValued()) {
+ if (sf!=null && sf.multiValued()) {
startTag("arr",fname,false);
doIndent=false;
writeVal(fname, val);
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/BasicFunctionalityTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/BasicFunctionalityTest.java?rev=1079963&r1=1079962&r2=1079963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/BasicFunctionalityTest.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/BasicFunctionalityTest.java Wed Mar 9 19:48:33 2011
@@ -100,7 +100,7 @@ public class BasicFunctionalityTest exte
@Test
public void testIgnoredFields() throws Exception {
- lrf.args.put("version","2.0");
+ lrf.args.put(CommonParams.VERSION,"2.2");
assertU("adding doc with ignored field",
adoc("id", "42", "foo_ignored", "blah blah"));
assertU("commit",
@@ -123,7 +123,7 @@ public class BasicFunctionalityTest exte
assertEquals("Mergefactor was not picked up", ((LogMergePolicy) writer.getConfig().getMergePolicy()).getMergeFactor(), 8);
writer.close();
- lrf.args.put("version","2.0");
+ lrf.args.put(CommonParams.VERSION,"2.2");
assertQ("test query on empty index",
req("qlkciyopsbgzyvkylsjhchghjrdf")
,"//result[@numFound='0']"
@@ -445,7 +445,7 @@ public class BasicFunctionalityTest exte
@Test
public void testDefaultFieldValues() {
clearIndex();
- lrf.args.put("version","2.1");
+ lrf.args.put(CommonParams.VERSION,"2.2");
assertU(adoc("id", "4055",
"subject", "Hoss the Hoss man Hostetter"));
assertU(adoc("id", "4056",
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/ConvertedLegacyTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/ConvertedLegacyTest.java?rev=1079963&r1=1079962&r2=1079963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/ConvertedLegacyTest.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/ConvertedLegacyTest.java Wed Mar 9 19:48:33 2011
@@ -17,6 +17,7 @@
package org.apache.solr;
+import org.apache.solr.common.params.CommonParams;
import org.apache.solr.request.*;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -42,7 +43,7 @@ public class ConvertedLegacyTest extends
// these may be reused by things that need a special query
SolrQueryRequest req = null;
Map<String,String> args = new HashMap<String,String>();
- lrf.args.put("version","2.0");
+ lrf.args.put(CommonParams.VERSION,"2.2");
lrf.args.put("defType","lucenePlusSort");
// compact the index, keep things from getting out of hand
@@ -133,7 +134,6 @@ public class ConvertedLegacyTest extends
,"//*[@start='0']"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z]",
"standard", 2, 5 , args);
assertQ(req
@@ -143,7 +143,6 @@ public class ConvertedLegacyTest extends
,"//*[@start='2']"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z]",
"standard", 3, 5 , args);
assertQ(req
@@ -151,7 +150,6 @@ public class ConvertedLegacyTest extends
,"*[count(//doc)=0]"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z]",
"standard", 4, 5 , args);
assertQ(req
@@ -159,7 +157,6 @@ public class ConvertedLegacyTest extends
,"*[count(//doc)=0]"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z]",
"standard", 25, 5 , args);
assertQ(req
@@ -167,7 +164,6 @@ public class ConvertedLegacyTest extends
,"*[count(//doc)=0]"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z]",
"standard", 0, 1 , args);
assertQ(req
@@ -176,7 +172,6 @@ public class ConvertedLegacyTest extends
,"*//doc[1]/str[.='apple']"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z]",
"standard", 0, 2 , args);
assertQ(req
@@ -185,7 +180,6 @@ public class ConvertedLegacyTest extends
,"*//doc[2]/str[.='banana']"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z]",
"standard", 1, 1 , args);
assertQ(req
@@ -194,7 +188,6 @@ public class ConvertedLegacyTest extends
,"*//doc[1]/str[.='banana']"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z]",
"standard", 3, 1 , args);
assertQ(req
@@ -202,7 +195,6 @@ public class ConvertedLegacyTest extends
,"*[count(//doc)=0]"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z]",
"standard", 4, 1 , args);
assertQ(req
@@ -210,7 +202,6 @@ public class ConvertedLegacyTest extends
,"*[count(//doc)=0]"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z]",
"standard", 1, 0 , args);
assertQ(req
@@ -218,7 +209,6 @@ public class ConvertedLegacyTest extends
,"*[count(//doc)=0]"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z]",
"standard", 0, 0 , args);
assertQ(req
@@ -226,7 +216,6 @@ public class ConvertedLegacyTest extends
,"*[count(//doc)=0]"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
args.put("defType","lucenePlusSort");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z];val_s1 asc",
"standard", 0, 0 , args);
@@ -235,7 +224,6 @@ public class ConvertedLegacyTest extends
,"*[count(//doc)=0]"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
args.put("defType","lucenePlusSort");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z];val_s1 desc",
"standard", 0, 0 , args);
@@ -480,13 +468,13 @@ public class ConvertedLegacyTest extends
assertQ(req("id:44")
,"*[count(//doc/*)>=3] "
- ,"//int[@name='gack_i'][.='51778'] "
- ,"//str[@name='t_name'][.='cats']"
+ ,"//arr[@name='gack_i']/int[.='51778'] "
+ ,"//arr[@name='t_name']/str[.='cats']"
);
// now test if we can query by a dynamic field (requires analyzer support)
assertQ(req("t_name:cat")
- ,"//str[@name='t_name' and .='cats']"
+ ,"//arr[@name='t_name' and .='cats']/str"
);
// check that deleteByQuery works for dynamic fields
@@ -501,8 +489,8 @@ public class ConvertedLegacyTest extends
assertU("<add><doc><field name=\"id\">44</field><field name=\"xaa\">mystr</field><field name=\"xaaa\">12321</field></doc></add>");
assertU("<commit/>");
assertQ(req("id:44")
- ,"//str[@name='xaa'][.='mystr'] "
- ,"//int[@name='xaaa'][.='12321']"
+ ,"//arr[@name='xaa'][.='mystr']/str "
+ ,"//arr[@name='xaaa'][.='12321']/int"
);
@@ -761,28 +749,28 @@ public class ConvertedLegacyTest extends
);
assertQ(req("id_i:[1000 TO 1010]; a_i1 asc,b_si desc")
,"*[count(//doc)=7] "
- ,"//doc[3]/int[.='100'] "
- ,"//doc[4]/int[.='50'] "
- ,"//doc[5]/int[.='1000']"
+ ,"//doc[3]/int[@name='b_si' and .='100'] "
+ ,"//doc[4]/int[@name='b_si' and .='50'] "
+ ,"//doc[5]/arr[@name='id_i' and .='1000']"
);
assertQ(req("id_i:[1000 TO 1010]; a_i1 asc,b_si asc")
,"*[count(//doc)=7] "
- ,"//doc[3]/int[.='50'] "
- ,"//doc[4]/int[.='100'] "
- ,"//doc[5]/int[.='1000']"
+ ,"//doc[3]/int[@name='b_si' and .='50'] "
+ ,"//doc[4]/int[@name='b_si' and .='100'] "
+ ,"//doc[5]/arr[@name='id_i' and .='1000']"
);
// nullfirst tests
assertQ(req("id_i:[1000 TO 1002]; nullfirst asc")
,"*[count(//doc)=3] "
- ,"//doc[1]/int[.='1002']"
- ,"//doc[2]/int[.='1001'] "
- ,"//doc[3]/int[.='1000']"
+ ,"//doc[1]/arr[@name='id_i' and .='1002']"
+ ,"//doc[2]/arr[@name='id_i' and .='1001'] "
+ ,"//doc[3]/arr[@name='id_i' and .='1000']"
);
assertQ(req("id_i:[1000 TO 1002]; nullfirst desc")
,"*[count(//doc)=3] "
- ,"//doc[1]/int[.='1002']"
- ,"//doc[2]/int[.='1000'] "
- ,"//doc[3]/int[.='1001']"
+ ,"//doc[1]/arr[@name='id_i' and .='1002']"
+ ,"//doc[2]/arr[@name='id_i' and .='1000'] "
+ ,"//doc[3]/arr[@name='id_i' and .='1001']"
);
ignoreException("shouldbeunindexed");
@@ -1126,7 +1114,6 @@ public class ConvertedLegacyTest extends
assertQ(req("id:44")
);
args = new HashMap<String,String>();
- args.put("version","2.0");
args.put("fl","fname_s,arr_f ");
req = new LocalSolrQueryRequest(h.getCore(), "id:44",
"standard", 0, 10, args);
@@ -1135,7 +1122,6 @@ public class ConvertedLegacyTest extends
,"//float[.='1.4142135']"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
args.put("fl"," ");
req = new LocalSolrQueryRequest(h.getCore(), "id:44",
"standard", 0, 10, args);
@@ -1147,7 +1133,6 @@ public class ConvertedLegacyTest extends
// test addition of score field
args = new HashMap<String,String>();
- args.put("version","2.0");
args.put("fl","score ");
req = new LocalSolrQueryRequest(h.getCore(), "id:44",
"standard", 0, 10, args);
@@ -1158,7 +1143,6 @@ public class ConvertedLegacyTest extends
,"*[count(//doc/*)>=13]"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
args.put("fl","*,score ");
req = new LocalSolrQueryRequest(h.getCore(), "id:44",
"standard", 0, 10, args);
@@ -1169,7 +1153,6 @@ public class ConvertedLegacyTest extends
,"*[count(//doc/*)>=13]"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
args.put("fl","* ");
req = new LocalSolrQueryRequest(h.getCore(), "id:44",
"standard", 0, 10, args);
@@ -1182,7 +1165,6 @@ public class ConvertedLegacyTest extends
// test maxScore
args = new HashMap<String,String>();
- args.put("version","2.0");
args.put("fl","score ");
req = new LocalSolrQueryRequest(h.getCore(), "id:44",
"standard", 0, 10, args);
@@ -1190,7 +1172,6 @@ public class ConvertedLegacyTest extends
,"//result[@maxScore>0]"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
args.put("fl","score ");
args.put("defType","lucenePlusSort");
req = new LocalSolrQueryRequest(h.getCore(), "id:44;id desc;",
@@ -1199,7 +1180,6 @@ public class ConvertedLegacyTest extends
,"//result[@maxScore>0]"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
args.put("fl","score ");
args.put("defType","lucenePlusSort");
req = new LocalSolrQueryRequest(h.getCore(), "id:44;",
@@ -1208,7 +1188,6 @@ public class ConvertedLegacyTest extends
,"//@maxScore = //doc/float[@name='score']"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
args.put("fl","score ");
args.put("defType","lucenePlusSort");
req = new LocalSolrQueryRequest(h.getCore(), "id:44;id desc;",
@@ -1217,7 +1196,6 @@ public class ConvertedLegacyTest extends
,"//@maxScore = //doc/float[@name='score']"
);
args = new HashMap<String,String>();
- args.put("version","2.0");
args.put("fl","score");
args.put("defType","lucenePlusSort");
req = new LocalSolrQueryRequest(h.getCore(), "id:44;id desc;",
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/DisMaxRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/DisMaxRequestHandlerTest.java?rev=1079963&r1=1079962&r2=1079963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/DisMaxRequestHandlerTest.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/DisMaxRequestHandlerTest.java Wed Mar 9 19:48:33 2011
@@ -32,7 +32,7 @@ public class DisMaxRequestHandlerTest ex
initCore("solrconfig.xml","schema.xml");
lrf = h.getRequestFactory
("dismax", 0, 20,
- "version","2.0",
+ CommonParams.VERSION,"2.2",
"facet", "true",
"facet.field","t_s"
);
@@ -94,7 +94,7 @@ public class DisMaxRequestHandlerTest ex
assertQ("multi qf",
req("q", "cool"
,"qt", qt
- ,"version", "2.0"
+ ,CommonParams.VERSION, "2.2"
,"qf", "subject"
,"qf", "features_t"
)
@@ -104,7 +104,7 @@ public class DisMaxRequestHandlerTest ex
assertQ("boost query",
req("q", "cool stuff"
,"qt", qt
- ,"version", "2.0"
+ ,CommonParams.VERSION, "2.2"
,"bq", "subject:hell^400"
)
,"//*[@numFound='3']"
@@ -116,7 +116,7 @@ public class DisMaxRequestHandlerTest ex
assertQ("multi boost query",
req("q", "cool stuff"
,"qt", qt
- ,"version", "2.0"
+ ,CommonParams.VERSION, "2.2"
,"bq", "subject:hell^400"
,"bq", "subject:cool^4"
, CommonParams.DEBUG_QUERY, "true"
@@ -176,7 +176,7 @@ public class DisMaxRequestHandlerTest ex
Pattern p_bool = Pattern.compile("\\(subject:hell\\s*subject:cool\\)");
String resp = h.query(req("q", "cool stuff"
,"qt", "dismax"
- ,"version", "2.0"
+ ,CommonParams.VERSION, "2.2"
,"bq", "subject:hell OR subject:cool"
,CommonParams.DEBUG_QUERY, "true"
));
@@ -185,7 +185,7 @@ public class DisMaxRequestHandlerTest ex
resp = h.query(req("q", "cool stuff"
,"qt", "dismax"
- ,"version", "2.0"
+ ,CommonParams.VERSION, "2.2"
,"bq", "subject:hell OR subject:cool"
,"bq",""
,CommonParams.DEBUG_QUERY, "true"
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/EchoParamsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/EchoParamsTest.java?rev=1079963&r1=1079962&r2=1079963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/EchoParamsTest.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/EchoParamsTest.java Wed Mar 9 19:48:33 2011
@@ -17,6 +17,7 @@
package org.apache.solr;
+import org.apache.solr.common.params.CommonParams;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -34,7 +35,7 @@ public class EchoParamsTest extends Solr
@Test
public void testDefaultEchoParams() {
lrf.args.put("wt", "xml");
- lrf.args.put("version", "2.2");
+ lrf.args.put(CommonParams.VERSION, "2.2");
assertQ(req("foo"),HEADER_XPATH + "/int[@name='status']");
assertQ(req("foo"),"not(//lst[@name='params'])");
}
@@ -42,7 +43,7 @@ public class EchoParamsTest extends Solr
@Test
public void testDefaultEchoParamsDefaultVersion() {
lrf.args.put("wt", "xml");
- lrf.args.remove("version");
+ lrf.args.remove(CommonParams.VERSION);
assertQ(req("foo"),HEADER_XPATH + "/int[@name='status']");
assertQ(req("foo"),"not(//lst[@name='params'])");
}
@@ -50,7 +51,7 @@ public class EchoParamsTest extends Solr
@Test
public void testExplicitEchoParams() {
lrf.args.put("wt", "xml");
- lrf.args.put("version", "2.2");
+ lrf.args.put(CommonParams.VERSION, "2.2");
lrf.args.put("echoParams", "explicit");
assertQ(req("foo"),HEADER_XPATH + "/int[@name='status']");
assertQ(req("foo"),HEADER_XPATH + "/lst[@name='params']");
@@ -61,7 +62,7 @@ public class EchoParamsTest extends Solr
public void testAllEchoParams() {
lrf = h.getRequestFactory
("crazy_custom_qt", 0, 20,
- "version","2.2",
+ CommonParams.VERSION,"2.2",
"wt","xml",
"echoParams", "all",
"echoHandler","true"
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/MinimalSchemaTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/MinimalSchemaTest.java?rev=1079963&r1=1079962&r2=1079963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/MinimalSchemaTest.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/MinimalSchemaTest.java Wed Mar 9 19:48:33 2011
@@ -17,6 +17,7 @@
package org.apache.solr;
+import org.apache.solr.common.params.CommonParams;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -44,7 +45,7 @@ public class MinimalSchemaTest extends S
assertNull("UniqueKey Field isn't null",
h.getCore().getSchema().getUniqueKeyField());
- lrf.args.put("version","2.0");
+ lrf.args.put(CommonParams.VERSION,"2.2");
assertNull("Simple assertion that adding a document works", h.validateUpdate(
adoc("id", "4055",
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/OutputWriterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/OutputWriterTest.java?rev=1079963&r1=1079962&r2=1079963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/OutputWriterTest.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/OutputWriterTest.java Wed Mar 9 19:48:33 2011
@@ -20,6 +20,7 @@ package org.apache.solr;
import java.io.IOException;
import java.io.Writer;
+import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.QueryResponseWriter;
@@ -42,25 +43,21 @@ public class OutputWriterTest extends So
}
- /** responseHeader has changed in SOLR-59, check old and new variants */
+ /**
+ * responseHeader has changed in SOLR-59, check old and new variants,
+ * In SOLR-2413, we removed support for the deprecated versions
+ */
@Test
public void testSOLR59responseHeaderVersions() {
// default version is 2.2, with "new" responseHeader
- lrf.args.remove("version");
+ lrf.args.remove(CommonParams.VERSION);
lrf.args.put("wt", "standard");
assertQ(req("foo"), "/response/lst[@name='responseHeader']/int[@name='status'][.='0']");
lrf.args.remove("wt");
assertQ(req("foo"), "/response/lst[@name='responseHeader']/int[@name='QTime']");
- // version=2.1 reverts to old responseHeader
- lrf.args.put("version", "2.1");
- lrf.args.put("wt", "standard");
- assertQ(req("foo"), "/response/responseHeader/status[.='0']");
- lrf.args.remove("wt");
- assertQ(req("foo"), "/response/responseHeader/QTime");
-
// and explicit 2.2 works as default
- lrf.args.put("version", "2.2");
+ //lrf.args.put("version", "2.2");
lrf.args.put("wt", "standard");
assertQ(req("foo"), "/response/lst[@name='responseHeader']/int[@name='status'][.='0']");
lrf.args.remove("wt");
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/SampleTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/SampleTest.java?rev=1079963&r1=1079962&r2=1079963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/SampleTest.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/SampleTest.java Wed Mar 9 19:48:33 2011
@@ -17,6 +17,7 @@
package org.apache.solr;
+import org.apache.solr.common.params.CommonParams;
import org.apache.solr.request.*;
import org.apache.solr.util.*;
import org.junit.BeforeClass;
@@ -46,7 +47,7 @@ public class SampleTest extends SolrTest
*/
@Test
public void testSimple() {
- lrf.args.put("version","2.0");
+ lrf.args.put(CommonParams.VERSION,"2.2");
assertU("Simple assertion that adding a document works",
adoc("id", "4055",
"subject", "Hoss the Hoss man Hostetter"));
@@ -70,7 +71,7 @@ public class SampleTest extends SolrTest
*/
@Test
public void testAdvanced() throws Exception {
- lrf.args.put("version","2.0");
+ lrf.args.put(CommonParams.VERSION,"2.2");
assertU("less common case, a complex addition with options",
add(doc("id", "4059",
"subject", "Who Me?"),
@@ -102,7 +103,7 @@ public class SampleTest extends SolrTest
* Note: the qt proves we are using our custom config...
*/
TestHarness.LocalRequestFactory l = h.getRequestFactory
- ("crazy_custom_qt",100,200,"version","2.1");
+ ("crazy_custom_qt",100,200,CommonParams.VERSION,"2.2");
assertQ("how did i find Mack Daddy? ",
l.makeRequest( "Mack Daddy" )
,"//result[@numFound=0]"
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/SolrTestCaseJ4.java?rev=1079963&r1=1079962&r2=1079963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/SolrTestCaseJ4.java Wed Mar 9 19:48:33 2011
@@ -26,6 +26,7 @@ import org.apache.noggit.ObjectBuilder;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.SolrInputField;
+import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.XML;
@@ -238,7 +239,7 @@ public abstract class SolrTestCaseJ4 ext
solrConfig,
getSchemaFile());
lrf = h.getRequestFactory
- ("standard",0,20,"version","2.2");
+ ("standard",0,20,CommonParams.VERSION,"2.2");
}
log.info("####initCore end");
}
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/cloud/BasicZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/cloud/BasicZkTest.java?rev=1079963&r1=1079962&r2=1079963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/cloud/BasicZkTest.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/cloud/BasicZkTest.java Wed Mar 9 19:48:33 2011
@@ -18,6 +18,7 @@ package org.apache.solr.cloud;
*/
import org.apache.lucene.index.LogMergePolicy;
+import org.apache.solr.common.params.CommonParams;
import org.apache.solr.core.SolrCore;
import org.apache.solr.update.SolrIndexWriter;
@@ -50,7 +51,7 @@ public class BasicZkTest extends Abstrac
assertEquals("Mergefactor was not picked up", ((LogMergePolicy)writer.getConfig().getMergePolicy()).getMergeFactor(), 8);
writer.close();
- lrf.args.put("version", "2.0");
+ lrf.args.put(CommonParams.VERSION, "2.2");
assertQ("test query on empty index", req("qlkciyopsbgzyvkylsjhchghjrdf"),
"//result[@numFound='0']");
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java?rev=1079963&r1=1079962&r2=1079963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java Wed Mar 9 19:48:33 2011
@@ -32,6 +32,7 @@ import org.apache.lucene.queryParser.Par
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.Version;
import org.apache.solr.common.SolrException;
+import org.apache.solr.common.params.CommonParams;
import org.apache.solr.util.AbstractSolrTestCase;
import org.apache.solr.util.TestHarness;
import org.junit.Test;
@@ -56,7 +57,7 @@ public class TestArbitraryIndexDir exten
solrConfig,
"schema12.xml");
lrf = h.getRequestFactory
- ("standard",0,20,"version","2.2");
+ ("standard",0,20,CommonParams.VERSION,"2.2");
}
@Override
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/handler/TestCSVLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/handler/TestCSVLoader.java?rev=1079963&r1=1079962&r2=1079963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/handler/TestCSVLoader.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/handler/TestCSVLoader.java Wed Mar 9 19:48:33 2011
@@ -19,6 +19,7 @@ package org.apache.solr.handler;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.request.LocalSolrQueryRequest;
+import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.util.ContentStream;
import org.apache.solr.common.util.ContentStreamBase;
import org.junit.After;
@@ -121,12 +122,12 @@ public class TestCSVLoader extends SolrT
@Test
public void testCSV() throws Exception {
- lrf.args.put("version","2.0");
+ lrf.args.put(CommonParams.VERSION,"2.2");
makeFile("id,str_s\n100,\"quoted\"\n101,\n102,\"\"\n103,");
loadLocal("stream.file",filename,"commit","true");
assertQ(req("id:[100 TO 110]"),"//*[@numFound='4']");
- assertQ(req("id:100"),"//str[@name='str_s'][.='quoted']");
+ assertQ(req("id:100"),"//arr[@name='str_s']/str[.='quoted']");
assertQ(req("id:101"),"count(//str[@name='str_s'])=0");
// 102 is a quoted zero length field ,"", as opposed to ,,
// but we can't distinguish this case (and it's debateable
@@ -154,7 +155,7 @@ public class TestCSVLoader extends SolrT
// test global value mapping
loadLocal("stream.file",filename, "commit","true", "map","quoted:QUOTED");
assertQ(req("id:[100 TO 110]"),"//*[@numFound='4']");
- assertQ(req("id:100"),"//str[@name='str_s'][.='QUOTED']");
+ assertQ(req("id:100"),"//arr[@name='str_s']/str[.='QUOTED']");
assertQ(req("id:101"),"count(//str[@name='str_s'])=0");
assertQ(req("id:102"),"count(//str[@name='str_s'])=0");
assertQ(req("id:103"),"count(//str[@name='str_s'])=0");
@@ -167,39 +168,39 @@ public class TestCSVLoader extends SolrT
// test value mapping from empty
loadLocal("stream.file",filename, "commit","true", "map",":EMPTY");
assertQ(req("id:[100 TO 110]"),"//*[@numFound='4']");
- assertQ(req("id:100"),"//str[@name='str_s'][.='quoted']");
- assertQ(req("id:101"),"//str[@name='str_s'][.='EMPTY']");
- assertQ(req("id:102"),"//str[@name='str_s'][.='EMPTY']");
- assertQ(req("id:103"),"//str[@name='str_s'][.='EMPTY']");
+ assertQ(req("id:100"),"//arr[@name='str_s']/str[.='quoted']");
+ assertQ(req("id:101"),"//arr[@name='str_s']/str[.='EMPTY']");
+ assertQ(req("id:102"),"//arr[@name='str_s']/str[.='EMPTY']");
+ assertQ(req("id:103"),"//arr[@name='str_s']/str[.='EMPTY']");
// test multiple map rules
loadLocal("stream.file",filename, "commit","true", "map",":EMPTY", "map","quoted:QUOTED");
assertQ(req("id:[100 TO 110]"),"//*[@numFound='4']");
- assertQ(req("id:100"),"//str[@name='str_s'][.='QUOTED']");
- assertQ(req("id:101"),"//str[@name='str_s'][.='EMPTY']");
- assertQ(req("id:102"),"//str[@name='str_s'][.='EMPTY']");
- assertQ(req("id:103"),"//str[@name='str_s'][.='EMPTY']");
+ assertQ(req("id:100"),"//arr[@name='str_s']/str[.='QUOTED']");
+ assertQ(req("id:101"),"//arr[@name='str_s']/str[.='EMPTY']");
+ assertQ(req("id:102"),"//arr[@name='str_s']/str[.='EMPTY']");
+ assertQ(req("id:103"),"//arr[@name='str_s']/str[.='EMPTY']");
// test indexing empty fields
loadLocal("stream.file",filename, "commit","true", "f.str_s.keepEmpty","true");
assertQ(req("id:[100 TO 110]"),"//*[@numFound='4']");
- assertQ(req("id:100"),"//str[@name='str_s'][.='quoted']");
- assertQ(req("id:101"),"//str[@name='str_s'][.='']");
- assertQ(req("id:102"),"//str[@name='str_s'][.='']");
- assertQ(req("id:103"),"//str[@name='str_s'][.='']");
+ assertQ(req("id:100"),"//arr[@name='str_s']/str[.='quoted']");
+ assertQ(req("id:101"),"//arr[@name='str_s']/str[.='']");
+ assertQ(req("id:102"),"//arr[@name='str_s']/str[.='']");
+ assertQ(req("id:103"),"//arr[@name='str_s']/str[.='']");
// test overriding the name of fields
loadLocal("stream.file",filename, "commit","true",
"fieldnames","id,my_s", "header","true",
"f.my_s.map",":EMPTY");
assertQ(req("id:[100 TO 110]"),"//*[@numFound='4']");
- assertQ(req("id:100"),"//str[@name='my_s'][.='quoted']");
- assertQ(req("id:101"),"count(//str[@name='str_s'])=0");
- assertQ(req("id:102"),"count(//str[@name='str_s'])=0");
- assertQ(req("id:103"),"count(//str[@name='str_s'])=0");
- assertQ(req("id:101"),"//str[@name='my_s'][.='EMPTY']");
- assertQ(req("id:102"),"//str[@name='my_s'][.='EMPTY']");
- assertQ(req("id:103"),"//str[@name='my_s'][.='EMPTY']");
+ assertQ(req("id:100"),"//arr[@name='my_s']/str[.='quoted']");
+ assertQ(req("id:101"),"count(//arr[@name='str_s']/str)=0");
+ assertQ(req("id:102"),"count(//arr[@name='str_s']/str)=0");
+ assertQ(req("id:103"),"count(//arr[@name='str_s']/str)=0");
+ assertQ(req("id:101"),"//arr[@name='my_s']/str[.='EMPTY']");
+ assertQ(req("id:102"),"//arr[@name='my_s']/str[.='EMPTY']");
+ assertQ(req("id:103"),"//arr[@name='my_s']/str[.='EMPTY']");
// test that header in file was skipped
assertQ(req("id:id"),"//*[@numFound='0']");
@@ -207,24 +208,24 @@ public class TestCSVLoader extends SolrT
// test skipping a field via the "skip" parameter
loadLocal("stream.file",filename,"commit","true","keepEmpty","true","skip","str_s");
assertQ(req("id:[100 TO 110]"),"//*[@numFound='4']");
- assertQ(req("id:[100 TO 110]"),"count(//str[@name='str_s'])=0");
+ assertQ(req("id:[100 TO 110]"),"count(//str[@name='str_s']/str)=0");
// test skipping a field by specifying an empty name
loadLocal("stream.file",filename,"commit","true","keepEmpty","true","fieldnames","id,");
assertQ(req("id:[100 TO 110]"),"//*[@numFound='4']");
- assertQ(req("id:[100 TO 110]"),"count(//str[@name='str_s'])=0");
+ assertQ(req("id:[100 TO 110]"),"count(//str[@name='str_s']/str)=0");
// test loading file as if it didn't have a header
loadLocal("stream.file",filename, "commit","true",
"fieldnames","id,my_s", "header","false");
assertQ(req("id:id"),"//*[@numFound='1']");
- assertQ(req("id:100"),"//str[@name='my_s'][.='quoted']");
+ assertQ(req("id:100"),"//arr[@name='my_s']/str[.='quoted']");
// test skipLines
loadLocal("stream.file",filename, "commit","true",
"fieldnames","id,my_s", "header","false", "skipLines","1");
assertQ(req("id:id"),"//*[@numFound='1']");
- assertQ(req("id:100"),"//str[@name='my_s'][.='quoted']");
+ assertQ(req("id:100"),"//arr[@name='my_s']/str[.='quoted']");
// test multi-valued fields via field splitting w/ mapping of subvalues
@@ -237,12 +238,12 @@ public class TestCSVLoader extends SolrT
"f.str_s.map",":EMPTY",
"f.str_s.split","true");
assertQ(req("id:[100 TO 110]"),"//*[@numFound='4']");
- assertQ(req("id:100"),"//str[@name='str_s'][.='quoted']");
+ assertQ(req("id:100"),"//arr[@name='str_s']/str[.='quoted']");
assertQ(req("id:101"),"//arr[@name='str_s']/str[1][.='a']");
assertQ(req("id:101"),"//arr[@name='str_s']/str[2][.='b']");
assertQ(req("id:101"),"//arr[@name='str_s']/str[3][.='c']");
assertQ(req("id:102"),"//arr[@name='str_s']/str[2][.='EMPTY']");
- assertQ(req("id:103"),"//str[@name='str_s'][.='EMPTY']");
+ assertQ(req("id:103"),"//arr[@name='str_s']/str[.='EMPTY']");
// test alternate values for delimiters
@@ -263,13 +264,13 @@ public class TestCSVLoader extends SolrT
"f.str_s.encapsulator","'"
);
assertQ(req("id:[100 TO 110]"),"//*[@numFound='5']");
- assertQ(req("id:100"),"//str[@name='str_s'][.='quoted']");
+ assertQ(req("id:100"),"//arr[@name='str_s']/str[.='quoted']");
assertQ(req("id:101"),"//arr[@name='str_s']/str[1][.='a']");
assertQ(req("id:101"),"//arr[@name='str_s']/str[2][.='b']");
assertQ(req("id:101"),"//arr[@name='str_s']/str[3][.='c']");
assertQ(req("id:102"),"//arr[@name='str_s']/str[2][.='EMPTY']");
- assertQ(req("id:103"),"//str[@name='str_s'][.='EMPTY']");
- assertQ(req("id:104"),"//str[@name='str_s'][.='a\\\\b']");
+ assertQ(req("id:103"),"//arr[@name='str_s']/str[.='EMPTY']");
+ assertQ(req("id:104"),"//arr[@name='str_s']/str[.='a\\\\b']");
// test no escaping + double encapsulator escaping by default
makeFile("id,str_s\n"
@@ -279,9 +280,9 @@ public class TestCSVLoader extends SolrT
);
loadLocal("stream.file",filename, "commit","true"
);
- assertQ(req("id:100"),"//str[@name='str_s'][.='quoted \" \\ string']");
- assertQ(req("id:101"),"//str[@name='str_s'][.='unquoted \"\" \\ string']");
- assertQ(req("id:102"),"//str[@name='str_s'][.='end quote \\']");
+ assertQ(req("id:100"),"//arr[@name='str_s']/str[.='quoted \" \\ string']");
+ assertQ(req("id:101"),"//arr[@name='str_s']/str[.='unquoted \"\" \\ string']");
+ assertQ(req("id:102"),"//arr[@name='str_s']/str[.='end quote \\']");
// setting an escape should disable encapsulator
@@ -292,8 +293,8 @@ public class TestCSVLoader extends SolrT
loadLocal("stream.file",filename, "commit","true"
,"escape","\\"
);
- assertQ(req("id:100"),"//str[@name='str_s'][.='\"quoted \"\" \" \\ string\"']");
- assertQ(req("id:101"),"//str[@name='str_s'][.='unquoted \"\" \" , \\ string']");
+ assertQ(req("id:100"),"//arr[@name='str_s']/str[.='\"quoted \"\" \" \\ string\"']");
+ assertQ(req("id:101"),"//arr[@name='str_s']/str[.='unquoted \"\" \" , \\ string']");
}
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java?rev=1079963&r1=1079962&r2=1079963&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java Wed Mar 9 19:48:33 2011
@@ -25,6 +25,7 @@ import org.apache.solr.core.SolrConfig;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.SolrInputField;
+import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.util.XML;
import org.apache.solr.request.*;
import org.apache.solr.util.TestHarness;
@@ -132,7 +133,7 @@ public abstract class AbstractSolrTestCa
solrConfig,
getSchemaFile());
lrf = h.getRequestFactory
- ("standard",0,20,"version","2.2");
+ ("standard",0,20,CommonParams.VERSION,"2.2");
}
log.info("####SETUP_END " + getName());
}