mirror of https://github.com/apache/lucene.git
SOLR-1930: fully move from Field to Fieldable in interfaces
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1054763 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
64e6e196ac
commit
3fa3cf5493
|
@ -50,7 +50,7 @@ public class BinaryField extends FieldType {
|
|||
return ByteBuffer.wrap(f.getBinaryValue(), f.getBinaryOffset(), f.getBinaryLength() ) ;
|
||||
}
|
||||
|
||||
public Field createField(SchemaField field, Object val, float boost) {
|
||||
public Fieldable createField(SchemaField field, Object val, float boost) {
|
||||
if (val == null) return null;
|
||||
if (!field.stored()) {
|
||||
log.trace("Ignoring unstored binary field: " + field);
|
||||
|
|
|
@ -221,7 +221,7 @@ public abstract class FieldType extends FieldProperties {
|
|||
*
|
||||
*
|
||||
*/
|
||||
public Field createField(SchemaField field, String externalVal, float boost) {
|
||||
public Fieldable createField(SchemaField field, String externalVal, float boost) {
|
||||
if (!field.indexed() && !field.stored()) {
|
||||
if (log.isTraceEnabled())
|
||||
log.trace("Ignoring unindexed/unstored field: " + field);
|
||||
|
@ -252,9 +252,9 @@ public abstract class FieldType extends FieldProperties {
|
|||
* @param omitNorms true if norms should be omitted
|
||||
* @param omitTFPos true if term freq and position should be omitted.
|
||||
* @param boost The boost value
|
||||
* @return the {@link org.apache.lucene.document.Field}.
|
||||
* @return the {@link org.apache.lucene.document.Fieldable}.
|
||||
*/
|
||||
protected Field createField(String name, String val, Field.Store storage, Field.Index index,
|
||||
protected Fieldable createField(String name, String val, Field.Store storage, Field.Index index,
|
||||
Field.TermVector vec, boolean omitNorms, boolean omitTFPos, float boost){
|
||||
Field f = new Field(name,
|
||||
val,
|
||||
|
@ -278,7 +278,7 @@ public abstract class FieldType extends FieldProperties {
|
|||
* @see #isPolyField()
|
||||
*/
|
||||
public Fieldable[] createFields(SchemaField field, String externalVal, float boost) {
|
||||
Field f = createField( field, externalVal, boost);
|
||||
Fieldable f = createField( field, externalVal, boost);
|
||||
return f==null ? new Fieldable[]{} : new Fieldable[]{f};
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ public abstract class FieldType extends FieldProperties {
|
|||
public Object toObject(SchemaField sf, BytesRef term) {
|
||||
CharArr ext = new CharArr(term.length);
|
||||
indexedToReadable(term, ext);
|
||||
Field f = createField(sf, ext.toString(), 1.0f);
|
||||
Fieldable f = createField(sf, ext.toString(), 1.0f);
|
||||
return toObject(f);
|
||||
}
|
||||
|
||||
|
@ -511,7 +511,6 @@ public abstract class FieldType extends FieldProperties {
|
|||
* @param maxInclusive whether the maximum of the range is inclusive or not
|
||||
* @return a Query instance to perform range search according to given parameters
|
||||
*
|
||||
* @see org.apache.solr.search.SolrQueryParser#getRangeQuery(String, String, String, boolean)
|
||||
*/
|
||||
public Query getRangeQuery(QParser parser, SchemaField field, String part1, String part2, boolean minInclusive, boolean maxInclusive) {
|
||||
// constant score mode is now enabled per default
|
||||
|
|
|
@ -281,7 +281,7 @@ public class LatLonType extends AbstractSubTypeFieldType implements SpatialQuery
|
|||
//It never makes sense to create a single field, so make it impossible to happen
|
||||
|
||||
@Override
|
||||
public Field createField(SchemaField field, String externalVal, float boost) {
|
||||
public Fieldable createField(SchemaField field, String externalVal, float boost) {
|
||||
throw new UnsupportedOperationException("LatLonType uses multiple fields. field=" + field.getName());
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ public class PointType extends CoordinateFieldType implements SpatialQueryable {
|
|||
*
|
||||
*/
|
||||
@Override
|
||||
public Field createField(SchemaField field, String externalVal, float boost) {
|
||||
public Fieldable createField(SchemaField field, String externalVal, float boost) {
|
||||
throw new UnsupportedOperationException("PointType uses multiple fields. field=" + field.getName());
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public final class SchemaField extends FieldProperties {
|
|||
boolean isBinary() { return (properties & BINARY)!=0; }
|
||||
|
||||
|
||||
public Field createField(String val, float boost) {
|
||||
public Fieldable createField(String val, float boost) {
|
||||
return type.createField(this,val,boost);
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ public class TrieDateField extends DateField {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Field createField(SchemaField field, String externalVal, float boost) {
|
||||
public Fieldable createField(SchemaField field, String externalVal, float boost) {
|
||||
boolean indexed = field.indexed();
|
||||
boolean stored = field.stored();
|
||||
|
||||
|
|
|
@ -477,7 +477,7 @@ public class TrieField extends FieldType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Field createField(SchemaField field, String externalVal, float boost) {
|
||||
public Fieldable createField(SchemaField field, String externalVal, float boost) {
|
||||
boolean indexed = field.indexed();
|
||||
boolean stored = field.stored();
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public class DocumentBuilder {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
Field field = sfield.createField(val, boost);
|
||||
Fieldable field = sfield.createField(val, boost);
|
||||
if (field != null) {
|
||||
if (!sfield.multiValued()) {
|
||||
String oldValue = map.put(sfield.getName(), val);
|
||||
|
@ -201,7 +201,7 @@ public class DocumentBuilder {
|
|||
if (f != null) doc.add(f); // null fields are not added
|
||||
}
|
||||
} else {
|
||||
Field f = field.createField(val, boost);
|
||||
Fieldable f = field.createField(val, boost);
|
||||
if (f != null) doc.add(f); // null fields are not added
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,9 +27,8 @@ import javax.xml.parsers.DocumentBuilder;
|
|||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.Fieldable;
|
||||
import org.apache.lucene.index.LogMergePolicy;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.solr.common.params.AppendedSolrParams;
|
||||
import org.apache.solr.common.params.CommonParams;
|
||||
import org.apache.solr.common.params.DefaultSolrParams;
|
||||
|
@ -47,7 +46,6 @@ import org.apache.solr.schema.IndexSchema;
|
|||
import org.apache.solr.schema.SchemaField;
|
||||
import org.apache.solr.search.DocIterator;
|
||||
import org.apache.solr.search.DocList;
|
||||
import org.apache.solr.search.QueryParsing;
|
||||
import org.apache.solr.update.SolrIndexWriter;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
@ -350,7 +348,7 @@ public class BasicFunctionalityTest extends SolrTestCaseJ4 {
|
|||
|
||||
IndexSchema ischema = new IndexSchema(solrConfig, getSchemaFile(), null);
|
||||
SchemaField f; // Solr field type
|
||||
Field luf; // Lucene field
|
||||
Fieldable luf; // Lucene field
|
||||
|
||||
f = ischema.getField("test_basictv");
|
||||
luf = f.createField("test", 0f);
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.solr.update;
|
|||
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.Fieldable;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.apache.solr.schema.IndexSchema;
|
||||
import org.apache.solr.util.AbstractSolrTestCase;
|
||||
|
@ -99,7 +100,7 @@ public class TestIndexingPerformance extends AbstractSolrTestCase {
|
|||
for (int j=0; j<fields.length; j+=2) {
|
||||
String field = fields[j];
|
||||
String val = fields[j+1];
|
||||
Field f = schema.getField(field).createField(val, 1.0f);
|
||||
Fieldable f = schema.getField(field).createField(val, 1.0f);
|
||||
add.doc.add(f);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue