You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2011/03/15 22:35:35 UTC
svn commit: r1081952 [16/17] - in /lucene/dev/branches/bulkpostings: ./
dev-tools/ dev-tools/eclipse/ dev-tools/idea/ dev-tools/idea/.idea/
dev-tools/idea/lucene/ dev-tools/idea/lucene/contrib/ant/
dev-tools/idea/lucene/contrib/demo/ dev-tools/idea/luc...
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/ByteField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/ByteField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/ByteField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/ByteField.java Tue Mar 15 21:35:17 2011
@@ -47,6 +47,7 @@ public class ByteField extends FieldType
@Override
public ValueSource getValueSource(SchemaField field, QParser qparser) {
+ field.checkFieldCacheSource(qparser);
return new ByteFieldSource( new ByteValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) );
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/DateField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/DateField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/DateField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/DateField.java Tue Mar 15 21:35:17 2011
@@ -220,10 +220,6 @@ public class DateField extends FieldType
return getStringSort(field,reverse);
}
- public ValueSource getValueSource(SchemaField field) {
- return new OrdFieldSource(field.name);
- }
-
@Override
public void write(TextResponseWriter writer, String name, Fieldable f) throws IOException {
writer.writeDate(name, toExternal(f));
@@ -408,12 +404,13 @@ public class DateField extends FieldType
@Override
public ValueSource getValueSource(SchemaField field, QParser parser) {
+ field.checkFieldCacheSource(parser);
return new DateFieldSource(field.getName(), field.getType());
}
/** DateField specific range query */
public Query getRangeQuery(QParser parser, SchemaField sf, Date part1, Date part2, boolean minInclusive, boolean maxInclusive) {
- return new TermRangeQuery(
+ return TermRangeQuery.newStringRange(
sf.getName(),
part1 == null ? null : toInternal(part1),
part2 == null ? null : toInternal(part2),
@@ -499,4 +496,4 @@ class DateFieldSource extends FieldCache
public int hashCode() {
return hcode + super.hashCode();
};
-}
\ No newline at end of file
+}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/DoubleField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/DoubleField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/DoubleField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/DoubleField.java Tue Mar 15 21:35:17 2011
@@ -47,7 +47,7 @@ public class DoubleField extends FieldTy
@Override
public ValueSource getValueSource(SchemaField field, QParser qparser) {
- // fieldCache doesn't support double
+ field.checkFieldCacheSource(qparser);
return new DoubleFieldSource( new DoubleValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) );
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/FieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/FieldType.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/FieldType.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/FieldType.java Tue Mar 15 21:35:17 2011
@@ -33,6 +33,7 @@ import org.apache.lucene.util.UnicodeUti
import org.apache.noggit.CharArr;
import org.apache.solr.analysis.SolrAnalyzer;
import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.response.TextResponseWriter;
import org.apache.solr.search.QParser;
import org.apache.solr.search.Sorting;
@@ -418,6 +419,7 @@ public abstract class FieldType extends
* of this type, subclasses can set analyzer themselves or override
* getAnalyzer()
* @see #getAnalyzer
+ * @see #setAnalyzer
*/
protected Analyzer analyzer=new DefaultAnalyzer(256);
@@ -426,6 +428,7 @@ public abstract class FieldType extends
* of this type, subclasses can set analyzer themselves or override
* getAnalyzer()
* @see #getQueryAnalyzer
+ * @see #setQueryAnalyzer
*/
protected Analyzer queryAnalyzer=analyzer;
@@ -451,22 +454,52 @@ public abstract class FieldType extends
return queryAnalyzer;
}
+ private final String analyzerError =
+ "FieldType: " + this.getClass().getSimpleName() +
+ " (" + typeName + ") does not support specifying an analyzer";
+
/**
* Sets the Analyzer to be used when indexing fields of this type.
+ *
+ * <p>
+ * The default implementation throws a SolrException.
+ * Subclasses that override this method need to ensure the behavior
+ * of the analyzer is consistent with the implementation of toInternal.
+ * </p>
+ *
+ * @see #toInternal
+ * @see #setQueryAnalyzer
* @see #getAnalyzer
*/
public void setAnalyzer(Analyzer analyzer) {
- this.analyzer = analyzer;
- log.trace("FieldType: " + typeName + ".setAnalyzer(" + analyzer.getClass().getName() + ")" );
+ SolrException e = new SolrException
+ (ErrorCode.SERVER_ERROR,
+ "FieldType: " + this.getClass().getSimpleName() +
+ " (" + typeName + ") does not support specifying an analyzer");
+ SolrException.logOnce(log,null,e);
+ throw e;
}
/**
* Sets the Analyzer to be used when querying fields of this type.
+ *
+ * <p>
+ * The default implementation throws a SolrException.
+ * Subclasses that override this method need to ensure the behavior
+ * of the analyzer is consistent with the implementation of toInternal.
+ * </p>
+ *
+ * @see #toInternal
+ * @see #setAnalyzer
* @see #getQueryAnalyzer
*/
public void setQueryAnalyzer(Analyzer analyzer) {
- this.queryAnalyzer = analyzer;
- log.trace("FieldType: " + typeName + ".setQueryAnalyzer(" + analyzer.getClass().getName() + ")" );
+ SolrException e = new SolrException
+ (ErrorCode.SERVER_ERROR,
+ "FieldType: " + this.getClass().getSimpleName() +
+ " (" + typeName + ") does not support specifying an analyzer");
+ SolrException.logOnce(log,null,e);
+ throw e;
}
/**
@@ -496,6 +529,7 @@ public abstract class FieldType extends
* Lucene FieldCache.)
*/
public ValueSource getValueSource(SchemaField field, QParser parser) {
+ field.checkFieldCacheSource(parser);
return new StrFieldSource(field.name);
}
@@ -520,7 +554,7 @@ public abstract class FieldType extends
*/
public Query getRangeQuery(QParser parser, SchemaField field, String part1, String part2, boolean minInclusive, boolean maxInclusive) {
// constant score mode is now enabled per default
- return new TermRangeQuery(
+ return TermRangeQuery.newStringRange(
field.getName(),
part1 == null ? null : toInternal(part1),
part2 == null ? null : toInternal(part2),
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/FloatField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/FloatField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/FloatField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/FloatField.java Tue Mar 15 21:35:17 2011
@@ -45,6 +45,7 @@ public class FloatField extends FieldTyp
@Override
public ValueSource getValueSource(SchemaField field, QParser qparser) {
+ field.checkFieldCacheSource(qparser);
return new FloatFieldSource( new FloatValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) );
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/GeoHashField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/GeoHashField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/GeoHashField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/GeoHashField.java Tue Mar 15 21:35:17 2011
@@ -97,6 +97,7 @@ public class GeoHashField extends FieldT
@Override
public ValueSource getValueSource(SchemaField field, QParser parser) {
+ field.checkFieldCacheSource(parser);
return new StrFieldSource(field.name);
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/IndexSchema.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/IndexSchema.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/IndexSchema.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/IndexSchema.java Tue Mar 15 21:35:17 2011
@@ -28,6 +28,7 @@ import org.apache.solr.common.ResourceLo
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.DOMUtil;
+import org.apache.solr.common.util.SystemIdResolver;
import org.apache.solr.core.SolrConfig;
import org.apache.solr.core.Config;
import org.apache.solr.core.SolrResourceLoader;
@@ -39,6 +40,7 @@ import org.apache.solr.search.SolrQueryP
import org.apache.solr.util.plugin.AbstractPluginLoader;
import org.apache.solr.util.plugin.SolrCoreAware;
import org.w3c.dom.*;
+import org.xml.sax.InputSource;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
@@ -101,22 +103,17 @@ public final class IndexSchema {
* By default, this follows the normal config path directory searching rules.
* @see SolrResourceLoader#openResource
*/
- public IndexSchema(SolrConfig solrConfig, String name, InputStream is) {
+ public IndexSchema(SolrConfig solrConfig, String name, InputSource is) {
this.solrConfig = solrConfig;
if (name == null)
name = DEFAULT_SCHEMA_FILE;
this.resourceName = name;
loader = solrConfig.getResourceLoader();
- InputStream lis = is;
- if (lis == null)
- lis = loader.openSchema(name);
- readSchema(lis);
- if (lis != is) {
- try {
- lis.close();
- }
- catch(IOException xio) {} // ignore
+ if (is == null) {
+ is = new InputSource(loader.openSchema(name));
+ is.setSystemId(SystemIdResolver.createSystemIdFromResourceName(name));
}
+ readSchema(is);
loader.inform( loader );
}
@@ -353,7 +350,7 @@ public final class IndexSchema {
}
}
- private void readSchema(InputStream is) {
+ private void readSchema(InputSource is) {
log.info("Reading Solr Schema");
try {
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/IntField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/IntField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/IntField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/IntField.java Tue Mar 15 21:35:17 2011
@@ -45,6 +45,7 @@ public class IntField extends FieldType
@Override
public ValueSource getValueSource(SchemaField field, QParser qparser) {
+ field.checkFieldCacheSource(qparser);
return new IntFieldSource(new IntValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) );
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/LongField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/LongField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/LongField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/LongField.java Tue Mar 15 21:35:17 2011
@@ -47,6 +47,7 @@ public class LongField extends FieldType
@Override
public ValueSource getValueSource(SchemaField field, QParser qparser) {
+ field.checkFieldCacheSource(qparser);
return new LongFieldSource( new LongValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) );
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SchemaField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SchemaField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SchemaField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SchemaField.java Tue Mar 15 21:35:17 2011
@@ -22,6 +22,7 @@ import org.apache.solr.common.SolrExcept
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.search.SortField;
+import org.apache.solr.search.QParser;
import org.apache.solr.response.TextResponseWriter;
@@ -133,8 +134,8 @@ public final class SchemaField extends F
/**
* Sanity checks that the properties of this field type are plausible
- * for a field that may be used in sorting, throwing an appropraite
- * exception (including hte field name) if it is not. FieldType subclasses
+ * for a field that may be used in sorting, throwing an appropriate
+ * exception (including the field name) if it is not. FieldType subclasses
* can choose to call this method in their getSortField implementation
* @see FieldType#getSortField
*/
@@ -149,9 +150,29 @@ public final class SchemaField extends F
"can not sort on multivalued field: "
+ getName());
}
-
}
+ /**
+ * Sanity checks that the properties of this field type are plausible
+ * for a field that may be used to get a FieldCacheSource, throwing
+ * an appropriate exception (including the field name) if it is not.
+ * FieldType subclasses can choose to call this method in their
+ * getValueSource implementation
+ * @see FieldType#getValueSource
+ */
+ public void checkFieldCacheSource(QParser parser) throws SolrException {
+ if (! indexed() ) {
+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
+ "can not use FieldCache on unindexed field: "
+ + getName());
+ }
+ if ( multiValued() ) {
+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
+ "can not use FieldCache on multivalued field: "
+ + getName());
+ }
+
+ }
static SchemaField create(String name, FieldType ft, Map<String,String> props) {
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/ShortField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/ShortField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/ShortField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/ShortField.java Tue Mar 15 21:35:17 2011
@@ -50,7 +50,7 @@ public class ShortField extends FieldTyp
@Override
public ValueSource getValueSource(SchemaField field, QParser qparser) {
-
+ field.checkFieldCacheSource(qparser);
return new ShortFieldSource(new ShortValuesCreator( field.name, null, CachedArrayCreator.CACHE_VALUES_AND_BITS ) );
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableDoubleField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableDoubleField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableDoubleField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableDoubleField.java Tue Mar 15 21:35:17 2011
@@ -53,6 +53,7 @@ public class SortableDoubleField extends
@Override
public ValueSource getValueSource(SchemaField field, QParser qparser) {
+ field.checkFieldCacheSource(qparser);
return new SortableDoubleFieldSource(field.name);
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableFloatField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableFloatField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableFloatField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableFloatField.java Tue Mar 15 21:35:17 2011
@@ -53,6 +53,7 @@ public class SortableFloatField extends
@Override
public ValueSource getValueSource(SchemaField field, QParser qparser) {
+ field.checkFieldCacheSource(qparser);
return new SortableFloatFieldSource(field.name);
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableIntField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableIntField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableIntField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableIntField.java Tue Mar 15 21:35:17 2011
@@ -53,6 +53,7 @@ public class SortableIntField extends Fi
@Override
public ValueSource getValueSource(SchemaField field, QParser qparser) {
+ field.checkFieldCacheSource(qparser);
return new SortableIntFieldSource(field.name);
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableLongField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableLongField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableLongField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/SortableLongField.java Tue Mar 15 21:35:17 2011
@@ -53,6 +53,7 @@ public class SortableLongField extends F
@Override
public ValueSource getValueSource(SchemaField field, QParser qparser) {
+ field.checkFieldCacheSource(qparser);
return new SortableLongFieldSource(field.name);
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/StrField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/StrField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/StrField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/StrField.java Tue Mar 15 21:35:17 2011
@@ -48,6 +48,7 @@ public class StrField extends FieldType
@Override
public ValueSource getValueSource(SchemaField field, QParser parser) {
+ field.checkFieldCacheSource(parser);
return new StrFieldSource(field.getName());
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/TextField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/TextField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/TextField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/TextField.java Tue Mar 15 21:35:17 2011
@@ -84,6 +84,15 @@ public class TextField extends FieldType
return ByteUtils.UTF8toUTF16(term);
}
+ @Override
+ public void setAnalyzer(Analyzer analyzer) {
+ this.analyzer = analyzer;
+ }
+
+ @Override
+ public void setQueryAnalyzer(Analyzer analyzer) {
+ this.queryAnalyzer = analyzer;
+ }
static Query parseFieldQuery(QParser parser, Analyzer analyzer, String field, String queryText) {
int phraseSlop = 0;
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/TrieDateField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/TrieDateField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/TrieDateField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/TrieDateField.java Tue Mar 15 21:35:17 2011
@@ -79,16 +79,23 @@ public class TrieDateField extends DateF
@Override
public SortField getSortField(SchemaField field, boolean top) {
field.checkSortability();
- return new SortField(new LongValuesCreator( field.getName(), FieldCache.NUMERIC_UTILS_LONG_PARSER, CachedArrayCreator.CACHE_VALUES_AND_BITS ), top);
- }
- @Override
- public ValueSource getValueSource(SchemaField field) {
- return new TrieDateFieldSource( new LongValuesCreator( field.getName(), FieldCache.NUMERIC_UTILS_LONG_PARSER, CachedArrayCreator.CACHE_VALUES_AND_BITS ));
+ int flags = CachedArrayCreator.CACHE_VALUES_AND_BITS;
+ boolean sortMissingLast = field.sortMissingLast();
+ boolean sortMissingFirst = field.sortMissingFirst();
+
+ Object missingValue = null;
+ if( sortMissingLast ) {
+ missingValue = top ? Long.MIN_VALUE : Long.MAX_VALUE;
+ } else if( sortMissingFirst ) {
+ missingValue = top ? Long.MAX_VALUE : Long.MIN_VALUE;
+ }
+ return new SortField(new LongValuesCreator(field.getName(), FieldCache.NUMERIC_UTILS_LONG_PARSER, flags), top).setMissingValue(missingValue);
}
@Override
public ValueSource getValueSource(SchemaField field, QParser parser) {
+ field.checkFieldCacheSource(parser);
return new TrieDateFieldSource( new LongValuesCreator( field.getName(), FieldCache.NUMERIC_UTILS_LONG_PARSER, CachedArrayCreator.CACHE_VALUES_AND_BITS ));
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/TrieField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/TrieField.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/TrieField.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/schema/TrieField.java Tue Mar 15 21:35:17 2011
@@ -127,8 +127,8 @@ public class TrieField extends FieldType
int flags = CachedArrayCreator.CACHE_VALUES_AND_BITS;
Object missingValue = null;
- boolean sortMissingLast = on( SORT_MISSING_LAST, properties );
- boolean sortMissingFirst = on( SORT_MISSING_FIRST, properties );
+ boolean sortMissingLast = field.sortMissingLast();
+ boolean sortMissingFirst = field.sortMissingFirst();
switch (type) {
case INTEGER:
@@ -179,6 +179,7 @@ public class TrieField extends FieldType
@Override
public ValueSource getValueSource(SchemaField field, QParser qparser) {
+ field.checkFieldCacheSource(qparser);
int flags = CachedArrayCreator.CACHE_VALUES_AND_BITS;
switch (type) {
case INTEGER:
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java Tue Mar 15 21:35:17 2011
@@ -48,6 +48,7 @@ import java.io.IOException;
/**
* An advanced multi-field query parser.
+ * @lucene.experimental
*/
public class ExtendedDismaxQParserPlugin extends QParserPlugin {
public static final String NAME = "edismax";
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/QueryParsing.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/QueryParsing.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/QueryParsing.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/QueryParsing.java Tue Mar 15 21:35:17 2011
@@ -398,8 +398,8 @@ public class QueryParsing {
String fname = q.getField();
FieldType ft = writeFieldName(fname, schema, out, flags);
out.append(q.includesLower() ? '[' : '{');
- String lt = q.getLowerTerm();
- String ut = q.getUpperTerm();
+ String lt = q.getLowerTerm().utf8ToString();
+ String ut = q.getUpperTerm().utf8ToString();
if (lt == null) {
out.append('*');
} else {
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/ValueSourceParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/ValueSourceParser.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/ValueSourceParser.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/ValueSourceParser.java Tue Mar 15 21:35:17 2011
@@ -117,14 +117,6 @@ public abstract class ValueSourceParser
return new LinearFloatFunction(source, slope, intercept);
}
});
- addParser("max", new ValueSourceParser() {
- @Override
- public ValueSource parse(FunctionQParser fp) throws ParseException {
- ValueSource source = fp.parseValueSource();
- float val = fp.parseFloat();
- return new MaxFloatFunction(source, val);
- }
- });
addParser("recip", new ValueSourceParser() {
@Override
public ValueSource parse(FunctionQParser fp) throws ParseException {
@@ -476,6 +468,18 @@ public abstract class ValueSourceParser
return Math.atan2(a.doubleVal(doc), b.doubleVal(doc));
}
});
+ addParser(new Double2Parser("max") {
+ @Override
+ public double func(int doc, DocValues a, DocValues b) {
+ return Math.max(a.doubleVal(doc), b.doubleVal(doc));
+ }
+ });
+ addParser(new Double2Parser("min") {
+ @Override
+ public double func(int doc, DocValues a, DocValues b) {
+ return Math.min(a.doubleVal(doc), b.doubleVal(doc));
+ }
+ });
addParser("sqedist", new ValueSourceParser() {
@Override
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/ValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/ValueSource.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/ValueSource.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/search/function/ValueSource.java Tue Mar 15 21:35:17 2011
@@ -90,7 +90,6 @@ public abstract class ValueSource implem
/**
* EXPERIMENTAL: This method is subject to change.
- * <br>WARNING: Sorted function queries are not currently weighted.
* <p>
* Get the SortField for this ValueSource. Uses the {@link #getValues(java.util.Map, IndexReader.AtomicReaderContext)}
* to populate the SortField.
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/Lookup.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/Lookup.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/Lookup.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/Lookup.java Tue Mar 15 21:35:17 2011
@@ -39,7 +39,7 @@ public abstract class Lookup {
public static final class LookupPriorityQueue extends PriorityQueue<LookupResult> {
public LookupPriorityQueue(int size) {
- initialize(size);
+ super(size);
}
@Override
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/Suggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/Suggester.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/Suggester.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/Suggester.java Tue Mar 15 21:35:17 2011
@@ -83,6 +83,8 @@ public class Suggester extends SolrSpell
if (lookupImpl == null) {
lookupImpl = JaspellLookup.class.getName();
}
+ lookup = (Lookup) core.getResourceLoader().newInstance(lookupImpl);
+ lookup.init(config, core);
String store = (String)config.get(STORE_DIR);
if (store != null) {
storeDir = new File(store);
@@ -91,6 +93,13 @@ public class Suggester extends SolrSpell
}
if (!storeDir.exists()) {
storeDir.mkdirs();
+ } else {
+ // attempt reload of the stored lookup
+ try {
+ lookup.load(storeDir);
+ } catch (IOException e) {
+ LOG.warn("Loading stored lookup data failed", e);
+ }
}
}
return name;
@@ -107,17 +116,17 @@ public class Suggester extends SolrSpell
dictionary = new FileDictionary(new InputStreamReader(
core.getResourceLoader().openResource(sourceLocation), "UTF-8"));
} catch (UnsupportedEncodingException e) {
- e.printStackTrace();
+ // should not happen
+ LOG.error("should not happen", e);
}
}
- lookup = (Lookup) core.getResourceLoader().newInstance(lookupImpl);
try {
lookup.build(dictionary);
if (storeDir != null) {
lookup.store(storeDir);
}
} catch (Exception e) {
- e.printStackTrace();
+ LOG.error("Error while building or storing Suggester data", e);
}
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/jaspell/JaspellLookup.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/jaspell/JaspellLookup.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/jaspell/JaspellLookup.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/jaspell/JaspellLookup.java Tue Mar 15 21:35:17 2011
@@ -1,6 +1,10 @@
package org.apache.solr.spelling.suggest.jaspell;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -9,6 +13,7 @@ import org.apache.solr.common.util.Named
import org.apache.solr.core.SolrCore;
import org.apache.solr.spelling.suggest.Lookup;
import org.apache.solr.spelling.suggest.UnsortedTermFreqIteratorWrapper;
+import org.apache.solr.spelling.suggest.jaspell.JaspellTernarySearchTrie.TSTNode;
import org.apache.solr.util.SortedIterator;
import org.apache.solr.util.TermFreqIterator;
import org.slf4j.Logger;
@@ -16,7 +21,7 @@ import org.slf4j.LoggerFactory;
public class JaspellLookup extends Lookup {
private static final Logger LOG = LoggerFactory.getLogger(JaspellLookup.class);
- JaspellTernarySearchTrie trie;
+ JaspellTernarySearchTrie trie = new JaspellTernarySearchTrie();
private boolean usePrefix = true;
private int editDistance = 2;
@@ -89,14 +94,89 @@ public class JaspellLookup extends Looku
return res;
}
+ public static final String FILENAME = "jaspell.dat";
+ private static final byte LO_KID = 0x01;
+ private static final byte EQ_KID = 0x02;
+ private static final byte HI_KID = 0x04;
+ private static final byte HAS_VALUE = 0x08;
+
+
@Override
public boolean load(File storeDir) throws IOException {
- return false;
+ File data = new File(storeDir, FILENAME);
+ if (!data.exists() || !data.canRead()) {
+ return false;
+ }
+ DataInputStream in = new DataInputStream(new FileInputStream(data));
+ TSTNode root = trie.new TSTNode('\0', null);
+ try {
+ readRecursively(in, root);
+ trie.setRoot(root);
+ } finally {
+ in.close();
+ }
+ return true;
+ }
+
+ private void readRecursively(DataInputStream in, TSTNode node) throws IOException {
+ node.splitchar = in.readChar();
+ byte mask = in.readByte();
+ if ((mask & HAS_VALUE) != 0) {
+ node.data = new Float(in.readFloat());
+ }
+ if ((mask & LO_KID) != 0) {
+ TSTNode kid = trie.new TSTNode('\0', node);
+ node.relatives[TSTNode.LOKID] = kid;
+ readRecursively(in, kid);
+ }
+ if ((mask & EQ_KID) != 0) {
+ TSTNode kid = trie.new TSTNode('\0', node);
+ node.relatives[TSTNode.EQKID] = kid;
+ readRecursively(in, kid);
+ }
+ if ((mask & HI_KID) != 0) {
+ TSTNode kid = trie.new TSTNode('\0', node);
+ node.relatives[TSTNode.HIKID] = kid;
+ readRecursively(in, kid);
+ }
}
@Override
public boolean store(File storeDir) throws IOException {
- return false;
+ if (!storeDir.exists() || !storeDir.isDirectory() || !storeDir.canWrite()) {
+ return false;
+ }
+ TSTNode root = trie.getRoot();
+ if (root == null) { // empty tree
+ return false;
+ }
+ File data = new File(storeDir, FILENAME);
+ DataOutputStream out = new DataOutputStream(new FileOutputStream(data));
+ try {
+ writeRecursively(out, root);
+ out.flush();
+ } finally {
+ out.close();
+ }
+ return true;
+ }
+
+ private void writeRecursively(DataOutputStream out, TSTNode node) throws IOException {
+ if (node == null) {
+ return;
+ }
+ out.writeChar(node.splitchar);
+ byte mask = 0;
+ if (node.relatives[TSTNode.LOKID] != null) mask |= LO_KID;
+ if (node.relatives[TSTNode.EQKID] != null) mask |= EQ_KID;
+ if (node.relatives[TSTNode.HIKID] != null) mask |= HI_KID;
+ if (node.data != null) mask |= HAS_VALUE;
+ out.writeByte(mask);
+ if (node.data != null) {
+ out.writeFloat((Float)node.data);
+ }
+ writeRecursively(out, node.relatives[TSTNode.LOKID]);
+ writeRecursively(out, node.relatives[TSTNode.EQKID]);
+ writeRecursively(out, node.relatives[TSTNode.HIKID]);
}
-
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/jaspell/JaspellTernarySearchTrie.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/jaspell/JaspellTernarySearchTrie.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/jaspell/JaspellTernarySearchTrie.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/jaspell/JaspellTernarySearchTrie.java Tue Mar 15 21:35:17 2011
@@ -127,6 +127,16 @@ public class JaspellTernarySearchTrie {
*/
public JaspellTernarySearchTrie() {
}
+
+ // for loading
+ void setRoot(TSTNode newRoot) {
+ rootNode = newRoot;
+ }
+
+ // for saving
+ TSTNode getRoot() {
+ return rootNode;
+ }
/**
* Constructs a Ternary Search Trie and loads data from a <code>File</code>
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/tst/TSTLookup.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/tst/TSTLookup.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/tst/TSTLookup.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/spelling/suggest/tst/TSTLookup.java Tue Mar 15 21:35:17 2011
@@ -1,6 +1,10 @@
package org.apache.solr.spelling.suggest.tst;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -13,8 +17,8 @@ import org.apache.solr.util.SortedIterat
import org.apache.solr.util.TermFreqIterator;
public class TSTLookup extends Lookup {
- TernaryTreeNode root;
- TSTAutocomplete autocomplete;
+ TernaryTreeNode root = new TernaryTreeNode();
+ TSTAutocomplete autocomplete = new TSTAutocomplete();
@Override
public void init(NamedList config, SolrCore core) {
@@ -23,7 +27,6 @@ public class TSTLookup extends Lookup {
@Override
public void build(TermFreqIterator tfit) throws IOException {
root = new TernaryTreeNode();
- autocomplete = new TSTAutocomplete();
// buffer first
if (!(tfit instanceof SortedIterator)) {
// make sure it's sorted
@@ -48,7 +51,16 @@ public class TSTLookup extends Lookup {
@Override
public Object get(String key) {
- throw new UnsupportedOperationException("get() is not supported here");
+ List<TernaryTreeNode> list = autocomplete.prefixCompletion(root, key, 0);
+ if (list == null || list.isEmpty()) {
+ return null;
+ }
+ for (TernaryTreeNode n : list) {
+ if (n.token.equals(key)) {
+ return n.val;
+ }
+ }
+ return null;
}
@Override
@@ -75,15 +87,94 @@ public class TSTLookup extends Lookup {
}
return res;
}
+
+ public static final String FILENAME = "tst.dat";
+
+ private static final byte LO_KID = 0x01;
+ private static final byte EQ_KID = 0x02;
+ private static final byte HI_KID = 0x04;
+ private static final byte HAS_TOKEN = 0x08;
+ private static final byte HAS_VALUE = 0x10;
@Override
- public boolean load(File storeDir) throws IOException {
- return false;
+ public synchronized boolean load(File storeDir) throws IOException {
+ File data = new File(storeDir, FILENAME);
+ if (!data.exists() || !data.canRead()) {
+ return false;
+ }
+ DataInputStream in = new DataInputStream(new FileInputStream(data));
+ root = new TernaryTreeNode();
+ try {
+ readRecursively(in, root);
+ } finally {
+ in.close();
+ }
+ return true;
+ }
+
+ // pre-order traversal
+ private void readRecursively(DataInputStream in, TernaryTreeNode node) throws IOException {
+ node.splitchar = in.readChar();
+ byte mask = in.readByte();
+ if ((mask & HAS_TOKEN) != 0) {
+ node.token = in.readUTF();
+ }
+ if ((mask & HAS_VALUE) != 0) {
+ node.val = new Float(in.readFloat());
+ }
+ if ((mask & LO_KID) != 0) {
+ node.loKid = new TernaryTreeNode();
+ readRecursively(in, node.loKid);
+ }
+ if ((mask & EQ_KID) != 0) {
+ node.eqKid = new TernaryTreeNode();
+ readRecursively(in, node.eqKid);
+ }
+ if ((mask & HI_KID) != 0) {
+ node.hiKid = new TernaryTreeNode();
+ readRecursively(in, node.hiKid);
+ }
}
@Override
- public boolean store(File storeDir) throws IOException {
- return false;
+ public synchronized boolean store(File storeDir) throws IOException {
+ if (!storeDir.exists() || !storeDir.isDirectory() || !storeDir.canWrite()) {
+ return false;
+ }
+ File data = new File(storeDir, FILENAME);
+ DataOutputStream out = new DataOutputStream(new FileOutputStream(data));
+ try {
+ writeRecursively(out, root);
+ out.flush();
+ } finally {
+ out.close();
+ }
+ return true;
+ }
+
+ // pre-order traversal
+ private void writeRecursively(DataOutputStream out, TernaryTreeNode node) throws IOException {
+ // write out the current node
+ out.writeChar(node.splitchar);
+ // prepare a mask of kids
+ byte mask = 0;
+ if (node.eqKid != null) mask |= EQ_KID;
+ if (node.loKid != null) mask |= LO_KID;
+ if (node.hiKid != null) mask |= HI_KID;
+ if (node.token != null) mask |= HAS_TOKEN;
+ if (node.val != null) mask |= HAS_VALUE;
+ out.writeByte(mask);
+ if (node.token != null) out.writeUTF(node.token);
+ if (node.val != null) out.writeFloat((Float)node.val);
+ // recurse and write kids
+ if (node.loKid != null) {
+ writeRecursively(out, node.loKid);
+ }
+ if (node.eqKid != null) {
+ writeRecursively(out, node.eqKid);
+ }
+ if (node.hiKid != null) {
+ writeRecursively(out, node.hiKid);
+ }
}
-
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java Tue Mar 15 21:35:17 2011
@@ -91,7 +91,9 @@ public class DirectUpdateHandler2 extend
public DirectUpdateHandler2(SolrCore core) throws IOException {
super(core);
- ReadWriteLock rwl = new ReentrantReadWriteLock();
+ // Pass fairness=true so commit request is not starved
+ // when add/updates are running hot (SOLR-2342):
+ ReadWriteLock rwl = new ReentrantReadWriteLock(true);
iwAccess = rwl.readLock();
iwCommit = rwl.writeLock();
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DocumentBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DocumentBuilder.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DocumentBuilder.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/update/DocumentBuilder.java Tue Mar 15 21:35:17 2011
@@ -206,6 +206,15 @@ public class DocumentBuilder {
}
}
+ private static String getID( SolrInputDocument doc, IndexSchema schema )
+ {
+ String id = "";
+ SchemaField sf = schema.getUniqueKeyField();
+ if( sf != null ) {
+ id = "[doc="+doc.getFieldValue( sf.getName() )+"] ";
+ }
+ return id;
+ }
/**
* Convert a SolrInputDocument to a lucene Document.
@@ -235,91 +244,93 @@ public class DocumentBuilder {
// Make sure it has the correct number
if( sfield!=null && !sfield.multiValued() && field.getValueCount() > 1 ) {
- String id = "";
- SchemaField sf = schema.getUniqueKeyField();
- if( sf != null ) {
- id = "["+doc.getFieldValue( sf.getName() )+"] ";
- }
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
- "ERROR: "+id+"multiple values encountered for non multiValued field " +
+ "ERROR: "+getID(doc, schema)+"multiple values encountered for non multiValued field " +
sfield.getName() + ": " +field.getValue() );
}
// load each field value
boolean hasField = false;
- for( Object v : field ) {
- if( v == null ) {
- continue;
- }
- String val = null;
- hasField = true;
- boolean isBinaryField = false;
- if (sfield != null && sfield.getType() instanceof BinaryField) {
- isBinaryField = true;
- BinaryField binaryField = (BinaryField) sfield.getType();
- Fieldable f = binaryField.createField(sfield,v,boost);
- if(f != null){
- out.add(f);
- }
- used = true;
- } else {
- // TODO!!! HACK -- date conversion
- if (sfield != null && v instanceof Date && sfield.getType() instanceof DateField) {
- DateField df = (DateField) sfield.getType();
- val = df.toInternal((Date) v) + 'Z';
- } else if (v != null) {
- val = v.toString();
- }
-
- if (sfield != null) {
- used = true;
- addField(out, sfield, val, boost);
- }
- }
-
- // Check if we should copy this field to any other fields.
- // This could happen whether it is explicit or not.
- List<CopyField> copyFields = schema.getCopyFieldsList(name);
- for (CopyField cf : copyFields) {
- SchemaField destinationField = cf.getDestination();
- // check if the copy field is a multivalued or not
- if (!destinationField.multiValued() && out.get(destinationField.getName()) != null) {
- throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
- "ERROR: multiple values encountered for non multiValued copy field " +
- destinationField.getName() + ": " + val);
- }
-
- used = true;
- //Don't worry about poly fields here
- Fieldable [] fields = null;
- if (isBinaryField) {
- if (destinationField.getType() instanceof BinaryField) {
- BinaryField binaryField = (BinaryField) destinationField.getType();
- //TODO: safe to assume that binary fields only create one?
- fields = new Fieldable[]{binaryField.createField(destinationField, v, boost)};
+ try {
+ for( Object v : field ) {
+ if( v == null ) {
+ continue;
+ }
+ String val = null;
+ hasField = true;
+ boolean isBinaryField = false;
+ if (sfield != null && sfield.getType() instanceof BinaryField) {
+ isBinaryField = true;
+ BinaryField binaryField = (BinaryField) sfield.getType();
+ Fieldable f = binaryField.createField(sfield,v,boost);
+ if(f != null){
+ out.add(f);
}
+ used = true;
} else {
- fields = destinationField.createFields(cf.getLimitedValue(val), boost);
+ // TODO!!! HACK -- date conversion
+ if (sfield != null && v instanceof Date && sfield.getType() instanceof DateField) {
+ DateField df = (DateField) sfield.getType();
+ val = df.toInternal((Date) v) + 'Z';
+ } else if (v != null) {
+ val = v.toString();
+ }
+
+ if (sfield != null) {
+ used = true;
+ addField(out, sfield, val, boost);
+ }
}
- if (fields != null) { // null fields are not added
- for (Fieldable f : fields) {
- out.add(f);
+
+ // Check if we should copy this field to any other fields.
+ // This could happen whether it is explicit or not.
+ List<CopyField> copyFields = schema.getCopyFieldsList(name);
+ for (CopyField cf : copyFields) {
+ SchemaField destinationField = cf.getDestination();
+ // check if the copy field is a multivalued or not
+ if (!destinationField.multiValued() && out.get(destinationField.getName()) != null) {
+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
+ "ERROR: "+getID(doc, schema)+"multiple values encountered for non multiValued copy field " +
+ destinationField.getName() + ": " + val);
+ }
+
+ used = true;
+ //Don't worry about poly fields here
+ Fieldable [] fields = null;
+ if (isBinaryField) {
+ if (destinationField.getType() instanceof BinaryField) {
+ BinaryField binaryField = (BinaryField) destinationField.getType();
+ //TODO: safe to assume that binary fields only create one?
+ fields = new Fieldable[]{binaryField.createField(destinationField, v, boost)};
+ }
+ } else {
+ fields = destinationField.createFields(cf.getLimitedValue(val), boost);
+ }
+ if (fields != null) { // null fields are not added
+ for (Fieldable f : fields) {
+ out.add(f);
+ }
}
}
+
+ // In lucene, the boost for a given field is the product of the
+ // document boost and *all* boosts on values of that field.
+ // For multi-valued fields, we only want to set the boost on the
+ // first field.
+ boost = 1.0f;
}
-
- // In lucene, the boost for a given field is the product of the
- // document boost and *all* boosts on values of that field.
- // For multi-valued fields, we only want to set the boost on the
- // first field.
- boost = 1.0f;
+ }
+ catch( Exception ex ) {
+ throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
+ "ERROR: "+getID(doc, schema)+"Error adding field '" +
+ field.getName() + "'='" +field.getValue()+"'", ex );
}
// make sure the field was used somehow...
if( !used && hasField ) {
- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"ERROR:unknown field '" +
- name + "'");
+ throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
+ "ERROR: "+getID(doc, schema)+"unknown field '" +name + "'");
}
}
@@ -332,8 +343,7 @@ public class DocumentBuilder {
addField(out, field, field.getDefaultValue(), 1.0f);
}
else {
- String id = schema.printableUniqueKey( out );
- String msg = "Document ["+id+"] missing required field: " + field.getName();
+ String msg = getID(doc, schema) + "missing required field: " + field.getName();
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, msg );
}
}
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/xslt/TransformerProvider.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/xslt/TransformerProvider.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/xslt/TransformerProvider.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/util/xslt/TransformerProvider.java Tue Mar 15 21:35:17 2011
@@ -21,6 +21,7 @@ import java.io.IOException;
import java.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.commons.io.IOUtils;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
@@ -29,6 +30,8 @@ import javax.xml.transform.TransformerFa
import javax.xml.transform.stream.StreamSource;
import org.apache.solr.common.ResourceLoader;
+import org.apache.solr.common.util.SystemIdResolver;
+import org.apache.solr.common.util.XMLErrorLogger;
import org.apache.solr.core.SolrConfig;
/** Singleton that creates a Transformer for the XSLTServletFilter.
@@ -40,19 +43,17 @@ import org.apache.solr.core.SolrConfig;
*/
public class TransformerProvider {
- public static TransformerProvider instance = new TransformerProvider();
-
- private final TransformerFactory tFactory = TransformerFactory.newInstance();
private String lastFilename;
private Templates lastTemplates = null;
private long cacheExpires = 0;
- private static Logger log;
+ private static final Logger log = LoggerFactory.getLogger(TransformerProvider.class.getName());
+ private static final XMLErrorLogger xmllog = new XMLErrorLogger(log);
+ public static TransformerProvider instance = new TransformerProvider();
+
/** singleton */
private TransformerProvider() {
- log = LoggerFactory.getLogger(TransformerProvider.class.getName());
-
// tell'em: currently, we only cache the last used XSLT transform, and blindly recompile it
// once cacheLifetimeSeconds expires
log.warn(
@@ -99,8 +100,18 @@ public class TransformerProvider {
if(log.isDebugEnabled()) {
log.debug("compiling XSLT templates:" + filename);
}
- final InputStream xsltStream = loader.openResource("xslt/" + filename);
- result = tFactory.newTemplates(new StreamSource(xsltStream));
+ final String fn = "xslt/" + filename;
+ final TransformerFactory tFactory = TransformerFactory.newInstance();
+ tFactory.setURIResolver(new SystemIdResolver(loader).asURIResolver());
+ tFactory.setErrorListener(xmllog);
+ final StreamSource src = new StreamSource(loader.openResource(fn),
+ SystemIdResolver.createSystemIdFromResourceName(fn));
+ try {
+ result = tFactory.newTemplates(src);
+ } finally {
+ // some XML parsers are broken and don't close the byte stream (but they should according to spec)
+ IOUtils.closeQuietly(src.getInputStream());
+ }
} catch (Exception e) {
log.error(getClass().getName(), "newTemplates", e);
final IOException ioe = new IOException("Unable to initialize Templates '" + filename + "'");
Modified: lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java Tue Mar 15 21:35:17 2011
@@ -178,6 +178,8 @@ public class StreamingUpdateSolrServer e
// remove it from the list of running things unless we are the last runner and the queue is full...
// in which case, the next queue.put() would block and there would be no runners to handle it.
+ // This case has been further handled by using offer instead of put, and using a retry loop
+ // to avoid blocking forever (see request()).
synchronized (runners) {
if (runners.size() == 1 && queue.remainingCapacity() == 0) {
// keep this runner alive
@@ -223,18 +225,40 @@ public class StreamingUpdateSolrServer e
tmpLock.await();
}
- queue.put( req );
+ boolean success = queue.offer(req);
- synchronized( runners ) {
- if( runners.isEmpty()
- || (queue.remainingCapacity() < queue.size()
- && runners.size() < threadCount) )
- {
- Runner r = new Runner();
- scheduler.execute( r );
- runners.add( r );
+ for(;;) {
+ synchronized( runners ) {
+ if( runners.isEmpty()
+ || (queue.remainingCapacity() < queue.size() // queue is half full and we can add more runners
+ && runners.size() < threadCount) )
+ {
+ // We need more runners, so start a new one.
+ Runner r = new Runner();
+ runners.add( r );
+ scheduler.execute( r );
+ } else {
+ // break out of the retry loop if we added the element to the queue successfully, *and*
+ // while we are still holding the runners lock to prevent race conditions.
+ // race conditions.
+ if (success) break;
+ }
+ }
+
+ // Retry to add to the queue w/o the runners lock held (else we risk temporary deadlock)
+ // This retry could also fail because
+ // 1) existing runners were not able to take off any new elements in the queue
+ // 2) the queue was filled back up since our last try
+ // If we succeed, the queue may have been completely emptied, and all runners stopped.
+ // In all cases, we should loop back to the top to see if we need to start more runners.
+ //
+ if (!success) {
+ success = queue.offer(req, 100, TimeUnit.MILLISECONDS);
}
+
}
+
+
}
catch (InterruptedException e) {
log.error( "interrupted", e );
Modified: lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/XMLResponseParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/XMLResponseParser.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/XMLResponseParser.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/impl/XMLResponseParser.java Tue Mar 15 21:35:17 2011
@@ -39,6 +39,7 @@ import org.apache.solr.common.SolrDocume
import org.apache.solr.common.SolrException;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
+import org.apache.solr.common.util.XMLErrorLogger;
/**
*
@@ -48,6 +49,7 @@ import org.apache.solr.common.util.Simpl
public class XMLResponseParser extends ResponseParser
{
public static Logger log = LoggerFactory.getLogger(XMLResponseParser.class);
+ private static final XMLErrorLogger xmllog = new XMLErrorLogger(log);
// reuse the factory among all parser instances so things like string caches
// won't be duplicated
@@ -68,6 +70,7 @@ public class XMLResponseParser extends R
// isimplementation specific.
log.debug( "Unable to set the 'reuse-instance' property for the input factory: "+factory );
}
+ factory.setXMLReporter(xmllog);
}
public XMLResponseParser() {}
Modified: lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/util/ClientUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/util/ClientUtils.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/util/ClientUtils.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/solrj/org/apache/solr/client/solrj/util/ClientUtils.java Tue Mar 15 21:35:17 2011
@@ -48,7 +48,7 @@ import org.apache.solr.common.util.*;
public class ClientUtils
{
// Standard Content types
- public static final String TEXT_XML = "text/xml; charset=utf-8";
+ public static final String TEXT_XML = "application/xml; charset=UTF-8";
/**
* Take a string and make it an iterable ContentStream
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/schema.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/schema.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/schema.xml Tue Mar 15 21:35:17 2011
@@ -385,7 +385,7 @@
<fieldType name="x" class="solr.PointType" dimension="1" subFieldType="double"/>
<fieldType name="tenD" class="solr.PointType" dimension="10" subFieldType="double"/>
<!-- Use the sub field suffix -->
- <fieldType name="xyd" class="solr.PointType" dimension="2" subFieldSuffix="*_d"/>
+ <fieldType name="xyd" class="solr.PointType" dimension="2" subFieldSuffix="_d1"/>
<fieldtype name="geohash" class="solr.GeoHashField"/>
@@ -533,6 +533,7 @@
<dynamicField name="*_tf1" type="tfloat" indexed="true" stored="true" multiValued="false"/>
<dynamicField name="*_td" type="tdouble" indexed="true" stored="true"/>
<dynamicField name="*_td1" type="tdouble" indexed="true" stored="true" multiValued="false"/>
+ <dynamicField name="*_tds" type="tdouble" indexed="true" stored="true" multiValued="false"/>
<dynamicField name="*_tdt" type="tdate" indexed="true" stored="true"/>
<dynamicField name="*_tdt1" type="tdate" indexed="true" stored="true" multiValued="false"/>
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-elevate.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-elevate.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-elevate.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-elevate.xml Tue Mar 15 21:35:17 2011
@@ -29,7 +29,7 @@
<!-- Used to specify an alternate directory to hold all index data.
It defaults to "index" if not present, and should probably
not be changed if replication is in use. -->
- <dataDir>${solr.data.dir:./solr/data}</dataDir>
+ <dataDir>${solr.data.dir:}</dataDir>
<!-- The DirectoryFactory to use for indexes.
solr.StandardDirectoryFactory, the default, is filesystem based.
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-enableplugin.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-enableplugin.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-enableplugin.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-enableplugin.xml Tue Mar 15 21:35:17 2011
@@ -24,7 +24,7 @@
<config>
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
- <dataDir>${solr.data.dir:./solr/data}</dataDir>
+ <dataDir>${solr.data.dir:}</dataDir>
<!-- The DirectoryFactory to use for indexes.
solr.StandardDirectoryFactory, the default, is filesystem based.
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-master.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-master.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-master.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-master.xml Tue Mar 15 21:35:17 2011
@@ -25,7 +25,7 @@
<config>
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
- <dataDir>${solr.data.dir:./solr/data}</dataDir>
+ <dataDir>${solr.data.dir:}</dataDir>
<indexDefaults>
<useCompoundFile>false</useCompoundFile>
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-master1.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-master1.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-master1.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-master1.xml Tue Mar 15 21:35:17 2011
@@ -24,7 +24,7 @@
<config>
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
- <dataDir>${solr.data.dir:./solr/data}</dataDir>
+ <dataDir>${solr.data.dir:}</dataDir>
<indexDefaults>
<useCompoundFile>false</useCompoundFile>
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-master2.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-master2.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-master2.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-master2.xml Tue Mar 15 21:35:17 2011
@@ -24,7 +24,7 @@
<config>
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
- <dataDir>${solr.data.dir:./solr/data}</dataDir>
+ <dataDir>${solr.data.dir:}</dataDir>
<indexDefaults>
<useCompoundFile>false</useCompoundFile>
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-repeater.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-repeater.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-repeater.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-repeater.xml Tue Mar 15 21:35:17 2011
@@ -25,7 +25,7 @@
<config>
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
- <dataDir>${solr.data.dir:./solr/data}</dataDir>
+ <dataDir>${solr.data.dir:}</dataDir>
<indexDefaults>
<useCompoundFile>false</useCompoundFile>
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-slave.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-slave.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-slave.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-slave.xml Tue Mar 15 21:35:17 2011
@@ -25,7 +25,7 @@
<config>
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
- <dataDir>${solr.data.dir:./solr/data}</dataDir>
+ <dataDir>${solr.data.dir:}</dataDir>
<indexDefaults>
<useCompoundFile>false</useCompoundFile>
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-slave1.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-slave1.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-slave1.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-slave1.xml Tue Mar 15 21:35:17 2011
@@ -24,7 +24,7 @@
<config>
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
- <dataDir>${solr.data.dir:./solr/data}</dataDir>
+ <dataDir>${solr.data.dir:}</dataDir>
<indexDefaults>
<useCompoundFile>false</useCompoundFile>
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-solcoreproperties.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-solcoreproperties.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-solcoreproperties.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-solcoreproperties.xml Tue Mar 15 21:35:17 2011
@@ -24,7 +24,7 @@
<config>
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
- <dataDir>${solr.data.dir:./solr/data}</dataDir>
+ <dataDir>${solr.data.dir:}</dataDir>
<!-- The DirectoryFactory to use for indexes.
solr.StandardDirectoryFactory, the default, is filesystem based.
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-spellcheckcomponent.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-spellcheckcomponent.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-spellcheckcomponent.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-spellcheckcomponent.xml Tue Mar 15 21:35:17 2011
@@ -32,7 +32,7 @@ Config for testing spellcheck component
<!-- Used to specify an alternate directory to hold all index data.
It defaults to "index" if not present, and should probably
not be changed if replication is in use. -->
- <dataDir>${solr.data.dir:./solr/data}</dataDir>
+ <dataDir>${solr.data.dir:}</dataDir>
<!-- The DirectoryFactory to use for indexes.
solr.StandardDirectoryFactory, the default, is filesystem based.
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-spellchecker.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-spellchecker.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-spellchecker.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-spellchecker.xml Tue Mar 15 21:35:17 2011
@@ -37,6 +37,7 @@
<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.jaspell.JaspellLookup</str>
<str name="field">suggest</str>
+ <str name="storeDir">suggest</str>
<str name="buildOnCommit">true</str>
<!-- Suggester properties -->
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-xinclude.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-xinclude.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-xinclude.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig-xinclude.xml Tue Mar 15 21:35:17 2011
@@ -19,6 +19,10 @@
<config>
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
- <!-- FIXME: is there a way to make this test *not* depend on the CWD? -->
- <xi:include href="solrconfig-reqHandler.incl" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+
+ <xi:include href="foobar-missing.xml" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xi:fallback>
+ <xi:include href="solrconfig-reqHandler.incl" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+ </xi:fallback>
+ </xi:include>
</config>
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig.xml Tue Mar 15 21:35:17 2011
@@ -43,7 +43,7 @@
<!-- Used to specify an alternate directory to hold all index data.
It defaults to "index" if not present, and should probably
not be changed if replication is in use. -->
- <dataDir>${solr.data.dir:./solr/data}</dataDir>
+ <dataDir>${solr.data.dir:}</dataDir>
<!-- The DirectoryFactory to use for indexes.
solr.StandardDirectoryFactory, the default, is filesystem based.
Modified: lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig_perf.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig_perf.xml?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig_perf.xml (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test-files/solr/conf/solrconfig_perf.xml Tue Mar 15 21:35:17 2011
@@ -21,7 +21,7 @@
<!-- Used to specify an alternate directory to hold all index data
other than the default ./data under the Solr home.
If replication is in use, this should match the replication configuration. -->
- <dataDir>${solr.data.dir:./solr/data}</dataDir>
+ <dataDir>${solr.data.dir:}</dataDir>
<!-- The DirectoryFactory to use for indexes.
solr.StandardDirectoryFactory, the default, is filesystem based.
Modified: lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/BasicFunctionalityTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/BasicFunctionalityTest.java?rev=1081952&r1=1081951&r2=1081952&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/BasicFunctionalityTest.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/test/org/apache/solr/BasicFunctionalityTest.java Tue Mar 15 21:35:17 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",
@@ -675,6 +675,7 @@ public class BasicFunctionalityTest exte
assertU(commit());
try {
+ ignoreException("can not sort on multivalued field: sortabuse_t");
assertQ("sort on something that shouldn't work",
req("q", "sortabuse_b:true",
"sort", "sortabuse_t asc"),