Class Highlight


  • public class Highlight
    extends DslCloneable
    Specifies how matching document fragments ("highlights") are calculated and incorporated into the returned results.
    • Constructor Summary

      Constructors 
      Constructor Description
      Highlight​(java.util.Collection<java.lang.String> fields, java.lang.String pre, java.lang.String post, java.lang.Integer length, java.lang.Integer count, java.lang.Boolean defaultHighlight)  
    • Constructor Detail

      • Highlight

        public Highlight​(java.util.Collection<java.lang.String> fields,
                         java.lang.String pre,
                         java.lang.String post,
                         java.lang.Integer length,
                         java.lang.Integer count,
                         java.lang.Boolean defaultHighlight)
    • Method Detail

      • getFields

        public java.util.Collection<java.lang.String> getFields()
        Returns:
        the fields to consider for highlighting. Wildcard-based values ("*", "text_lang_*", etc.) are allowed but should be used carefully to avoid impacting performance.
      • setFields

        public void setFields​(java.util.Collection<java.lang.String> fields)
      • getLength

        public java.lang.Integer getLength()
        Returns:
        the target size for highlight fragments, in characters. "0" is treated as a flag value to indicate that the entire field value should be used as the fragment. Defaults to "100" if not specified.
      • setLength

        public void setLength​(java.lang.Integer length)
      • getCount

        public java.lang.Integer getCount()
        Returns:
        the number of highlight fragments to attempt to generate per field. Defaults to 1.
      • setCount

        public void setCount​(java.lang.Integer count)
      • getDefaultHighlight

        public java.lang.Boolean getDefaultHighlight()
        Returns:
        whether or not a default highlight fragment should be included where none could be generated. Defaults to false.
      • setDefaultHighlight

        public void setDefaultHighlight​(java.lang.Boolean defaultHighlight)
      • getPre

        public java.lang.String getPre()
        Returns:
        the text that will be prepended to each highlighted fragment. Typically a HTML or XML opening tag, though any string may be used. Defaults to <em>
      • setPre

        public void setPre​(java.lang.String pre)
      • getPost

        public java.lang.String getPost()
        Returns:
        the text that will be appended to each highlighted fragment. Typically a HTML or XML closing tag, though any string may be used. Defaults to </em>
      • setPost

        public void setPost​(java.lang.String post)