|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.solr.schema.FieldType
public abstract class FieldType
Base class for all field types used by an index schema.
Nested Class Summary | |
---|---|
protected class |
FieldType.DefaultAnalyzer
Default analyzer for types that only produce 1 verbatim token... |
Field Summary | |
---|---|
protected Analyzer |
analyzer
Analyzer set by schema for text types to use when indexing fields of this type, subclasses can set analyzer themselves or override getAnalyzer() |
protected Map<String,String> |
args
additional arguments specified in the field type declaration |
protected int |
falseProperties
properties explicitly set to false |
static Logger |
log
|
protected Analyzer |
queryAnalyzer
Analyzer set by schema for text types to use when searching fields of this type, subclasses can set analyzer themselves or override getAnalyzer() |
protected int |
trueProperties
properties explicitly set to true |
protected String |
typeName
The name of the type (not the name of the field) |
Constructor Summary | |
---|---|
FieldType()
|
Method Summary | |
---|---|
Field |
createField(SchemaField field,
String externalVal,
float boost)
Used for adding a document when a field needs to be created from a type and a string. |
Analyzer |
getAnalyzer()
Returns the Analyzer to be used when indexing fields of this type. |
protected Field.Index |
getFieldIndex(SchemaField field,
String internalVal)
|
protected Field.Store |
getFieldStore(SchemaField field,
String internalVal)
|
protected Field.TermVector |
getFieldTermVec(SchemaField field,
String internalVal)
|
Analyzer |
getQueryAnalyzer()
Returns the Analyzer to be used when searching fields of this type. |
abstract SortField |
getSortField(SchemaField field,
boolean top)
Returns the SortField instance that should be used to sort fields of this type. |
protected SortField |
getStringSort(SchemaField field,
boolean reverse)
Utility usable by subclasses when they want to get basic String sorting. |
String |
getTypeName()
The Name of this FieldType as specified in the schema file |
ValueSource |
getValueSource(SchemaField field)
called to get the default value source (normally, from the Lucene FieldCache.) |
String |
indexedToReadable(String indexedForm)
:TODO: document this method |
protected void |
init(IndexSchema schema,
Map<String,String> args)
subclasses should initialize themselves with the args provided and remove valid arguments. |
boolean |
isTokenized()
Returns true if fields of this type should be tokenized |
protected void |
restrictProps(int props)
:TODO: document this method |
void |
setAnalyzer(Analyzer analyzer)
Sets the Analyzer to be used when indexing fields of this type. |
void |
setQueryAnalyzer(Analyzer analyzer)
Sets the Analyzer to be used when querying fields of this type. |
String |
storedToIndexed(Fieldable f)
:TODO: document this method |
String |
storedToReadable(Fieldable f)
:TODO: document this method |
String |
toExternal(Fieldable f)
Convert the stored-field format to an external (string, human readable) value |
String |
toInternal(String val)
Convert an external value (from XML update command or from query string) into the internal format. |
String |
toString()
|
abstract void |
write(TextResponseWriter writer,
String name,
Fieldable f)
calls back to TextResponseWriter to write the field value |
abstract void |
write(XMLWriter xmlWriter,
String name,
Fieldable f)
Renders the specified field as XML |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Logger log
protected String typeName
protected Map<String,String> args
protected int trueProperties
protected int falseProperties
protected Analyzer analyzer
getAnalyzer()
protected Analyzer queryAnalyzer
getQueryAnalyzer()
Constructor Detail |
---|
public FieldType()
Method Detail |
---|
public boolean isTokenized()
protected void init(IndexSchema schema, Map<String,String> args)
protected void restrictProps(int props)
public String getTypeName()
public String toString()
toString
in class Object
public Field createField(SchemaField field, String externalVal, float boost)
By default, the indexed value is the same as the stored value (taken from toInternal()). Having a different representation for external, internal, and indexed would present quite a few problems given the current Lucene architecture. An analyzer for adding docs would need to translate internal->indexed while an analyzer for querying would need to translate external->indexed.
The only other alternative to having internal==indexed would be to have internal==external. In this case, toInternal should convert to the indexed representation, toExternal() should do nothing, and createField() should *not* call toInternal, but use the external value and set tokenized=true to get Lucene to convert to the internal(indexed) form.
:TODO: clean up and clarify this explanation.
toInternal(java.lang.String)
protected Field.TermVector getFieldTermVec(SchemaField field, String internalVal)
protected Field.Store getFieldStore(SchemaField field, String internalVal)
protected Field.Index getFieldIndex(SchemaField field, String internalVal)
public String toInternal(String val)
toExternal(org.apache.lucene.document.Fieldable)
public String toExternal(Fieldable f)
toInternal(java.lang.String)
public String indexedToReadable(String indexedForm)
public String storedToReadable(Fieldable f)
public String storedToIndexed(Fieldable f)
public Analyzer getAnalyzer()
This method may be called many times, at any time.
getQueryAnalyzer()
public Analyzer getQueryAnalyzer()
This method may be called many times, at any time.
getAnalyzer()
public void setAnalyzer(Analyzer analyzer)
getAnalyzer()
public void setQueryAnalyzer(Analyzer analyzer)
getQueryAnalyzer()
public abstract void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException
IOException
public abstract void write(TextResponseWriter writer, String name, Fieldable f) throws IOException
IOException
public abstract SortField getSortField(SchemaField field, boolean top)
protected SortField getStringSort(SchemaField field, boolean reverse)
public ValueSource getValueSource(SchemaField field)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |