Esri Geoportal Server
1.0

com.esri.gpt.catalog.lucene
Class DoubleField

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

public class DoubleField
extends DatastoreField

A non-tokenized field that allows for Double value comparison.


Field Summary
protected static int DEFAULT_PRECISION
          The default storage precision = 8
 
Constructor Summary
protected DoubleField(String name, int precision)
          Constructs with a supplied name and precision.
 
Method Summary
protected static Double doubleFromIndexableString(String value, int precision)
          Reverts an indexable String back to a double value.
protected static String doubleToIndexableString(Double value, int precision)
          Converts a double value to a String that can be indexed for search.
protected  int getPrecision()
          Gets the storage precision.
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.
 
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
 

Field Detail

DEFAULT_PRECISION

protected static final int DEFAULT_PRECISION
The default storage precision = 8

See Also:
Constant Field Values
Constructor Detail

DoubleField

protected DoubleField(String name,
                      int precision)
Constructs with a supplied name and precision.

Parameters:
name - the field name
precision - the storage precision
Method Detail

getPrecision

protected int getPrecision()
Gets the storage precision.

Returns:
the storage precision

doubleFromIndexableString

protected static Double doubleFromIndexableString(String value,
                                                  int precision)
Reverts an indexable String back to a double value.

Parameters:
value - the indexable string to revert
Returns:
the double value

doubleToIndexableString

protected static String doubleToIndexableString(Double value,
                                                int precision)
Converts a double value to a String that can be indexed for search.

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

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.doubleToPrefixCoded().

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.
The value to return is derived from doubleFromIndexableString().

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

sortFieldType

protected int sortFieldType()
Returns the sort field type.

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

Esri Geoportal Server
1.0

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