org.elasticsearch.index.mapper.ip
Class IpFieldMapper

java.lang.Object
  extended by org.elasticsearch.index.mapper.core.AbstractFieldMapper<T>
      extended by org.elasticsearch.index.mapper.core.NumberFieldMapper<Long>
          extended by org.elasticsearch.index.mapper.ip.IpFieldMapper
All Implemented Interfaces:
ToXContent, FieldMapper<Long>, AllFieldMapper.IncludeInAll, Mapper

public class IpFieldMapper
extends NumberFieldMapper<Long>


Nested Class Summary
static class IpFieldMapper.Builder
           
static class IpFieldMapper.Defaults
           
static class IpFieldMapper.NumericIpAnalyzer
           
static class IpFieldMapper.NumericIpTokenizer
           
static class IpFieldMapper.TypeParser
           
 
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.core.NumberFieldMapper
NumberFieldMapper.CustomNumericField
 
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.core.AbstractFieldMapper
AbstractFieldMapper.OpenBuilder<T extends AbstractFieldMapper.Builder,Y extends AbstractFieldMapper>
 
Nested classes/interfaces inherited from interface org.elasticsearch.index.mapper.Mapper
Mapper.BuilderContext
 
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.MapParams, ToXContent.Params
 
Nested classes/interfaces inherited from interface org.elasticsearch.index.mapper.FieldMapper
FieldMapper.Names
 
Field Summary
static String CONTENT_TYPE
           
 
Fields inherited from class org.elasticsearch.index.mapper.core.NumberFieldMapper
dFuzzyFactor, fuzzyFactor, ignoreMalformed, includeInAll, precisionStep
 
Fields inherited from class org.elasticsearch.index.mapper.core.AbstractFieldMapper
boost, index, indexAnalyzer, indexOptions, names, omitNorms, searchAnalyzer, store, termVector
 
Fields inherited from interface org.elasticsearch.index.mapper.Mapper
EMPTY_ARRAY
 
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
 
Constructor Summary
protected IpFieldMapper(FieldMapper.Names names, int precisionStep, org.apache.lucene.document.Field.Index index, org.apache.lucene.document.Field.Store store, float boost, boolean omitNorms, org.apache.lucene.index.FieldInfo.IndexOptions indexOptions, String nullValue, boolean ignoreMalformed)
           
 
Method Summary
protected  String contentType()
           
protected  void doXContentBody(XContentBuilder builder)
           
 FieldDataType fieldDataType()
           
 org.apache.lucene.search.Query fuzzyQuery(String value, double minSim, int prefixLength, int maxExpansions)
           
 org.apache.lucene.search.Query fuzzyQuery(String value, String minSim, int prefixLength, int maxExpansions)
           
 String indexedValue(String value)
          Returns the indexed value.
protected  org.apache.lucene.document.Fieldable innerParseCreateField(ParseContext context)
           
static long ipToLong(String ip)
           
static String longToIp(long longIp)
           
protected  int maxPrecisionStep()
           
 void merge(Mapper mergeWith, MergeContext mergeContext)
           
 org.apache.lucene.search.Filter nullValueFilter()
          Null value filter, returns null if there is no null value associated with the field.
 org.apache.lucene.search.Filter rangeFilter(FieldDataCache fieldDataCache, String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper, QueryParseContext context)
          A range filter based on the field data cache.
 org.apache.lucene.search.Filter rangeFilter(String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper, QueryParseContext context)
          Constructs a range query filter based on the mapper.
 org.apache.lucene.search.Query rangeQuery(String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper, QueryParseContext context)
          Constructs a range query based on the mapper.
 Long value(org.apache.lucene.document.Fieldable field)
          Returns the actual value of the field.
 String valueAsString(org.apache.lucene.document.Fieldable field)
          Returns the actual value of the field as string.
 Object valueForSearch(org.apache.lucene.document.Fieldable field)
          IPs should return as a string, delegates to valueAsString(org.apache.lucene.document.Fieldable).
 Long valueFromString(String value)
           
 
Methods inherited from class org.elasticsearch.index.mapper.core.NumberFieldMapper
close, fieldFilter, fieldQuery, includeInAll, includeInAllIfNotSet, parseCreateField, parseFuzzyFactor, popCachedStream, precisionStep, useFieldQueryWithQueryString
 
Methods inherited from class org.elasticsearch.index.mapper.core.AbstractFieldMapper
analyzed, boost, customBoost, index, indexAnalyzer, indexed, indexOptions, indexOptionToString, name, names, omitNorms, parse, prefixFilter, prefixQuery, queryStringTermQuery, searchAnalyzer, searchQuoteAnalyzer, store, stored, termVector, toXContent, traverse, traverse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.elasticsearch.index.mapper.Mapper
name, parse, traverse, traverse
 
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContent
toXContent
 

Field Detail

CONTENT_TYPE

public static final String CONTENT_TYPE
See Also:
Constant Field Values
Constructor Detail

IpFieldMapper

protected IpFieldMapper(FieldMapper.Names names,
                        int precisionStep,
                        org.apache.lucene.document.Field.Index index,
                        org.apache.lucene.document.Field.Store store,
                        float boost,
                        boolean omitNorms,
                        org.apache.lucene.index.FieldInfo.IndexOptions indexOptions,
                        String nullValue,
                        boolean ignoreMalformed)
Method Detail

longToIp

public static String longToIp(long longIp)

ipToLong

public static long ipToLong(String ip)
                     throws ElasticSearchIllegalArgumentException
Throws:
ElasticSearchIllegalArgumentException

maxPrecisionStep

protected int maxPrecisionStep()
Specified by:
maxPrecisionStep in class NumberFieldMapper<Long>

value

public Long value(org.apache.lucene.document.Fieldable field)
Description copied from interface: FieldMapper
Returns the actual value of the field.


valueFromString

public Long valueFromString(String value)

valueForSearch

public Object valueForSearch(org.apache.lucene.document.Fieldable field)
IPs should return as a string, delegates to valueAsString(org.apache.lucene.document.Fieldable).

Specified by:
valueForSearch in interface FieldMapper<Long>
Overrides:
valueForSearch in class NumberFieldMapper<Long>

valueAsString

public 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<Long>
Overrides:
valueAsString in class NumberFieldMapper<Long>

indexedValue

public String indexedValue(String value)
Description copied from interface: FieldMapper
Returns the indexed value.

Specified by:
indexedValue in interface FieldMapper<Long>
Overrides:
indexedValue in class AbstractFieldMapper<Long>

fuzzyQuery

public org.apache.lucene.search.Query fuzzyQuery(String value,
                                                 String minSim,
                                                 int prefixLength,
                                                 int maxExpansions)
Specified by:
fuzzyQuery in interface FieldMapper<Long>
Specified by:
fuzzyQuery in class NumberFieldMapper<Long>

fuzzyQuery

public org.apache.lucene.search.Query fuzzyQuery(String value,
                                                 double minSim,
                                                 int prefixLength,
                                                 int maxExpansions)
Specified by:
fuzzyQuery in interface FieldMapper<Long>
Specified by:
fuzzyQuery in class NumberFieldMapper<Long>

rangeQuery

public org.apache.lucene.search.Query rangeQuery(String lowerTerm,
                                                 String upperTerm,
                                                 boolean includeLower,
                                                 boolean includeUpper,
                                                 @Nullable
                                                 QueryParseContext context)
Description copied from interface: FieldMapper
Constructs a range query based on the mapper.

Specified by:
rangeQuery in interface FieldMapper<Long>
Specified by:
rangeQuery in class NumberFieldMapper<Long>

rangeFilter

public org.apache.lucene.search.Filter rangeFilter(String lowerTerm,
                                                   String upperTerm,
                                                   boolean includeLower,
                                                   boolean includeUpper,
                                                   @Nullable
                                                   QueryParseContext context)
Description copied from interface: FieldMapper
Constructs a range query filter based on the mapper.

Specified by:
rangeFilter in interface FieldMapper<Long>
Specified by:
rangeFilter in class NumberFieldMapper<Long>

rangeFilter

public org.apache.lucene.search.Filter rangeFilter(FieldDataCache fieldDataCache,
                                                   String lowerTerm,
                                                   String upperTerm,
                                                   boolean includeLower,
                                                   boolean includeUpper,
                                                   @Nullable
                                                   QueryParseContext context)
Description copied from class: NumberFieldMapper
A range filter based on the field data cache.

Specified by:
rangeFilter in class NumberFieldMapper<Long>

nullValueFilter

public org.apache.lucene.search.Filter nullValueFilter()
Description copied from interface: FieldMapper
Null value filter, returns null if there is no null value associated with the field.

Specified by:
nullValueFilter in interface FieldMapper<Long>
Overrides:
nullValueFilter in class AbstractFieldMapper<Long>

innerParseCreateField

protected org.apache.lucene.document.Fieldable innerParseCreateField(ParseContext context)
                                                              throws IOException
Specified by:
innerParseCreateField in class NumberFieldMapper<Long>
Throws:
IOException

fieldDataType

public FieldDataType fieldDataType()
Specified by:
fieldDataType in interface FieldMapper<Long>
Specified by:
fieldDataType in class NumberFieldMapper<Long>

contentType

protected String contentType()
Specified by:
contentType in class AbstractFieldMapper<Long>

merge

public void merge(Mapper mergeWith,
                  MergeContext mergeContext)
           throws MergeMappingException
Specified by:
merge in interface Mapper
Overrides:
merge in class NumberFieldMapper<Long>
Throws:
MergeMappingException

doXContentBody

protected void doXContentBody(XContentBuilder builder)
                       throws IOException
Overrides:
doXContentBody in class NumberFieldMapper<Long>
Throws:
IOException


Copyright © 2009-2012. All Rights Reserved.