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.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 AUTO  
    static org.elasticsearch.common.ParseField FIELD  
    static Fuzziness ONE  
    static Fuzziness TWO  
    static java.lang.String X_FIELD_NAME  
    static Fuzziness ZERO  

    Fields 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
    int asDistance()  
    int asDistance​(java.lang.String text)  
    float asFloat()  
    java.lang.String asString()  
    static Fuzziness build​(java.lang.Object fuzziness)  
    boolean equals​(java.lang.Object obj)  
    static Fuzziness fromEdits​(int edits)
    Creates a Fuzziness instance from an edit distance.
    int hashCode()  
    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 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.common.xcontent.ToXContentFragment

    isFragment
  • Field Details

    • X_FIELD_NAME

      public static final java.lang.String X_FIELD_NAME
      See Also:
      Constant Field Values
    • ZERO

      public static final Fuzziness ZERO
    • ONE

      public static final Fuzziness ONE
    • TWO

      public static final Fuzziness TWO
    • AUTO

      public static final Fuzziness AUTO
    • FIELD

      public static final org.elasticsearch.common.ParseField FIELD
  • Constructor Details

    • Fuzziness

      public Fuzziness​(StreamInput in) throws java.io.IOException
      Read from a stream.
      Throws:
      java.io.IOException
  • Method Details

    • writeTo

      public void writeTo​(StreamOutput out) throws java.io.IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      java.io.IOException
    • 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.
    • build

      public static Fuzziness build​(java.lang.Object fuzziness)
    • 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:
      toXContent in interface org.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:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object