java.lang.Object
org.elasticsearch.common.unit.Fuzziness
- All Implemented Interfaces:
Writeable
,ToXContent
,ToXContentFragment
A unit class that encapsulates all in-exact search
parsing and conversion from similarities to edit distances
etc.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Fuzziness
static final ParseField
static final Fuzziness
static final Fuzziness
static final Fuzziness
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
int
asDistance
(String text) float
asFloat()
asString()
boolean
static Fuzziness
fromEdits
(int edits) Creates aFuzziness
instance from an edit distance.static Fuzziness
fromString
(String fuzzinessString) Creates aFuzziness
instance from a String representation.int
hashCode()
static Fuzziness
parse
(XContentParser parser) toXContent
(XContentBuilder builder, ToXContent.Params params) void
writeTo
(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
FIELD
-
ZERO
-
ONE
-
TWO
-
AUTO
-
-
Constructor Details
-
Fuzziness
Read from a stream.- Throws:
IOException
-
-
Method Details
-
fromEdits
Creates aFuzziness
instance from an edit distance. The value must be one of[0, 1, 2]
Note: Using this method only makes sense if the field you are applying Fuzziness to is some sort of string.- Throws:
IllegalArgumentException
- if the edit distance is not in [0, 1, 2]
-
fromString
Creates aFuzziness
instance from a String representation. This can either be an edit distance where the value must be one of["0", "1", "2"]
or "AUTO" for a fuzziness that depends on the term length. Using the "AUTO" fuzziness, you can optionally supply low and high distance arguments in the format"AUTO:[low],[high]"
. See the query DSL documentation for more information about how these values affect the fuzziness value. Note: Using this method only makes sense if the field you are applying Fuzziness to is some sort of string. -
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
parse
- Throws:
IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceToXContent
- Throws:
IOException
-
asDistance
public int asDistance() -
asDistance
-
asFloat
public float asFloat() -
asString
-
equals
-
hashCode
public int hashCode()
-