public class ElasticsearchDateBridge extends EncodingStringBridge<Date> implements TwoWayFieldBridge, ParameterizedBridge, IgnoreAnalyzerBridge
java.util.Date
to a String
using the ISO 8601 standard which is the default date format
of Elasticsearch.
UTC is used as time zone.
Typically, a java.util.Date
will be converted to "2016-04-28T15:24:25Z".Modifier and Type | Field and Description |
---|---|
static ElasticsearchDateBridge |
DATE_DAY |
static ElasticsearchDateBridge |
DATE_HOUR |
static ElasticsearchDateBridge |
DATE_MILLISECOND |
static ElasticsearchDateBridge |
DATE_MINUTE |
static ElasticsearchDateBridge |
DATE_MONTH |
static ElasticsearchDateBridge |
DATE_SECOND |
static ElasticsearchDateBridge |
DATE_YEAR |
Constructor and Description |
---|
ElasticsearchDateBridge() |
ElasticsearchDateBridge(Resolution resolution) |
Modifier and Type | Method and Description |
---|---|
Object |
get(String name,
Document document)
Build the element object from the
Document |
String |
objectToString(Object object)
Convert the object representation to a string.
|
protected Date |
parseIndexNullAs(String indexNullAs)
Parse the 'indexNullAs' string to an indexable value.
|
void |
set(String name,
Object value,
Document document,
LuceneOptions luceneOptions)
Manipulate the document to index the given value.
|
void |
setParameterValues(Map<String,String> parameters)
Called on the bridge implementation to pass the parameters.
|
createNullMarker, getEncodingType
public static final ElasticsearchDateBridge DATE_YEAR
public static final ElasticsearchDateBridge DATE_MONTH
public static final ElasticsearchDateBridge DATE_DAY
public static final ElasticsearchDateBridge DATE_HOUR
public static final ElasticsearchDateBridge DATE_MINUTE
public static final ElasticsearchDateBridge DATE_SECOND
public static final ElasticsearchDateBridge DATE_MILLISECOND
public ElasticsearchDateBridge()
public ElasticsearchDateBridge(Resolution resolution)
public void set(String name, Object value, Document document, LuceneOptions luceneOptions)
FieldBridge
A common implementation is to add a Field with the given name
to document
following
the parameters luceneOptions
if the value
is not null
.
String fieldValue = convertToString(value);
luceneOptions.addFieldToDocument(name, fieldValue, document);
set
in interface FieldBridge
name
- The field to add to the Lucene documentvalue
- The actual value to indexdocument
- The Lucene document into which we want to index the value.luceneOptions
- Contains the parameters used for adding value
to
the Lucene document.public Object get(String name, Document document)
TwoWayFieldBridge
Document
get
in interface TwoWayFieldBridge
name
- field namedocument
- documentpublic String objectToString(Object object)
TwoWayFieldBridge
objectToString
in interface StringBridge
objectToString
in interface TwoWayFieldBridge
object
- The object to index.null
, but
can be empty.public void setParameterValues(Map<String,String> parameters)
ParameterizedBridge
setParameterValues
in interface ParameterizedBridge
parameters
- map containing string based parameters to be passed to the parameterized bridge. The map is never
null
.protected Date parseIndexNullAs(String indexNullAs) throws IllegalArgumentException
EncodingStringBridge
The required format does not have to be the same as the encoded format.
parseIndexNullAs
in class EncodingStringBridge<Date>
IllegalArgumentException
- If the given string does not match the required format.Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved