Class ResultField


  • public class ResultField
    extends Object
    Represents a field in a search results document
    • Constructor Detail

      • ResultField

        public ResultField()
        Create a blank result field
      • ResultField

        public ResultField​(String name)
        Create a result field with the given name
        Parameters:
        name - the field name
    • Method Detail

      • withRaw

        public ResultField withRaw()
        Enable the return of the raw representation of this field
        Returns:
        this field
      • withRaw

        public ResultField withRaw​(int size)
        Enable the return of the raw representation of this field, with the given field size max
        Parameters:
        size - the maximum number of characters to return
        Returns:
        this field
      • withoutRaw

        public ResultField withoutRaw()
        Disable the return of the raw representation of this field
        Returns:
        this field
      • withSnippet

        public ResultField withSnippet()
        Enable the return of the snippet representation of this field
        Returns:
        this field
      • withSnippet

        public ResultField withSnippet​(int size)
        Enable the return of the snippet representation of this field, with the given max length
        Parameters:
        size - Character length of the snippet returned. Must be at least 20; defaults to 100.
        Returns:
        this field
      • withSnippet

        public ResultField withSnippet​(int size,
                                       Boolean fallback)
        Enable the return of the snippet representation of this field, with given max length, and fallback field config
        Parameters:
        size - Character length of the snippet returned. Must be at least 20; defaults to 100.
        fallback - If true, return the raw text field if no snippet is found. If false, only use snippets.
        Returns:
        this field
      • withSnippet

        public ResultField withSnippet​(Boolean fallback)
        Enable the return of the snippet representation of this field, with fallback field config
        Parameters:
        fallback - If true, return the raw text field if no snippet is found. If false, only use snippets.
        Returns:
        this field
      • withoutSnippet

        public ResultField withoutSnippet()
        Disable the return of the snippet representation of this field
        Returns:
        this field
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getName

        public String getName()
        The name of the field
        Returns:
        the field name
      • setName

        public ResultField setName​(String name)
        The name of the field
        Parameters:
        name - the field name
        Returns:
        this.
      • setRaw

        public ResultField setRaw​(co.elasticsearch.enterprisesearch.client.model.request.search.ResultFieldRendered raw)
        An exact representation of the value within a field. And it is exact! It is not HTML escaped.
        Parameters:
        raw - The raw field
        Returns:
        this.
      • setSnippet

        public ResultField setSnippet​(co.elasticsearch.enterprisesearch.client.model.request.search.ResultFieldRendered snippet)
        A snippet is an HTML escaped representation of the value within a field, where query matches are captured in <em> tags.
        Parameters:
        snippet - The snippet field
        Returns:
        this.