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 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.Params

    Nested 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 Fuzziness
     
    static org.elasticsearch.common.xcontent.ParseField
     
    static Fuzziness
     
    static Fuzziness
     
    static Fuzziness
     

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor
    Description
    Read from a stream.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    int
    asDistance​(String text)
     
    float
     
     
    boolean
    equals​(Object obj)
     
    static Fuzziness
    fromEdits​(int edits)
    Creates a Fuzziness instance from an edit distance.
    static Fuzziness
    fromString​(String fuzzinessString)
    Creates a Fuzziness instance from a String representation.
    int
     
    static Fuzziness
    parse​(org.elasticsearch.common.xcontent.XContentParser parser)
     
    org.elasticsearch.common.xcontent.XContentBuilder
    toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
     
    void
    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.common.xcontent.ToXContentFragment

    isFragment
  • Field Details

    • FIELD

      public static final org.elasticsearch.common.xcontent.ParseField FIELD
    • ZERO

      public static final Fuzziness ZERO
    • ONE

      public static final Fuzziness ONE
    • TWO

      public static final Fuzziness TWO
    • AUTO

      public static final Fuzziness AUTO
  • Constructor Details

  • Method Details

    • fromEdits

      public static Fuzziness fromEdits(int edits)
      Creates a Fuzziness 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

      public static Fuzziness fromString(String fuzzinessString)
      Creates a Fuzziness 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

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • parse

      public static Fuzziness parse(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException
      Throws:
      IOException
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      IOException
    • asDistance

      public int asDistance()
    • asDistance

      public int asDistance(String text)
    • asFloat

      public float asFloat()
    • asString

      public String asString()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object