public class InstantBridge extends Object implements TwoWayFieldBridge, NumericTimeBridge
Instant
in a numeric field representing it as the number of milliseconds form Epoch.
Note that the instant is truncated to the milliseconds.
If the instant cannot be expressed using a long, a SearchException
get thrown.
Instant.toEpochMilli()
Modifier and Type | Field and Description |
---|---|
static InstantBridge |
INSTANCE |
Constructor and Description |
---|
InstantBridge() |
Modifier and Type | Method and Description |
---|---|
Object |
get(String name,
Document document)
Build the element object from the
Document |
NumericFieldSettingsDescriptor.NumericEncodingType |
getEncodingType()
Define the numeric encoding to use for the brdige.
|
String |
objectToString(Object object)
Convert the object representation to a string.
|
void |
set(String name,
Object value,
Document document,
LuceneOptions luceneOptions)
Manipulate the document to index the given value.
|
public static final InstantBridge INSTANCE
public NumericFieldSettingsDescriptor.NumericEncodingType getEncodingType()
NumericTimeBridge
getEncodingType
in interface NumericTimeBridge
public Object get(String name, Document document)
TwoWayFieldBridge
Document
get
in interface TwoWayFieldBridge
name
- field namedocument
- documentpublic 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 String objectToString(Object object)
TwoWayFieldBridge
objectToString
in interface TwoWayFieldBridge
object
- The object to index.null
, but
can be empty.Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved