Package org.elasticsearch.common.unit
Class Fuzziness
java.lang.Object
org.elasticsearch.common.unit.Fuzziness
- All Implemented Interfaces:
Writeable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentFragment
public final class Fuzziness extends java.lang.Object implements org.elasticsearch.common.xcontent.ToXContentFragment, Writeable
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.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields Modifier and Type Field Description static FuzzinessAUTOstatic org.elasticsearch.common.ParseFieldFIELDstatic FuzzinessONEstatic FuzzinessTWOstatic java.lang.StringX_FIELD_NAMEstatic FuzzinessZEROFields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
Constructors Constructor Description Fuzziness(StreamInput in)Read from a stream. -
Method Summary
Modifier and Type Method Description intasDistance()intasDistance(java.lang.String text)floatasFloat()java.lang.StringasString()static Fuzzinessbuild(java.lang.Object fuzziness)booleanequals(java.lang.Object obj)static FuzzinessfromEdits(int edits)Creates aFuzzinessinstance from an edit distance.inthashCode()static Fuzzinessparse(org.elasticsearch.common.xcontent.XContentParser parser)org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)voidwriteTo(StreamOutput out)Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
X_FIELD_NAME
public static final java.lang.String X_FIELD_NAME- See Also:
- Constant Field Values
-
ZERO
-
ONE
-
TWO
-
AUTO
-
FIELD
public static final org.elasticsearch.common.ParseField FIELD
-
-
Constructor Details
-
Fuzziness
Read from a stream.- Throws:
java.io.IOException
-
-
Method Details
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput. -
fromEdits
Creates aFuzzinessinstance 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. -
build
-
parse
public static Fuzziness parse(org.elasticsearch.common.xcontent.XContentParser parser) throws java.io.IOException- Throws:
java.io.IOException
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
java.io.IOException
-
asDistance
public int asDistance() -
asDistance
public int asDistance(java.lang.String text) -
asFloat
public float asFloat() -
asString
public java.lang.String asString() -
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-