|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.solr.schema.FieldType
org.apache.solr.schema.DateField
public class DateField
FieldType that can represent any Date/Time with millisecond precisison.
Date Format for the XML, incoming and outgoing:
A date field shall be of the form 1995-12-31T23:59:59Z The trailing "Z" designates UTC time and is mandatory. Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z All other parts are mandatory.
This format was derived to be standards compliant (ISO 8601) and is a more restricted form of the canonical representation of dateTime from XML schema part 2. http://www.w3.org/TR/xmlschema-2/#dateTime
"In 1970 the Coordinated Universal Time system was devised by an international advisory group of technical experts within the International Telecommunication Union (ITU). The ITU felt it was best to designate a single abbreviation for use in all languages in order to minimize confusion. Since unanimous agreement could not be achieved on using either the English word order, CUT, or the French word order, TUC, the acronym UTC was chosen as a compromise."
This FieldType also supports incoming "Date Math" strings for computing
values by adding/rounding internals of time relative "NOW",
ie: "NOW+1YEAR", "NOW/DAY", etc.. -- see DateMathParser
for more examples.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.solr.schema.FieldType |
---|
FieldType.DefaultAnalyzer |
Field Summary | |
---|---|
static java.util.TimeZone |
UTC
|
Fields inherited from class org.apache.solr.schema.FieldType |
---|
analyzer, args, falseProperties, log, queryAnalyzer, trueProperties, typeName |
Constructor Summary | |
---|---|
DateField()
|
Method Summary | |
---|---|
org.apache.lucene.search.SortField |
getSortField(SchemaField field,
boolean reverse)
Returns the SortField instance that should be used to sort fields of this type. |
protected java.text.DateFormat |
getThreadLocalDateFormat()
Returns a formatter that can be use by the current thread if needed to convert Date objects to the Internal representation. |
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. |
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.util.Date val)
|
java.lang.String |
toInternal(java.lang.String val)
Convert an external value (from XML update command or from query string) into the internal format. |
void |
write(TextResponseWriter writer,
java.lang.String name,
org.apache.lucene.document.Fieldable f)
calls back to TextResponseWriter to write the field value |
void |
write(XMLWriter xmlWriter,
java.lang.String name,
org.apache.lucene.document.Fieldable f)
Renders the specified field as XML |
Methods inherited from class org.apache.solr.schema.FieldType |
---|
createField, getAnalyzer, getFieldIndex, getFieldStore, getFieldTermVec, getQueryAnalyzer, getStringSort, getTypeName, isTokenized, restrictProps, setAnalyzer, setQueryAnalyzer, storedToIndexed, storedToReadable, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static java.util.TimeZone UTC
Constructor Detail |
---|
public DateField()
Method Detail |
---|
protected void init(IndexSchema schema, java.util.Map<java.lang.String,java.lang.String> args)
FieldType
init
in class FieldType
public java.lang.String toInternal(java.lang.String val)
FieldType
toInternal
in class FieldType
FieldType.toExternal(org.apache.lucene.document.Fieldable)
public java.lang.String toInternal(java.util.Date val)
public java.lang.String indexedToReadable(java.lang.String indexedForm)
FieldType
indexedToReadable
in class FieldType
public java.lang.String toExternal(org.apache.lucene.document.Fieldable f)
FieldType
toExternal
in class FieldType
FieldType.toInternal(java.lang.String)
public org.apache.lucene.search.SortField getSortField(SchemaField field, boolean reverse)
FieldType
getSortField
in class FieldType
public ValueSource getValueSource(SchemaField field)
FieldType
getValueSource
in class FieldType
public void write(XMLWriter xmlWriter, java.lang.String name, org.apache.lucene.document.Fieldable f) throws java.io.IOException
FieldType
write
in class FieldType
java.io.IOException
public void write(TextResponseWriter writer, java.lang.String name, org.apache.lucene.document.Fieldable f) throws java.io.IOException
FieldType
write
in class FieldType
java.io.IOException
protected java.text.DateFormat getThreadLocalDateFormat()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |