You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2011/12/16 01:01:38 UTC
svn commit: r1214997 - in /lucene/dev/trunk/solr/core/src:
java/org/apache/solr/handler/component/
java/org/apache/solr/response/transform/ test-files/solr/conf/
test/org/apache/solr/handler/component/
Author: hossman
Date: Fri Dec 16 00:01:38 2011
New Revision: 1214997
URL: http://svn.apache.org/viewvc?rev=1214997&view=rev
Log:
SOLR-1520: revert r1214937 as it breaks several tests
Modified:
lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/transform/EditorialMarkerFactory.java
lucene/dev/trunk/solr/core/src/test-files/solr/conf/elevate.xml
lucene/dev/trunk/solr/core/src/test-files/solr/conf/solrconfig.xml
lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java?rev=1214997&r1=1214996&r2=1214997&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java Fri Dec 16 00:01:38 2011
@@ -157,9 +157,9 @@ public class QueryElevationComponent ext
}
SchemaField sf = core.getSchema().getUniqueKeyField();
- if( sf == null) {
+ if( sf == null || sf.getType().isTokenized() == true) {
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,
- "QueryElevationComponent requires the schema to have a uniqueKeyField." );
+ "QueryElevationComponent requires the schema to have a uniqueKeyField implemented using a non-tokenized field" );
}
idSchemaFT = sf.getType();
idField = sf.getName();
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/transform/EditorialMarkerFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/transform/EditorialMarkerFactory.java?rev=1214997&r1=1214996&r2=1214997&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/transform/EditorialMarkerFactory.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/response/transform/EditorialMarkerFactory.java Fri Dec 16 00:01:38 2011
@@ -20,12 +20,9 @@ package org.apache.solr.response.transfo
import java.util.Set;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.NumericField;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.schema.FieldType;
-import org.apache.solr.schema.SchemaField;
/**
*
@@ -35,9 +32,8 @@ public class EditorialMarkerFactory exte
{
@Override
public DocTransformer create(String field, SolrParams params, SolrQueryRequest req) {
- SchemaField uniqueKeyField = req.getSchema().getUniqueKeyField();
- String idfield = uniqueKeyField.getName();
- return new MarkTransformer(field,idfield, uniqueKeyField.getType());
+ String idfield = req.getSchema().getUniqueKeyField().getName();
+ return new MarkTransformer(field,idfield);
}
}
@@ -45,13 +41,11 @@ class MarkTransformer extends Transforme
{
final String name;
final String idFieldName;
- final FieldType ft;
- public MarkTransformer( String name, String idFieldName, FieldType ft)
+ public MarkTransformer( String name, String idFieldName)
{
this.name = name;
this.idFieldName = idFieldName;
- this.ft = ft;
}
@Override
@@ -66,15 +60,11 @@ class MarkTransformer extends Transforme
if(ids!=null) {
String key;
Object field = doc.get(idFieldName);
- if (field instanceof NumericField){
- key = ((Field)field).stringValue();
- key = ft.readableToIndexed(key);
- } else if (field instanceof Field){
+ if (field instanceof Field){
key = ((Field)field).stringValue();
} else {
key = field.toString();
}
-
doc.setField(name, ids.contains(key));
} else {
//if we have no ids, that means we weren't boosting, but the user still asked for the field to be added, so just mark everything as false
Modified: lucene/dev/trunk/solr/core/src/test-files/solr/conf/elevate.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test-files/solr/conf/elevate.xml?rev=1214997&r1=1214996&r2=1214997&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test-files/solr/conf/elevate.xml (original)
+++ lucene/dev/trunk/solr/core/src/test-files/solr/conf/elevate.xml Fri Dec 16 00:01:38 2011
@@ -34,7 +34,7 @@
</query>
<query text="AAAA">
- <doc id="7" />
+ <doc id="7.0" />
</query>
Modified: lucene/dev/trunk/solr/core/src/test-files/solr/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test-files/solr/conf/solrconfig.xml?rev=1214997&r1=1214996&r2=1214997&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test-files/solr/conf/solrconfig.xml (original)
+++ lucene/dev/trunk/solr/core/src/test-files/solr/conf/solrconfig.xml Fri Dec 16 00:01:38 2011
@@ -425,20 +425,6 @@
</arr>
</requestHandler>
- <!-- test elevation -->
- <searchComponent name="elevate" class="org.apache.solr.handler.component.QueryElevationComponent" >
- <str name="queryFieldType">string</str>
- <str name="config-file">${elevate.file:elevate.xml}</str>
- </searchComponent>
-
- <requestHandler name="/elevate" class="org.apache.solr.handler.component.SearchHandler">
- <lst name="defaults">
- <str name="echoParams">explicit</str>
- </lst>
- <arr name="last-components">
- <str>elevate</str>
- </arr>
- </requestHandler>
<searchComponent name="tvComponent" class="org.apache.solr.handler.component.TermVectorComponent"/>
Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java?rev=1214997&r1=1214996&r2=1214997&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java Fri Dec 16 00:01:38 2011
@@ -53,11 +53,6 @@ public class QueryElevationComponentTest
}
private void init(String schema) throws Exception {
- init("solrconfig-elevate.xml", schema);
-
- }
-
- private void init(String config, String schema) throws Exception {
//write out elevate-data.xml to the Data dir first by copying it from conf, which we know exists, this way we can test both conf and data configurations
createTempDir();
File parent = new File(TEST_HOME(), "conf");
@@ -65,7 +60,7 @@ public class QueryElevationComponentTest
File elevateDataFile = new File(dataDir, "elevate-data.xml");
FileUtils.copyFile(elevateFile, elevateDataFile);
- initCore(config,schema);
+ initCore("solrconfig-elevate.xml",schema);
clearIndex();
assertU(commit());
}
@@ -108,39 +103,6 @@ public class QueryElevationComponentTest
}
@Test
- public void testTrieFieldType() throws Exception {
- try {
- init("solrconfig.xml", "schema.xml");
- clearIndex();
- assertU(commit());
- assertU(adoc("id", "1", "text", "XXXX XXXX", "str_s", "a" ));
- assertU(adoc("id", "2", "text", "YYYY", "str_s", "b" ));
- assertU(adoc("id", "3", "text", "ZZZZ", "str_s", "c" ));
-
- assertU(adoc("id", "4", "text", "XXXX XXXX", "str_s", "x" ));
- assertU(adoc("id", "5", "text", "YYYY YYYY", "str_s", "y" ));
- assertU(adoc("id", "6", "text", "XXXX XXXX", "str_s", "z" ));
- assertU(adoc("id", "7", "text", "AAAA", "str_s", "a" ));
- assertU(adoc("id", "8", "text", "AAAA", "str_s", "a" ));
- assertU(adoc("id", "9", "text", "AAAA AAAA", "str_s", "a" ));
- assertU(commit());
-
- assertQ("", req(CommonParams.Q, "AAAA", CommonParams.QT, "/elevate",
- CommonParams.FL, "id, score, [elevated]")
- ,"//*[@numFound='3']"
- ,"//result/doc[1]/int[@name='id'][.='7']"
- ,"//result/doc[2]/int[@name='id'][.='8']"
- ,"//result/doc[3]/int[@name='id'][.='9']",
- "//result/doc[1]/bool[@name='[elevated]'][.='true']",
- "//result/doc[2]/bool[@name='[elevated]'][.='false']",
- "//result/doc[3]/bool[@name='[elevated]'][.='false']"
- );
- } finally{
- delete();
- }
- }
-
- @Test
public void testInterface() throws Exception
{
try {
@@ -226,7 +188,7 @@ public class QueryElevationComponentTest
CommonParams.FL, "id, score, [elevated]")
,"//*[@numFound='1']"
,"//result/doc[1]/str[@name='id'][.='7']",
- "//result/doc[1]/bool[@name='[elevated]'][.='true']"
+ "//result/doc[1]/bool[@name='[elevated]'][.='false']"
);
assertQ("", req(CommonParams.Q, "AAAA", CommonParams.QT, "/elevate",