Esri Geoportal Server
1.0

com.esri.gpt.catalog.lucene
Class TimestampField

java.lang.Object
  extended by com.esri.gpt.catalog.lucene.DatastoreField
      extended by com.esri.gpt.catalog.lucene.TimestampField

public class TimestampField
extends DatastoreField

A non-tokenized field that allows for date/time comparison.


Constructor Summary
protected TimestampField(String name)
          Constructs with a supplied name.
 
Method Summary
protected  Fieldable makeFieldable(Object value)
          Makes the fieldable to index.
protected  Query makeRangeQuery(String literalLowerValue, String literalUpperValue, boolean lowerBoundaryIsInclusive, boolean upperBoundaryIsInclusive)
          Makes a range query.
protected  String makeValueToQuery(String value, boolean isLowerBoundary, boolean isUpperBoundary)
          Makes the value to query.
protected  Object makeValueToReturn(String storedValue)
          Makes the value to return in the query result.
protected  int sortFieldType()
          Returns the sort field type.
protected static Timestamp timestampFromIndexableString(String value)
          Reverts an indexable String back to a time stamp.
protected static String timestampToIndexableString(Timestamp value)
          Converts a time stamp to a String that can be indexed for search.
 
Methods inherited from class com.esri.gpt.catalog.lucene.DatastoreField
appendForWrite, getIndexingOption, getName, getStorageOption, getTermVectorOption, setIndexingOption, setName, setStorageOption, setTermVectorOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimestampField

protected TimestampField(String name)
Constructs with a supplied name.

Parameters:
name - the field name
Method Detail

makeFieldable

protected Fieldable makeFieldable(Object value)
Makes the fieldable to index.

Overrides:
makeFieldable in class DatastoreField
Parameters:
value - the value
Returns:
the fieldable

makeRangeQuery

protected Query makeRangeQuery(String literalLowerValue,
                               String literalUpperValue,
                               boolean lowerBoundaryIsInclusive,
                               boolean upperBoundaryIsInclusive)
                        throws DiscoveryException
Makes a range query.

Overrides:
makeRangeQuery in class DatastoreField
Parameters:
literalLowerValue - the literal lower boundary value
literalUpperValue - the literal upper boundary value
lowerBoundaryIsInclusive - (>= versus >)
upperBoundaryIsInclusive - (<= versus <)
Returns:
the value to query
Throws:
DiscoveryException - if a supplied value cannot be converted

makeValueToQuery

protected String makeValueToQuery(String value,
                                  boolean isLowerBoundary,
                                  boolean isUpperBoundary)
                           throws DiscoveryException
Makes the value to query.
The value to query is derived from NumericUtils.longToPrefixCoded(timestamp.getTime().

Overrides:
makeValueToQuery in class DatastoreField
Parameters:
value - to input query value
isLowerBoundary - true if this is a lower boundary of a range query
isUpperBoundary - true if this is a upper boundary of a range query
Returns:
the value to query
Throws:
DiscoveryException - if the supplied value cannot be converted

makeValueToReturn

protected Object makeValueToReturn(String storedValue)
Makes the value to return in the query result.

Overrides:
makeValueToReturn in class DatastoreField
Parameters:
storedValue - the value stored within the Lucene document
Returns:
the associated object value

timestampFromIndexableString

protected static Timestamp timestampFromIndexableString(String value)
Reverts an indexable String back to a time stamp.

Parameters:
value - the indexable string to revert
Returns:
the update date (null if the value is invalid)

timestampToIndexableString

protected static String timestampToIndexableString(Timestamp value)
Converts a time stamp to a String that can be indexed for search.

Parameters:
value - the times stamp to convert
Returns:
the indexable string

sortFieldType

protected int sortFieldType()
Returns the sort field type.

Overrides:
sortFieldType in class DatastoreField
Returns:
the sort field type (SortField.LONG)

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.