org.elasticsearch.index.mapper.xcontent
Class NumberFieldMapper<T extends java.lang.Number>
java.lang.Object
org.elasticsearch.index.mapper.xcontent.AbstractFieldMapper<T>
org.elasticsearch.index.mapper.xcontent.NumberFieldMapper<T>
- All Implemented Interfaces:
- ToXContent, FieldMapper<T>, IncludeInAllMapper, XContentMapper
- Direct Known Subclasses:
- BoostFieldMapper, ByteFieldMapper, DateFieldMapper, DoubleFieldMapper, FloatFieldMapper, IntegerFieldMapper, IpFieldMapper, LongFieldMapper, ShortFieldMapper
public abstract class NumberFieldMapper<T extends java.lang.Number>
- extends AbstractFieldMapper<T>
- implements IncludeInAllMapper
Constructor Summary |
protected |
NumberFieldMapper(FieldMapper.Names names,
int precisionStep,
java.lang.String fuzzyFactor,
org.apache.lucene.document.Field.Index index,
org.apache.lucene.document.Field.Store store,
float boost,
boolean omitNorms,
boolean omitTermFreqAndPositions,
NamedAnalyzer indexAnalyzer,
NamedAnalyzer searchAnalyzer)
|
Method Summary |
void |
close()
|
abstract FieldDataType |
fieldDataType()
|
org.apache.lucene.search.Filter |
fieldFilter(java.lang.String value)
Numeric field level filter are basically range queries with same value and included. |
org.apache.lucene.search.Query |
fieldQuery(java.lang.String value,
QueryParseContext context)
Numeric field level query are basically range queries with same value and included. |
abstract org.apache.lucene.search.Query |
fuzzyQuery(java.lang.String value,
double minSim,
int prefixLength,
int maxExpansions)
|
abstract org.apache.lucene.search.Query |
fuzzyQuery(java.lang.String value,
java.lang.String minSim,
int prefixLength,
int maxExpansions)
|
void |
includeInAll(java.lang.Boolean includeInAll)
|
void |
includeInAllIfNotSet(java.lang.Boolean includeInAll)
|
protected abstract int |
maxPrecisionStep()
|
void |
merge(XContentMapper mergeWith,
MergeContext mergeContext)
|
protected double |
parseFuzzyFactor(java.lang.String fuzzyFactor)
|
protected org.apache.lucene.analysis.NumericTokenStream |
popCachedStream()
|
int |
precisionStep()
|
abstract org.apache.lucene.search.Filter |
rangeFilter(FieldDataCache fieldDataCache,
java.lang.String lowerTerm,
java.lang.String upperTerm,
boolean includeLower,
boolean includeUpper)
A range filter based on the field data cache. |
abstract org.apache.lucene.search.Filter |
rangeFilter(java.lang.String lowerTerm,
java.lang.String upperTerm,
boolean includeLower,
boolean includeUpper)
Constructs a range query filter based on the mapper. |
abstract org.apache.lucene.search.Query |
rangeQuery(java.lang.String lowerTerm,
java.lang.String upperTerm,
boolean includeLower,
boolean includeUpper)
Constructs a range query based on the mapper. |
boolean |
useFieldQueryWithQueryString()
Use the field query created here when matching on numbers. |
java.lang.String |
valueAsString(org.apache.lucene.document.Fieldable field)
Returns the actual value of the field as string. |
java.lang.Object |
valueForSearch(org.apache.lucene.document.Fieldable field)
Override the default behavior (to return the string, and return the actual Number instance). |
Methods inherited from class org.elasticsearch.index.mapper.xcontent.AbstractFieldMapper |
analyzed, boost, contentType, customBoost, doXContentBody, index, indexAnalyzer, indexed, indexedValue, name, names, omitNorms, omitTermFreqAndPositions, parse, parseCreateField, queryStringTermQuery, searchAnalyzer, store, stored, termVector, toXContent, traverse |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
precisionStep
protected int precisionStep
fuzzyFactor
protected java.lang.String fuzzyFactor
dFuzzyFactor
protected double dFuzzyFactor
includeInAll
protected java.lang.Boolean includeInAll
NumberFieldMapper
protected NumberFieldMapper(FieldMapper.Names names,
int precisionStep,
@Nullable
java.lang.String fuzzyFactor,
org.apache.lucene.document.Field.Index index,
org.apache.lucene.document.Field.Store store,
float boost,
boolean omitNorms,
boolean omitTermFreqAndPositions,
NamedAnalyzer indexAnalyzer,
NamedAnalyzer searchAnalyzer)
parseFuzzyFactor
protected double parseFuzzyFactor(java.lang.String fuzzyFactor)
includeInAll
public void includeInAll(java.lang.Boolean includeInAll)
- Specified by:
includeInAll
in interface IncludeInAllMapper
includeInAllIfNotSet
public void includeInAllIfNotSet(java.lang.Boolean includeInAll)
- Specified by:
includeInAllIfNotSet
in interface IncludeInAllMapper
maxPrecisionStep
protected abstract int maxPrecisionStep()
precisionStep
public int precisionStep()
useFieldQueryWithQueryString
public boolean useFieldQueryWithQueryString()
- Use the field query created here when matching on numbers.
- Specified by:
useFieldQueryWithQueryString
in interface FieldMapper<T extends java.lang.Number>
- Overrides:
useFieldQueryWithQueryString
in class AbstractFieldMapper<T extends java.lang.Number>
fieldQuery
public org.apache.lucene.search.Query fieldQuery(java.lang.String value,
QueryParseContext context)
- Numeric field level query are basically range queries with same value and included. That's the recommended
way to execute it.
- Specified by:
fieldQuery
in interface FieldMapper<T extends java.lang.Number>
- Overrides:
fieldQuery
in class AbstractFieldMapper<T extends java.lang.Number>
fuzzyQuery
public abstract org.apache.lucene.search.Query fuzzyQuery(java.lang.String value,
java.lang.String minSim,
int prefixLength,
int maxExpansions)
- Specified by:
fuzzyQuery
in interface FieldMapper<T extends java.lang.Number>
- Overrides:
fuzzyQuery
in class AbstractFieldMapper<T extends java.lang.Number>
fuzzyQuery
public abstract org.apache.lucene.search.Query fuzzyQuery(java.lang.String value,
double minSim,
int prefixLength,
int maxExpansions)
- Specified by:
fuzzyQuery
in interface FieldMapper<T extends java.lang.Number>
- Overrides:
fuzzyQuery
in class AbstractFieldMapper<T extends java.lang.Number>
fieldFilter
public org.apache.lucene.search.Filter fieldFilter(java.lang.String value)
- Numeric field level filter are basically range queries with same value and included. That's the recommended
way to execute it.
- Specified by:
fieldFilter
in interface FieldMapper<T extends java.lang.Number>
- Overrides:
fieldFilter
in class AbstractFieldMapper<T extends java.lang.Number>
rangeQuery
public abstract org.apache.lucene.search.Query rangeQuery(java.lang.String lowerTerm,
java.lang.String upperTerm,
boolean includeLower,
boolean includeUpper)
- Description copied from interface:
FieldMapper
- Constructs a range query based on the mapper.
- Specified by:
rangeQuery
in interface FieldMapper<T extends java.lang.Number>
- Overrides:
rangeQuery
in class AbstractFieldMapper<T extends java.lang.Number>
rangeFilter
public abstract org.apache.lucene.search.Filter rangeFilter(java.lang.String lowerTerm,
java.lang.String upperTerm,
boolean includeLower,
boolean includeUpper)
- Description copied from interface:
FieldMapper
- Constructs a range query filter based on the mapper.
- Specified by:
rangeFilter
in interface FieldMapper<T extends java.lang.Number>
- Overrides:
rangeFilter
in class AbstractFieldMapper<T extends java.lang.Number>
rangeFilter
public abstract org.apache.lucene.search.Filter rangeFilter(FieldDataCache fieldDataCache,
java.lang.String lowerTerm,
java.lang.String upperTerm,
boolean includeLower,
boolean includeUpper)
- A range filter based on the field data cache.
valueForSearch
public java.lang.Object valueForSearch(org.apache.lucene.document.Fieldable field)
- Override the default behavior (to return the string, and return the actual Number instance).
- Specified by:
valueForSearch
in interface FieldMapper<T extends java.lang.Number>
- Overrides:
valueForSearch
in class AbstractFieldMapper<T extends java.lang.Number>
valueAsString
public java.lang.String valueAsString(org.apache.lucene.document.Fieldable field)
- Description copied from interface:
FieldMapper
- Returns the actual value of the field as string.
- Specified by:
valueAsString
in interface FieldMapper<T extends java.lang.Number>
merge
public void merge(XContentMapper mergeWith,
MergeContext mergeContext)
throws MergeMappingException
- Specified by:
merge
in interface XContentMapper
- Overrides:
merge
in class AbstractFieldMapper<T extends java.lang.Number>
- Throws:
MergeMappingException
close
public void close()
- Specified by:
close
in interface XContentMapper
- Overrides:
close
in class AbstractFieldMapper<T extends java.lang.Number>
fieldDataType
public abstract FieldDataType fieldDataType()
- Specified by:
fieldDataType
in interface FieldMapper<T extends java.lang.Number>
- Overrides:
fieldDataType
in class AbstractFieldMapper<T extends java.lang.Number>
popCachedStream
protected org.apache.lucene.analysis.NumericTokenStream popCachedStream()