You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2012/01/18 23:28:20 UTC
svn commit: r1233096 [13/13] - in /lucene/dev/branches/solrcloud: ./
dev-tools/eclipse/ dev-tools/idea/.idea/ dev-tools/idea/lucene/contrib/
dev-tools/idea/modules/analysis/kuromoji/
dev-tools/idea/solr/contrib/analysis-extras/ dev-tools/maven/modules/...
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/request/UnInvertedField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/request/UnInvertedField.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/request/UnInvertedField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/request/UnInvertedField.java Wed Jan 18 22:28:07 2012
@@ -19,6 +19,7 @@ package org.apache.solr.request;
import org.apache.lucene.search.FieldCache;
import org.apache.lucene.index.DocTermOrds;
+import org.apache.lucene.index.SlowMultiReaderWrapper;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.search.TermQuery;
@@ -484,7 +485,7 @@ public class UnInvertedField extends Doc
for (String f : facet) {
SchemaField facet_sf = searcher.getSchema().getField(f);
try {
- si = FieldCache.DEFAULT.getTermsIndex(searcher.getIndexReader(), f);
+ si = FieldCache.DEFAULT.getTermsIndex(new SlowMultiReaderWrapper(searcher.getIndexReader()), f);
}
catch (IOException e) {
throw new RuntimeException("failed to open field cache for: " + f, e);
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/response/CSVResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/response/CSVResponseWriter.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/response/CSVResponseWriter.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/response/CSVResponseWriter.java Wed Jan 18 22:28:07 2012
@@ -235,6 +235,7 @@ class CSVWriter extends TextResponseWrit
Collection<String> fields = returnFields.getLuceneFieldNames();
Object responseObj = rsp.getValues().get("response");
+ boolean returnOnlyStored = false;
if (fields==null) {
if (responseObj instanceof SolrDocumentList) {
// get the list of fields from the SolrDocumentList
@@ -251,6 +252,7 @@ class CSVWriter extends TextResponseWrit
} else {
fields.remove("score");
}
+ returnOnlyStored = true;
}
CSVSharedBufPrinter csvPrinterMV = new CSVSharedBufPrinter(mvWriter, mvStrategy);
@@ -268,9 +270,9 @@ class CSVWriter extends TextResponseWrit
FieldType ft = new StrField();
sf = new SchemaField(field, ft);
}
-
- // if we got the list of fields from the index, only list stored fields
- if (returnFields==null && sf != null && !sf.stored()) {
+
+ // Return only stored fields, unless an explicit field list is specified
+ if (returnOnlyStored && sf != null && !sf.stored()) {
continue;
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/response/transform/BaseEditorialTransformer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/response/transform/BaseEditorialTransformer.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/response/transform/BaseEditorialTransformer.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/response/transform/BaseEditorialTransformer.java Wed Jan 18 22:28:07 2012
@@ -19,9 +19,7 @@ package org.apache.solr.response.transfo
*/
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.NumericField;
import org.apache.solr.common.SolrDocument;
-import org.apache.solr.handler.component.QueryElevationComponent;
import org.apache.solr.schema.FieldType;
import java.util.Set;
@@ -66,8 +64,14 @@ public abstract class BaseEditorialTrans
protected String getKey(SolrDocument doc) {
String key;
Object field = doc.get(idFieldName);
- if (field instanceof NumericField){
- key = ((Field)field).stringValue();
+ final Number n;
+ if (field instanceof Field) {
+ n = ((Field) field).numericValue();
+ } else {
+ n = null;
+ }
+ if (n != null) {
+ key = n.toString();
key = ft.readableToIndexed(key);
} else if (field instanceof Field){
key = ((Field)field).stringValue();
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/response/transform/ValueSourceAugmenter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/response/transform/ValueSourceAugmenter.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/response/transform/ValueSourceAugmenter.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/response/transform/ValueSourceAugmenter.java Wed Jan 18 22:28:07 2012
@@ -100,7 +100,7 @@ public class ValueSourceAugmenter extend
doc.setField( name, val );
}
} catch (IOException e) {
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "exception at docid " + docid + " for valuesource " + valueSource, e, false);
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "exception at docid " + docid + " for valuesource " + valueSource, e);
}
}
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/BinaryField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/BinaryField.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/BinaryField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/BinaryField.java Wed Jan 18 22:28:07 2012
@@ -81,7 +81,7 @@ public class BinaryField extends FieldTy
len = buf.length;
}
- Field f = new org.apache.lucene.document.BinaryField(field.getName(), buf, offset, len);
+ Field f = new org.apache.lucene.document.StoredField(field.getName(), buf, offset, len);
f.setBoost(boost);
return f;
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/FieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/FieldType.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/FieldType.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/FieldType.java Wed Jan 18 22:28:07 2012
@@ -246,7 +246,7 @@ public abstract class FieldType extends
try {
val = toInternal(value.toString());
} catch (RuntimeException e) {
- throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Error while creating field '" + field + "' from value '" + value + "'", e, false);
+ throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Error while creating field '" + field + "' from value '" + value + "'", e);
}
if (val==null) return null;
@@ -465,12 +465,10 @@ public abstract class FieldType extends
* @see #getAnalyzer
*/
public void setAnalyzer(Analyzer analyzer) {
- SolrException e = new SolrException
+ throw new SolrException
(ErrorCode.SERVER_ERROR,
"FieldType: " + this.getClass().getSimpleName() +
" (" + typeName + ") does not support specifying an analyzer");
- SolrException.logOnce(log,null,e);
- throw e;
}
/**
@@ -487,12 +485,10 @@ public abstract class FieldType extends
* @see #getQueryAnalyzer
*/
public void setQueryAnalyzer(Analyzer analyzer) {
- SolrException e = new SolrException
+ throw new SolrException
(ErrorCode.SERVER_ERROR,
"FieldType: " + this.getClass().getSimpleName() +
" (" + typeName + ") does not support specifying an analyzer");
- SolrException.logOnce(log,null,e);
- throw e;
}
/** @lucene.internal */
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/IndexSchema.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/IndexSchema.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/IndexSchema.java Wed Jan 18 22:28:07 2012
@@ -386,7 +386,7 @@ public final class IndexSchema {
FieldType ft = fieldTypes.get(type);
if (ft==null) {
- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Unknown fieldtype '" + type + "' specified on field " + name,false);
+ throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Unknown fieldtype '" + type + "' specified on field " + name);
}
Map<String,String> args = DOMUtil.toMapExcept(attrs, "name", "type");
@@ -401,10 +401,7 @@ public final class IndexSchema {
if( old != null ) {
String msg = "[schema.xml] Duplicate field definition for '"
+ f.getName() + "' [[["+old.toString()+"]]] and [[["+f.toString()+"]]]";
- SolrException t = new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg );
- SolrException.logOnce(log,null,t);
- SolrConfig.severeErrors.add( t );
- throw t;
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg );
}
log.debug("field defined: " + f);
if( f.getDefaultValue() != null ) {
@@ -553,12 +550,10 @@ public final class IndexSchema {
aware.inform(this);
}
} catch (SolrException e) {
- SolrConfig.severeErrors.add( e );
throw e;
} catch(Exception e) {
// unexpected exception...
- SolrConfig.severeErrors.add( e );
- throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Schema Parsing Failed: " + e.getMessage(), e,false);
+ throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Schema Parsing Failed: " + e.getMessage(), e);
}
// create the field analyzers
@@ -574,10 +569,7 @@ public final class IndexSchema {
String msg = "[schema.xml] Duplicate DynamicField definition for '"
+ f.getName() + "'";
- SolrException t = new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg);
- SolrException.logOnce(log, null, t);
- SolrConfig.severeErrors.add(t);
- throw t;
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg);
}
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieField.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieField.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/schema/TrieField.java Wed Jan 18 22:28:07 2012
@@ -104,9 +104,8 @@ public class TrieField extends org.apach
@Override
public Object toObject(IndexableField f) {
- if (f.numeric()) {
- final Number val = f.numericValue();
- if (val==null) return badFieldString(f);
+ final Number val = f.numericValue();
+ if (val != null) {
return (type == TrieTypes.DATE) ? new Date(val.longValue()) : val;
} else {
// the following code is "deprecated" and only to support pre-3.2 indexes using the old BinaryField encoding:
@@ -405,10 +404,8 @@ public class TrieField extends org.apach
@Override
public String storedToIndexed(IndexableField f) {
final BytesRef bytes = new BytesRef(NumericUtils.BUF_SIZE_LONG);
- if (f instanceof org.apache.lucene.document.NumericField) {
- final Number val = ((org.apache.lucene.document.NumericField) f).numericValue();
- if (val==null)
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Invalid field contents: "+f.name());
+ final Number val = f.numericValue();
+ if (val != null) {
switch (type) {
case INTEGER:
NumericUtils.intToPrefixCoded(val.intValue(), 0, bytes);
@@ -481,38 +478,60 @@ public class TrieField extends org.apach
ft.setIndexed(indexed);
ft.setOmitNorms(field.omitNorms());
ft.setIndexOptions(getIndexOptions(field, value.toString()));
-
- final org.apache.lucene.document.NumericField f = new org.apache.lucene.document.NumericField(field.getName(), precisionStep, ft);
+
+ switch (type) {
+ case INTEGER:
+ ft.setNumericType(NumericField.DataType.INT);
+ break;
+ case FLOAT:
+ ft.setNumericType(NumericField.DataType.FLOAT);
+ break;
+ case LONG:
+ ft.setNumericType(NumericField.DataType.LONG);
+ break;
+ case DOUBLE:
+ ft.setNumericType(NumericField.DataType.DOUBLE);
+ break;
+ case DATE:
+ ft.setNumericType(NumericField.DataType.LONG);
+ break;
+ default:
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie field: " + type);
+ }
+ ft.setNumericPrecisionStep(precisionStep);
+
+ final org.apache.lucene.document.NumericField f;
+
switch (type) {
case INTEGER:
int i = (value instanceof Number)
? ((Number)value).intValue()
: Integer.parseInt(value.toString());
- f.setIntValue(i);
+ f = new org.apache.lucene.document.NumericField(field.getName(), i, ft);
break;
case FLOAT:
float fl = (value instanceof Number)
? ((Number)value).floatValue()
: Float.parseFloat(value.toString());
- f.setFloatValue(fl);
+ f = new org.apache.lucene.document.NumericField(field.getName(), fl, ft);
break;
case LONG:
long l = (value instanceof Number)
? ((Number)value).longValue()
: Long.parseLong(value.toString());
- f.setLongValue(l);
+ f = new org.apache.lucene.document.NumericField(field.getName(), l, ft);
break;
case DOUBLE:
double d = (value instanceof Number)
? ((Number)value).doubleValue()
: Double.parseDouble(value.toString());
- f.setDoubleValue(d);
+ f = new org.apache.lucene.document.NumericField(field.getName(), d, ft);
break;
case DATE:
Date date = (value instanceof Date)
? ((Date)value)
: dateField.parseMath(null, value.toString());
- f.setLongValue(date.getTime());
+ f = new org.apache.lucene.document.NumericField(field.getName(), date.getTime(), ft);
break;
default:
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie field: " + type);
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java Wed Jan 18 22:28:07 2012
@@ -23,7 +23,7 @@ import java.net.URL;
import java.util.*;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.lucene.document.BinaryField;
+import org.apache.lucene.document.StoredField;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
@@ -38,6 +38,7 @@ import org.apache.lucene.store.FSDirecto
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.OpenBitSet;
+import org.apache.lucene.util.ReaderUtil;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
@@ -182,7 +183,10 @@ public class SolrIndexSearcher extends I
}
optimizer = solrConfig.filtOptEnabled ? new LuceneQueryOptimizer(solrConfig.filtOptCacheSize,solrConfig.filtOptThreshold) : null;
- fieldNames = r.getFieldNames(IndexReader.FieldOption.ALL);
+ fieldNames = new HashSet<String>();
+ for(FieldInfo fieldInfo : ReaderUtil.getMergedFieldInfos(r)) {
+ fieldNames.add(fieldInfo.name);
+ }
// do this at the end since an exception in the constructor means we won't close
numOpens.incrementAndGet();
@@ -269,22 +273,24 @@ public class SolrIndexSearcher extends I
* highlighted the index reader knows about.
*/
public Collection<String> getStoredHighlightFieldNames() {
- if (storedHighlightFieldNames == null) {
- storedHighlightFieldNames = new LinkedList<String>();
- for (String fieldName : fieldNames) {
- try {
- SchemaField field = schema.getField(fieldName);
- if (field.stored() &&
- ((field.getType() instanceof org.apache.solr.schema.TextField) ||
- (field.getType() instanceof org.apache.solr.schema.StrField))) {
- storedHighlightFieldNames.add(fieldName);
- }
- } catch (RuntimeException e) { // getField() throws a SolrException, but it arrives as a RuntimeException
+ synchronized (this) {
+ if (storedHighlightFieldNames == null) {
+ storedHighlightFieldNames = new LinkedList<String>();
+ for (String fieldName : fieldNames) {
+ try {
+ SchemaField field = schema.getField(fieldName);
+ if (field.stored() &&
+ ((field.getType() instanceof org.apache.solr.schema.TextField) ||
+ (field.getType() instanceof org.apache.solr.schema.StrField))) {
+ storedHighlightFieldNames.add(fieldName);
+ }
+ } catch (RuntimeException e) { // getField() throws a SolrException, but it arrives as a RuntimeException
log.warn("Field \"" + fieldName + "\" found in index, but not defined in schema.");
+ }
}
}
+ return storedHighlightFieldNames;
}
- return storedHighlightFieldNames;
}
//
// Set default regenerators on filter and query caches if they don't have any
@@ -416,15 +422,13 @@ public class SolrIndexSearcher extends I
@Override
public void binaryField(FieldInfo fieldInfo, byte[] value, int offset, int length) throws IOException {
- doc.add(new BinaryField(fieldInfo.name, value));
+ doc.add(new StoredField(fieldInfo.name, value));
}
@Override
public void stringField(FieldInfo fieldInfo, String value) throws IOException {
final FieldType ft = new FieldType(TextField.TYPE_STORED);
ft.setStoreTermVectors(fieldInfo.storeTermVector);
- ft.setStoreTermVectorPositions(fieldInfo.storePositionWithTermVector);
- ft.setStoreTermVectorOffsets(fieldInfo.storeOffsetWithTermVector);
ft.setStoreTermVectors(fieldInfo.storeTermVector);
ft.setIndexed(fieldInfo.isIndexed);
ft.setOmitNorms(fieldInfo.omitNorms);
@@ -434,30 +438,30 @@ public class SolrIndexSearcher extends I
@Override
public void intField(FieldInfo fieldInfo, int value) {
- FieldType ft = new FieldType(NumericField.TYPE_STORED);
+ FieldType ft = new FieldType(NumericField.getFieldType(NumericField.DataType.INT, true));
ft.setIndexed(fieldInfo.isIndexed);
- doc.add(new NumericField(fieldInfo.name, ft).setIntValue(value));
+ doc.add(new NumericField(fieldInfo.name, value, ft));
}
@Override
public void longField(FieldInfo fieldInfo, long value) {
- FieldType ft = new FieldType(NumericField.TYPE_STORED);
+ FieldType ft = new FieldType(NumericField.getFieldType(NumericField.DataType.LONG, true));
ft.setIndexed(fieldInfo.isIndexed);
- doc.add(new NumericField(fieldInfo.name, ft).setLongValue(value));
+ doc.add(new NumericField(fieldInfo.name, value, ft));
}
@Override
public void floatField(FieldInfo fieldInfo, float value) {
- FieldType ft = new FieldType(NumericField.TYPE_STORED);
+ FieldType ft = new FieldType(NumericField.getFieldType(NumericField.DataType.FLOAT, true));
ft.setIndexed(fieldInfo.isIndexed);
- doc.add(new NumericField(fieldInfo.name, ft).setFloatValue(value));
+ doc.add(new NumericField(fieldInfo.name, value, ft));
}
@Override
public void doubleField(FieldInfo fieldInfo, double value) {
- FieldType ft = new FieldType(NumericField.TYPE_STORED);
+ FieldType ft = new FieldType(NumericField.getFieldType(NumericField.DataType.DOUBLE, true));
ft.setIndexed(fieldInfo.isIndexed);
- doc.add(new NumericField(fieldInfo.name, ft).setDoubleValue(value));
+ doc.add(new NumericField(fieldInfo.name, value, ft));
}
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java Wed Jan 18 22:28:07 2012
@@ -255,10 +255,9 @@ public class FileFloatSource extends Val
String key = line.substring(0, delimIndex);
String val = line.substring(delimIndex+1, endIndex);
- idType.readableToIndexed(key, internalKey);
-
float fval;
try {
+ idType.readableToIndexed(key, internalKey);
fval=Float.parseFloat(val);
} catch (Exception e) {
if (++otherErrors<=10) {
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java Wed Jan 18 22:28:07 2012
@@ -84,7 +84,6 @@ public class SolrDispatchFilter implemen
{
log.info("SolrDispatchFilter.init()");
- boolean abortOnConfigurationError = true;
CoreContainer.Initializer init = createInitializer();
try {
// web.xml configuration
@@ -95,32 +94,10 @@ public class SolrDispatchFilter implemen
}
catch( Throwable t ) {
// catch this so our filter still works
- log.error( "Could not start Solr. Check solr/home property and the logs", t);
- SolrConfig.severeErrors.add( t );
+ log.error( "Could not start Solr. Check solr/home property and the logs");
SolrCore.log( t );
}
- // Optionally abort if we found a sever error
- if( abortOnConfigurationError && SolrConfig.severeErrors.size() > 0 ) {
- StringWriter sw = new StringWriter();
- PrintWriter out = new PrintWriter( sw );
- out.println( "Severe errors in solr configuration.\n" );
- out.println( "Check your log files for more detailed information on what may be wrong.\n" );
- for( Throwable t : SolrConfig.severeErrors ) {
- out.println( "-------------------------------------------------------------" );
- t.printStackTrace( out );
- }
- out.flush();
-
- // Servlet containers behave slightly differently if you throw an exception during
- // initialization. Resin will display that error for every page, jetty prints it in
- // the logs, but continues normally. (We will see a 404 rather then the real error)
- // rather then leave the behavior undefined, lets cache the error and spit it out
- // for every request.
- abortErrorMessage = sw.toString();
- //throw new ServletException( abortErrorMessage );
- }
-
log.info("SolrDispatchFilter.init() done");
}
@@ -375,7 +352,7 @@ public class SolrDispatchFilter implemen
ex.printStackTrace(new PrintWriter(sw));
trace = "\n\n"+sw.toString();
- SolrException.logOnce(log,null,ex );
+ SolrException.log(log, null, ex);
// non standard codes have undefined results with various servers
if( code < 100 ) {
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java Wed Jan 18 22:28:07 2012
@@ -607,7 +607,7 @@ public class DirectUpdateHandler2 extend
try {
solrCoreState.decref(this);
} catch (IOException e) {
- throw new SolrException(ErrorCode.SERVER_ERROR, "", e, false);
+ throw new SolrException(ErrorCode.SERVER_ERROR, "", e);
}
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/util/SimplePostTool.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/util/SimplePostTool.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/util/SimplePostTool.java Wed Jan 18 22:28:07 2012
@@ -44,7 +44,7 @@ public class SimplePostTool {
private static final String DEFAULT_OPTIMIZE = "no";
private static final String DEFAULT_OUT = "no";
- private static final String DEFAULT_DATA_TYPE = "application/xml";
+ public static final String DEFAULT_DATA_TYPE = "application/xml";
private static final String DATA_MODE_FILES = "files";
private static final String DATA_MODE_ARGS = "args";
@@ -89,6 +89,7 @@ public class SimplePostTool {
}
OutputStream out = null;
+ final String type = System.getProperty("type", DEFAULT_DATA_TYPE);
URL u = null;
try {
@@ -111,7 +112,7 @@ public class SimplePostTool {
if (DATA_MODE_FILES.equals(mode)) {
if (0 < args.length) {
info("POSTing files to " + u + "..");
- t.postFiles(args, 0, out);
+ t.postFiles(args, 0, out, type);
} else {
info("No files specified. (Use -h for help)");
}
@@ -120,13 +121,13 @@ public class SimplePostTool {
if (0 < args.length) {
info("POSTing args to " + u + "..");
for (String a : args) {
- t.postData(SimplePostTool.stringToStream(a), null, out);
+ t.postData(SimplePostTool.stringToStream(a), null, out, type);
}
}
} else if (DATA_MODE_STDIN.equals(mode)) {
info("POSTing stdin to " + u + "..");
- t.postData(System.in, null, out);
+ t.postData(System.in, null, out, type);
}
if ("yes".equals(System.getProperty("commit",DEFAULT_COMMIT))) {
info("COMMITting Solr index changes..");
@@ -142,15 +143,24 @@ public class SimplePostTool {
fatal("RuntimeException " + e);
}
}
-
- /** Post all filenames provided in args, return the number of files posted*/
+
+ /**
+ * @deprecated use {@link #postData(InputStream, Integer, OutputStream, String)} instead
+ */
+ @Deprecated
int postFiles(String [] args,int startIndexInArgs, OutputStream out) {
+ final String type = System.getProperty("type", DEFAULT_DATA_TYPE);
+ return postFiles(args, startIndexInArgs, out, type);
+ }
+
+ /** Post all filenames provided in args, return the number of files posted*/
+ int postFiles(String [] args,int startIndexInArgs, OutputStream out, String type) {
int filesPosted = 0;
for (int j = startIndexInArgs; j < args.length; j++) {
File srcFile = new File(args[j]);
if (srcFile.canRead()) {
info("POSTing file " + srcFile.getName());
- postFile(srcFile, out);
+ postFile(srcFile, out, type);
filesPosted++;
} else {
warn("Cannot read input file: " + srcFile);
@@ -199,16 +209,24 @@ public class SimplePostTool {
}
/**
+ * @deprecated use {@link #postFile(File, OutputStream, String)} instead
+ */
+ public void postFile(File file, OutputStream output) {
+ final String type = System.getProperty("type", DEFAULT_DATA_TYPE);
+ postFile(file, output, type);
+ }
+
+ /**
* Opens the file and posts it's contents to the solrUrl,
* writes to response to output.
* @throws UnsupportedEncodingException
*/
- public void postFile(File file, OutputStream output) {
+ public void postFile(File file, OutputStream output, String type) {
InputStream is = null;
try {
is = new FileInputStream(file);
- postData(is, (int)file.length(), output);
+ postData(is, (int)file.length(), output, type);
} catch (IOException e) {
fatal("Can't open/read file: " + file);
} finally {
@@ -224,7 +242,7 @@ public class SimplePostTool {
* Performs a simple get on the given URL
* @param url
*/
- public void doGet(String url) {
+ public static void doGet(String url) {
try {
doGet(new URL(url));
} catch (MalformedURLException e) {
@@ -236,7 +254,7 @@ public class SimplePostTool {
* Performs a simple get on the given URL
* @param url
*/
- public void doGet(URL url) {
+ public static void doGet(URL url) {
try {
HttpURLConnection urlc = (HttpURLConnection) url.openConnection();
if (HttpURLConnection.HTTP_OK != urlc.getResponseCode()) {
@@ -249,12 +267,19 @@ public class SimplePostTool {
}
/**
- * Reads data from the data stream and posts it to solr,
- * writes to the response to output
+ * @deprecated use {@link #postData(InputStream, Integer, OutputStream, String)} instead
*/
+ @Deprecated
public void postData(InputStream data, Integer length, OutputStream output) {
-
final String type = System.getProperty("type", DEFAULT_DATA_TYPE);
+ postData(data, length, output, type);
+ }
+
+ /**
+ * Reads data from the data stream and posts it to solr,
+ * writes to the response to output
+ */
+ public void postData(InputStream data, Integer length, OutputStream output, String type) {
HttpURLConnection urlc = null;
try {
@@ -308,7 +333,7 @@ public class SimplePostTool {
}
}
- private static InputStream stringToStream(String s) {
+ public static InputStream stringToStream(String s) {
InputStream is = null;
try {
is = new ByteArrayInputStream(s.getBytes("UTF-8"));
@@ -320,7 +345,7 @@ public class SimplePostTool {
/**
* Pipes everything from the source to the dest. If dest is null,
- * then everything is read fro msource and thrown away.
+ * then everything is read from source and thrown away.
*/
private static void pipe(InputStream source, OutputStream dest) throws IOException {
byte[] buf = new byte[1024];
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java Wed Jan 18 22:28:07 2012
@@ -852,27 +852,6 @@ public class SolrPluginUtils {
}
}
}
-
-
- /**
- * This method helps resolve if the deprecated "update.processor" request parameter is used
- * and logs a warning if it is. In a future version, this method will be removed and
- * Solr will assume "update.chain" and not look for "update.processor"
- * @param params an instance of SolrParams from the request
- * @param log an instance of a slf4j logger to log a warning in case of deprecated param usage
- * @return null if neither is specified, else the value of the param specified
- * @deprecated
- */
- public static String resolveUpdateChainParam(SolrParams params, Logger log) {
- if(params.get(UpdateParams.UPDATE_CHAIN_DEPRECATED) != null && log != null) {
- log.warn("Use of deprecated update request parameter "+UpdateParams.UPDATE_CHAIN_DEPRECATED+
- " detected. Please use the new parameter "+UpdateParams.UPDATE_CHAIN+" instead, as support"+
- " for "+UpdateParams.UPDATE_CHAIN_DEPRECATED+" will be removed in a later version.");
- }
- return (params.get(UpdateParams.UPDATE_CHAIN) != null)
- ? params.get(UpdateParams.UPDATE_CHAIN)
- : params.get(UpdateParams.UPDATE_CHAIN_DEPRECATED);
- }
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/util/plugin/AbstractPluginLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/util/plugin/AbstractPluginLoader.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/util/plugin/AbstractPluginLoader.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/util/plugin/AbstractPluginLoader.java Wed Jan 18 22:28:07 2012
@@ -167,8 +167,6 @@ public abstract class AbstractPluginLoad
SolrException e = new SolrException
(ErrorCode.SERVER_ERROR,
"Plugin init failure for " + type + ":" + ex.getMessage(), ex);
- SolrConfig.severeErrors.add( e );
- SolrException.logOnce(log,null,e);
throw e;
}
}
@@ -182,8 +180,6 @@ public abstract class AbstractPluginLoad
catch( Exception ex ) {
SolrException e = new SolrException
(ErrorCode.SERVER_ERROR, "Plugin Initializing failure for " + type, ex);
- SolrConfig.severeErrors.add( e );
- SolrException.logOnce(log,null,e);
throw e;
}
}
@@ -232,8 +228,6 @@ public abstract class AbstractPluginLoad
} catch (Exception ex) {
SolrException e = new SolrException
(ErrorCode.SERVER_ERROR, "Plugin init failure for " + type, ex);
- SolrConfig.severeErrors.add( e );
- SolrException.logOnce(log,null,e);
throw e;
}
@@ -244,8 +238,6 @@ public abstract class AbstractPluginLoad
} catch (Exception ex) {
SolrException e = new SolrException
(ErrorCode.SERVER_ERROR, "Plugin init failure for " + type, ex);
- SolrConfig.severeErrors.add( e );
- SolrException.logOnce(log,null,e);
throw e;
}
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/test-files/solr/conf/schema11.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test-files/solr/conf/schema11.xml?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test-files/solr/conf/schema11.xml (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test-files/solr/conf/schema11.xml Wed Jan 18 22:28:07 2012
@@ -273,7 +273,7 @@ valued. -->
stored="false" indexed="true"
class="solr.ExternalFileField" valType="float"/>
- <fieldType name="eff_tfloat" keyField="id" defVal="0"
+ <fieldType name="eff_tfloat" keyField="eff_ti" defVal="0"
stored="false" indexed="true"
class="solr.ExternalFileField" valType="tfloat"/>
@@ -320,6 +320,8 @@ valued. -->
<field name="signatureField" type="string" indexed="true" stored="false"/>
+ <field name="eff_trie" type="eff_tfloat" />
+
<!-- Dynamic field definitions. If a field name is not found, dynamicFields
will be used if the name matches any of the patterns.
RESTRICTION: the glob-like pattern in the name attribute must have
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/AbstractDistributedZkTestCase.java Wed Jan 18 22:28:07 2012
@@ -83,7 +83,6 @@ public abstract class AbstractDistribute
System.clearProperty("solr.test.sys.prop2");
resetExceptionIgnores();
super.tearDown();
- SolrConfig.severeErrors.clear();
}
protected void printLayout() throws Exception {
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java Wed Jan 18 22:28:07 2012
@@ -111,7 +111,6 @@ public abstract class AbstractZkTestCase
printLayout(zkServer.getZkHost());
}
- SolrConfig.severeErrors.clear();
super.tearDown();
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java Wed Jan 18 22:28:07 2012
@@ -249,7 +249,6 @@ public class CloudStateUpdateTest extend
System.clearProperty("zkHost");
System.clearProperty("hostPort");
System.clearProperty("solrcloud.update.delay");
- SolrConfig.severeErrors.clear();
}
private void printLayout(String zkHost) throws Exception {
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java Wed Jan 18 22:28:07 2012
@@ -270,7 +270,6 @@ public class LeaderElectionIntegrationTe
System.clearProperty("hostPort");
System.clearProperty("shard");
System.clearProperty("solrcloud.update.delay");
- SolrConfig.severeErrors.clear();
}
private void printLayout(String zkHost) throws Exception {
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/LeaderElectionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/LeaderElectionTest.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/LeaderElectionTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/LeaderElectionTest.java Wed Jan 18 22:28:07 2012
@@ -397,7 +397,6 @@ public class LeaderElectionTest extends
public void tearDown() throws Exception {
zkClient.close();
server.shutdown();
- SolrConfig.severeErrors.clear();
super.tearDown();
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java Wed Jan 18 22:28:07 2012
@@ -139,7 +139,6 @@ public class ZkControllerTest extends So
@Override
public void tearDown() throws Exception {
- SolrConfig.severeErrors.clear();
super.tearDown();
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java Wed Jan 18 22:28:07 2012
@@ -239,7 +239,6 @@ public class ZkSolrClientTest extends Ab
@Override
public void tearDown() throws Exception {
- SolrConfig.severeErrors.clear();
super.tearDown();
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java Wed Jan 18 22:28:07 2012
@@ -80,7 +80,7 @@ public class XmlUpdateRequestHandlerTest
}
@Test
- public void testCommitWithin() throws Exception
+ public void testRequestParams() throws Exception
{
String xml =
"<add>" +
@@ -90,7 +90,7 @@ public class XmlUpdateRequestHandlerTest
" </doc>" +
"</add>";
- SolrQueryRequest req = req("commitWithin","100");
+ SolrQueryRequest req = req("commitWithin","100","overwrite","false");
SolrQueryResponse rsp = new SolrQueryResponse();
BufferingRequestProcessor p = new BufferingRequestProcessor(null);
@@ -98,8 +98,8 @@ public class XmlUpdateRequestHandlerTest
loader.load(req, rsp, new ContentStreamBase.StringStream(xml));
AddUpdateCommand add = p.addCommands.get(0);
- assertEquals(add.commitWithin, 100);
-
+ assertEquals(100, add.commitWithin);
+ assertEquals(false, add.overwrite);
req.close();
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/highlight/FastVectorHighlighterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/highlight/FastVectorHighlighterTest.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/highlight/FastVectorHighlighterTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/highlight/FastVectorHighlighterTest.java Wed Jan 18 22:28:07 2012
@@ -82,7 +82,7 @@ public class FastVectorHighlighterTest e
assertQ("Basic summarization",
sumLRF.makeRequest("tv_text:vector"),
"//lst[@name='highlighting']/lst[@name='1']",
- "//lst[@name='1']/arr[@name='tv_text']/str[.=' fast <em>vector</em> highlighter test ']"
+ "//lst[@name='1']/arr[@name='tv_text']/str[.='basic fast <em>vector</em> highlighter test']"
);
}
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/response/TestCSVResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/response/TestCSVResponseWriter.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/response/TestCSVResponseWriter.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/response/TestCSVResponseWriter.java Wed Jan 18 22:28:07 2012
@@ -36,7 +36,8 @@ public class TestCSVResponseWriter exten
public static void createIndex() {
assertU(adoc("id","1", "foo_i","-1", "foo_s","hi", "foo_l","12345678987654321", "foo_b","false", "foo_f","1.414","foo_d","-1.0E300","foo_dt","2000-01-02T03:04:05Z"));
- assertU(adoc("id","2", "v_ss","hi", "v_ss","there", "v2_ss","nice", "v2_ss","output"));
+ assertU(adoc("id","2", "v_ss","hi", "v_ss","there", "v2_ss","nice", "v2_ss","output", "shouldbeunstored","foo"));
+ assertU(adoc("id","3", "shouldbeunstored","foo"));
assertU(commit());
}
@@ -97,6 +98,10 @@ public class TestCSVResponseWriter exten
assertEquals("1,,hi\n2,\"hi,there\",\n"
, h.query(req("q","id:[1 TO 2]", "wt","csv", "csv.header","false", "fl","id,v_ss,foo_s")));
+ // test SOLR-2970 not returning non-stored fields by default
+ assertEquals("id,foo_b,foo_d,foo_s,foo_f,foo_i,foo_dt,foo_l,v_ss,v2_ss\n"
+ , h.query(req("q","id:3", "wt","csv", "csv.header","true", "fl","*", "rows","0")));
+
// now test SolrDocumentList
SolrDocument d = new SolrDocument();
@@ -119,6 +124,7 @@ public class TestCSVResponseWriter exten
d.addField("v2_ss","nice");
d.addField("v2_ss","output");
d.addField("score", "89.83");
+ d.addField("shouldbeunstored","foo");
SolrDocumentList sdl = new SolrDocumentList();
sdl.add(d1);
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java Wed Jan 18 22:28:07 2012
@@ -45,7 +45,6 @@ public class BadIndexSchemaTest extends
(ErrorCode.SERVER_ERROR,
"Unexpected error, expected error matching: " + errString, e);
} finally {
- SolrConfig.severeErrors.clear();
deleteCore();
}
fail("Did not encounter any exception from: " + schema);
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/schema/PolyFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/schema/PolyFieldTest.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/schema/PolyFieldTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/schema/PolyFieldTest.java Wed Jan 18 22:28:07 2012
@@ -88,7 +88,8 @@ public class PolyFieldTest extends SolrT
//first two fields contain the values, third is just stored and contains the original
for (int i = 0; i < 3; i++) {
boolean hasValue = fields[i].binaryValue() != null
- || fields[i].stringValue() != null;
+ || fields[i].stringValue() != null
+ || fields[i].numericValue() != null;
assertTrue("Doesn't have a value: " + fields[i], hasValue);
}
/*assertTrue("first field " + fields[0].tokenStreamValue() + " is not 35.0", pt.getSubType().toExternal(fields[0]).equals(String.valueOf(xy[0])));
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/search/TestDocSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/search/TestDocSet.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/search/TestDocSet.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/search/TestDocSet.java Wed Jan 18 22:28:07 2012
@@ -17,22 +17,23 @@
package org.apache.solr.search;
-import java.util.Random;
-import java.util.Arrays;
import java.io.IOException;
+import java.util.Arrays;
+import java.util.Random;
-import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.OpenBitSet;
-import org.apache.lucene.util.OpenBitSetIterator;
+import org.apache.lucene.index.FieldInfos;
+import org.apache.lucene.index.FilterIndexReader;
import org.apache.lucene.util.ReaderUtil;
import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.FilterIndexReader;
import org.apache.lucene.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader.ReaderContext;
import org.apache.lucene.index.MultiReader;
-import org.apache.lucene.search.Filter;
import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator;
+import org.apache.lucene.search.Filter;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.OpenBitSet;
+import org.apache.lucene.util.OpenBitSetIterator;
/**
*
@@ -358,6 +359,11 @@ public class TestDocSet extends LuceneTe
public IndexReader[] getSequentialSubReaders() {
return null;
}
+
+ @Override
+ public FieldInfos getFieldInfos() {
+ return new FieldInfos();
+ }
};
return r;
}
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java Wed Jan 18 22:28:07 2012
@@ -18,6 +18,7 @@
package org.apache.solr.search.function;
import org.apache.lucene.codecs.Codec;
+import org.apache.lucene.index.Norm;
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.search.FieldCache;
import org.apache.lucene.search.similarities.DefaultSimilarity;
@@ -296,6 +297,18 @@ public class TestFunctionQuery extends S
}
@Test
+ public void testExternalFileFieldNumericKey() throws Exception {
+ final String extField = "eff_trie";
+ final String keyField = "eff_ti";
+ assertU(adoc("id", "991", keyField, "91"));
+ assertU(adoc("id", "992", keyField, "92"));
+ assertU(adoc("id", "993", keyField, "93"));
+ assertU(commit());
+ makeExternalFile(extField, "91=543210\n92=-8\n93=250\n=67","UTF-8");
+ singleTest(extField,"\0",991,543210,992,-8,993,250);
+ }
+
+ @Test
public void testGeneral() throws Exception {
clearIndex();
@@ -334,8 +347,11 @@ public class TestFunctionQuery extends S
FieldInvertState state = new FieldInvertState();
state.setBoost(1.0f);
state.setLength(4);
+ Norm norm = new Norm();
+ similarity.computeNorm(state, norm);
+ float nrm = similarity.decodeNormValue(norm.field().numericValue().byteValue());
assertQ(req("fl","*,score","q", "{!func}norm(a_t)", "fq","id:2"),
- "//float[@name='score']='" + similarity.decodeNormValue(similarity.computeNorm(state)) + "'"); // sqrt(4)==2 and is exactly representable when quantized to a byte
+ "//float[@name='score']='" + nrm + "'"); // sqrt(4)==2 and is exactly representable when quantized to a byte
// test that ord and rord are working on a global index basis, not just
// at the segment level (since Lucene 2.9 has switched to per-segment searching)
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/update/UpdateParamsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/update/UpdateParamsTest.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/update/UpdateParamsTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/update/UpdateParamsTest.java Wed Jan 18 22:28:07 2012
@@ -37,17 +37,16 @@ public class UpdateParamsTest extends Ab
public String getSolrConfigFile() { return "solrconfig.xml"; }
/**
- * Tests that both update.chain and update.processor works
- * NOTE: This test will fail when support for update.processor is removed and should then be removed
+ * Tests that only update.chain and not update.processor works (SOLR-2105)
*/
- public void testUpdateProcessorParamDeprecation() throws Exception {
+ public void testUpdateProcessorParamDeprecationRemoved() throws Exception {
SolrCore core = h.getCore();
XmlUpdateRequestHandler handler = new XmlUpdateRequestHandler();
handler.init( null );
MapSolrParams params = new MapSolrParams( new HashMap<String, String>() );
- params.getMap().put(UpdateParams.UPDATE_CHAIN_DEPRECATED, "nonexistant");
+ params.getMap().put("update.processor", "nonexistant");
// Add a single document
SolrQueryResponse rsp = new SolrQueryResponse();
@@ -56,13 +55,13 @@ public class UpdateParamsTest extends Ab
// First check that the old param behaves as it should
try {
handler.handleRequestBody(req, rsp);
- assertFalse("Faulty update.processor parameter (deprecated but should work) not causing an error - i.e. it is not detected", true);
+ assertTrue("Old param update.processor should not have any effect anymore", true);
} catch (Exception e) {
- assertEquals("Got wrong exception while testing update.chain", e.getMessage(), "unknown UpdateRequestProcessorChain: nonexistant");
+ assertFalse("Got wrong exception while testing update.chain", e.getMessage().equals("unknown UpdateRequestProcessorChain: nonexistant"));
}
// Then check that the new param behaves correctly
- params.getMap().remove(UpdateParams.UPDATE_CHAIN_DEPRECATED);
+ params.getMap().remove("update.processor");
params.getMap().put(UpdateParams.UPDATE_CHAIN, "nonexistant");
req.setParams(params);
try {
Modified: lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java (original)
+++ lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java Wed Jan 18 22:28:07 2012
@@ -430,7 +430,7 @@ public class CommonsHttpSolrServer exten
msg.append( method.getStatusText() );
msg.append( "\n\n" );
msg.append( "request: "+method.getURI() );
- throw new SolrException(statusCode, java.net.URLDecoder.decode(msg.toString(), "UTF-8") );
+ throw new SolrException(SolrException.ErrorCode.getErrorCode(statusCode), java.net.URLDecoder.decode(msg.toString(), "UTF-8") );
}
// Read the contents
Modified: lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java (original)
+++ lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java Wed Jan 18 22:28:07 2012
@@ -195,7 +195,9 @@ public class JavaBinUpdateRequestCodec {
NamedList nl = new NamedList();
while (it.hasNext()) {
String s = it.next();
- nl.add(s, params.getParams(s));
+ for(String val: params.getParams(s)) {
+ nl.add(s, val);
+ }
}
return nl;
}
Modified: lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/SolrException.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/SolrException.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/SolrException.java (original)
+++ lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/SolrException.java Wed Jan 18 22:28:07 2012
@@ -54,57 +54,25 @@ public class SolrException extends Runti
return UNKNOWN;
}
};
-
- public boolean logged=false;
public SolrException(ErrorCode code, String msg) {
- super(msg);
- this.code=code.code;
- }
-
- public SolrException(ErrorCode code, String msg, boolean alreadyLogged) {
- super(msg);
- this.code=code.code;
- this.logged=alreadyLogged;
- }
-
- public SolrException(ErrorCode code, String msg, Throwable th, boolean alreadyLogged) {
- super(msg,th);
- this.code=code.code;
- logged=alreadyLogged;
+ this(code, msg, null);
}
-
public SolrException(ErrorCode code, String msg, Throwable th) {
- this(code,msg,th,true);
+ super(msg, th);
+ this.code = code.code;
}
public SolrException(ErrorCode code, Throwable th) {
- super(th);
- this.code=code.code;
- logged=true;
- }
-
- /**
- * @deprecated Use {@link #SolrException(ErrorCode,String)}.
- */
- @Deprecated
- public SolrException(int code, String msg) {
- super(msg);
- this.code=code;
+ this(code, null, th);
}
-
int code=0;
public int code() { return code; }
-
-
public void log(Logger log) { log(log,this); }
public static void log(Logger log, Throwable e) {
- if (e instanceof SolrException) {
- ((SolrException)e).logged = true;
- }
String stackTrace = toStr(e);
String ignore = doIgnore(stackTrace);
if (ignore != null) {
@@ -116,9 +84,6 @@ public class SolrException extends Runti
}
public static void log(Logger log, String msg, Throwable e) {
- if (e instanceof SolrException) {
- ((SolrException)e).logged = true;
- }
String stackTrace = msg + ':' + toStr(e);
String ignore = doIgnore(stackTrace);
if (ignore != null) {
@@ -127,14 +92,6 @@ public class SolrException extends Runti
}
log.error(stackTrace);
}
-
- public static void logOnce(Logger log, String msg, Throwable e) {
- if (e instanceof SolrException) {
- if(((SolrException)e).logged) return;
- }
- if (msg!=null) log(log,msg,e);
- else log(log,e);
- }
public static void log(Logger log, String msg) {
String stackTrace = msg;
@@ -146,7 +103,6 @@ public class SolrException extends Runti
log.error(stackTrace);
}
-
// public String toString() { return toStr(this); } // oops, inf loop
@Override
public String toString() { return super.toString(); }
Modified: lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/params/UpdateParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/params/UpdateParams.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/params/UpdateParams.java (original)
+++ lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/params/UpdateParams.java Wed Jan 18 22:28:07 2012
@@ -51,8 +51,6 @@ public interface UpdateParams
/** Select the update processor chain to use. A RequestHandler may or may not respect this parameter */
public static final String UPDATE_CHAIN = "update.chain";
- // TODO: Include the old deprecated param, for removal in Solr 4.0
- public static final String UPDATE_CHAIN_DEPRECATED = "update.processor";
/**
* If optimizing, set the maximum number of segments left in the index after optimization. 1 is the default (and is equivalent to calling IndexWriter.optimize() in Lucene).
Modified: lucene/dev/branches/solrcloud/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java (original)
+++ lucene/dev/branches/solrcloud/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java Wed Jan 18 22:28:07 2012
@@ -50,7 +50,7 @@ public class TestUpdateRequestCodec exte
updateRequest.deleteById("id:5");
updateRequest.deleteByQuery("2*");
updateRequest.deleteByQuery("1*");
-
+ updateRequest.setParam("a", "b");
SolrInputDocument doc = new SolrInputDocument();
doc.addField("id", 1);
doc.addField("desc", "one", 2.0f);
@@ -106,6 +106,7 @@ public class TestUpdateRequestCodec exte
Assert.assertEquals(updateUnmarshalled.getDeleteQuery().get(0) ,
updateRequest.getDeleteQuery().get(0));
+ assertEquals("b", updateUnmarshalled.getParams().get("a"));
}
@Test
Modified: lucene/dev/branches/solrcloud/solr/test-framework/src/java/org/apache/solr/JSONTestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/test-framework/src/java/org/apache/solr/JSONTestUtil.java?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/test-framework/src/java/org/apache/solr/JSONTestUtil.java (original)
+++ lucene/dev/branches/solrcloud/solr/test-framework/src/java/org/apache/solr/JSONTestUtil.java Wed Jan 18 22:28:07 2012
@@ -78,7 +78,7 @@ public class JSONTestUtil {
public static String match(String path, String input, String expected, double delta) throws Exception {
Object inputObj = ObjectBuilder.fromJSON(input);
Object expectObj = ObjectBuilder.fromJSON(expected);
- return matchObj(path, inputObj, expectObj);
+ return matchObj(path, inputObj, expectObj, delta);
}
/**
@@ -88,7 +88,7 @@ public class JSONTestUtil {
* @param delta tollerance allowed in comparing float/double values
*/
public static String matchObj(String path, Object input, Object expected, double delta) throws Exception {
- CollectionTester tester = new CollectionTester(input);
+ CollectionTester tester = new CollectionTester(input,delta);
boolean reversed = path.startsWith("!");
String positivePath = reversed ? path.substring(1) : path;
if (!tester.seek(positivePath) ^ reversed) {
@@ -181,19 +181,16 @@ class CollectionTester {
// make an exception for some numerics
if ((expected instanceof Integer && val instanceof Long || expected instanceof Long && val instanceof Integer)
- && ((Number)expected).longValue() == ((Number)val).longValue())
- {
+ && ((Number)expected).longValue() == ((Number)val).longValue()) {
return true;
- } else if ((expected instanceof Float && val instanceof Double || expected instanceof Double && val instanceof Float)) {
+ } else if ((expected instanceof Double || expected instanceof Float) && (val instanceof Double || val instanceof Float)) {
double a = ((Number)expected).doubleValue();
double b = ((Number)val).doubleValue();
if (Double.compare(a,b) == 0) return true;
if (Math.abs(a-b) < delta) return true;
- return false;
- } else {
- setErr("mismatch: '" + expected + "'!='" + val + "'");
- return false;
}
+ setErr("mismatch: '" + expected + "'!='" + val + "'");
+ return false;
}
// setErr("unknown expected type " + expected.getClass().getName());
Modified: lucene/dev/branches/solrcloud/solr/webapp/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/webapp/build.xml?rev=1233096&r1=1233095&r2=1233096&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/webapp/build.xml (original)
+++ lucene/dev/branches/solrcloud/solr/webapp/build.xml Wed Jan 18 22:28:07 2012
@@ -20,6 +20,9 @@
<import file="../common-build.xml"/>
+ <property name="exclude.from.war" value="" />
+ <property name="solr.war.suffix" value="" />
+
<!-- Checks that all JSP files in the webapp compile successfully using Jetty's Jasper -->
<target name="test" depends="compile-test-solr-core">
<property name="jsp.target" location="${dest}/jsp-temp" />
@@ -47,24 +50,24 @@
implementation.title="org.apache.solr"
spec.version="${solr.spec.version}"/>
<ant dir="${common-solr.dir}" inheritall="false" target="contribs-add-to-war"/>
- <war destfile="${dist}/apache-solr-${version}.war"
+ <war destfile="${dist}/apache-solr-${version}${solr.war.suffix}.war"
webxml="web/WEB-INF/web.xml"
manifest="${dest}/META-INF/MANIFEST.MF">
- <lib dir="${common-solr.dir}/lib">
+ <lib dir="${common-solr.dir}/lib" excludes="${exclude.from.war}">
<exclude name="servlet-api*.jar" />
<exclude name="easymock-*.jar" />
<exclude name="junit-*.jar" />
<exclude name="*.txt" />
<exclude name="*.template" />
</lib>
- <lib dir="${lucene-libs}"/>
- <lib dir="${dist}">
+ <lib dir="${lucene-libs}" excludes="${exclude.from.war}"/>
+ <lib dir="${dist}" excludes="${exclude.from.war}">
<include name="apache-solr-solrj-${version}.jar" />
<include name="apache-solr-core-${version}.jar" />
</lib>
- <fileset dir="${dest}/web"/> <!-- contribs' additions -->
- <fileset dir="web" />
- <metainf dir="${common-solr.dir}" includes="LICENSE.txt,NOTICE.txt"/>
+ <fileset dir="${dest}/web" excludes="${exclude.from.war}"/> <!-- contribs' additions -->
+ <fileset dir="web" excludes="${exclude.from.war}"/>
+ <metainf dir="${common-solr.dir}" includes="LICENSE.txt,NOTICE.txt" excludes="${exclude.from.war}"/>
</war>
</target>