|
||||||||||
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 org.apache.lucene.analysis.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 java.util.Map<java.lang.String,java.lang.String> |
args
additional arguments specified in the field type declaration |
protected int |
falseProperties
properties explicitly set to false |
static java.util.logging.Logger |
log
|
protected org.apache.lucene.analysis.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 java.lang.String |
typeName
The name of the type (not the name of the field) |
Constructor Summary | |
---|---|
FieldType()
|
Method Summary | |
---|---|
org.apache.lucene.document.Field |
createField(SchemaField field,
java.lang.String externalVal,
float boost)
Used for adding a document when a field needs to be created from a type and a string. |
org.apache.lucene.analysis.Analyzer |
getAnalyzer()
Returns the Analyzer to be used when indexing fields of this type. |
protected org.apache.lucene.document.Field.Index |
getFieldIndex(SchemaField field,
java.lang.String internalVal)
|
protected org.apache.lucene.document.Field.Store |
getFieldStore(SchemaField field,
java.lang.String internalVal)
|
protected org.apache.lucene.document.Field.TermVector |
getFieldTermVec(SchemaField field,
java.lang.String internalVal)
|
org.apache.lucene.analysis.Analyzer |
getQueryAnalyzer()
Returns the Analyzer to be used when searching fields of this type. |
abstract org.apache.lucene.search.SortField |
getSortField(SchemaField field,
boolean top)
Returns the SortField instance that should be used to sort fields of this type. |
protected org.apache.lucene.search.SortField |
getStringSort(SchemaField field,
boolean reverse)
Utility usable by subclasses when they want to get basic String sorting. |
java.lang.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.) |
java.lang.String |
indexedToReadable(java.lang.String indexedForm)
:TODO: document this method |
protected void |
init(IndexSchema schema,
java.util.Map<java.lang.String,java.lang.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(org.apache.lucene.analysis.Analyzer analyzer)
Sets the Analyzer to be used when indexing fields of this type. |
void |
setQueryAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
Sets the Analyzer to be used when querying fields of this type. |
java.lang.String |
storedToIndexed(org.apache.lucene.document.Fieldable f)
:TODO: document this method |
java.lang.String |
storedToReadable(org.apache.lucene.document.Fieldable f)
:TODO: document this method |
java.lang.String |
toExternal(org.apache.lucene.document.Fieldable f)
Convert the stored-field format to an external (string, human readable) value |
java.lang.String |
toInternal(java.lang.String val)
Convert an external value (from XML update command or from query string) into the internal format. |
java.lang.String |
toString()
|
abstract void |
write(TextResponseWriter writer,
java.lang.String name,
org.apache.lucene.document.Fieldable f)
calls back to TextResponseWriter to write the field value |
abstract void |
write(XMLWriter xmlWriter,
java.lang.String name,
org.apache.lucene.document.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 java.util.logging.Logger log
protected java.lang.String typeName
protected java.util.Map<java.lang.String,java.lang.String> args
protected int trueProperties
protected int falseProperties
protected org.apache.lucene.analysis.Analyzer analyzer
getAnalyzer()
protected org.apache.lucene.analysis.Analyzer queryAnalyzer
getQueryAnalyzer()
Constructor Detail |
---|
public FieldType()
Method Detail |
---|
public boolean isTokenized()
protected void init(IndexSchema schema, java.util.Map<java.lang.String,java.lang.String> args)
protected void restrictProps(int props)
public java.lang.String getTypeName()
public java.lang.String toString()
toString
in class java.lang.Object
public org.apache.lucene.document.Field createField(SchemaField field, java.lang.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 org.apache.lucene.document.Field.TermVector getFieldTermVec(SchemaField field, java.lang.String internalVal)
protected org.apache.lucene.document.Field.Store getFieldStore(SchemaField field, java.lang.String internalVal)
protected org.apache.lucene.document.Field.Index getFieldIndex(SchemaField field, java.lang.String internalVal)
public java.lang.String toInternal(java.lang.String val)
toExternal(org.apache.lucene.document.Fieldable)
public java.lang.String toExternal(org.apache.lucene.document.Fieldable f)
toInternal(java.lang.String)
public java.lang.String indexedToReadable(java.lang.String indexedForm)
public java.lang.String storedToReadable(org.apache.lucene.document.Fieldable f)
public java.lang.String storedToIndexed(org.apache.lucene.document.Fieldable f)
public org.apache.lucene.analysis.Analyzer getAnalyzer()
This method may be called many times, at any time.
getQueryAnalyzer()
public org.apache.lucene.analysis.Analyzer getQueryAnalyzer()
This method may be called many times, at any time.
getAnalyzer()
public void setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
getAnalyzer()
public void setQueryAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
getQueryAnalyzer()
public abstract void write(XMLWriter xmlWriter, java.lang.String name, org.apache.lucene.document.Fieldable f) throws java.io.IOException
java.io.IOException
public abstract void write(TextResponseWriter writer, java.lang.String name, org.apache.lucene.document.Fieldable f) throws java.io.IOException
java.io.IOException
public abstract org.apache.lucene.search.SortField getSortField(SchemaField field, boolean top)
protected org.apache.lucene.search.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 |