Class HighlightOptions

java.lang.Object
org.springframework.data.solr.core.query.HighlightOptions

public class HighlightOptions extends Object
Empty Options indicate to set hl=true. As long as there are no fields defined * will be used. Some options like can be set directly. Any option can be set via .
  • Field Details

    • ALL_FIELDS

      public static final Field ALL_FIELDS
  • Constructor Details

    • HighlightOptions

      public HighlightOptions()
  • Method Details

    • addField

      public HighlightOptions addField(Field field)
      Add field to highlight
      Parameters:
      field -
      Returns:
    • addField

      public HighlightOptions addField(String fieldname)
      Add name of field to highlight on
      Parameters:
      fieldname -
      Returns:
    • addField

      public HighlightOptions addField(String... fieldnames)
      Add names of fields to highlight on
      Parameters:
      fieldnames -
      Returns:
    • addFields

      public HighlightOptions addFields(Collection<String> fieldnames)
      Add names of fields to highlight on
      Parameters:
      fieldnames -
      Returns:
    • getQuery

      @Nullable public FilterQuery getQuery()
      Returns:
      null if not set
    • setQuery

      public HighlightOptions setQuery(FilterQuery query)
      Set to be used for hl.q
      Parameters:
      query -
    • getFragsize

      @Nullable public Integer getFragsize()
      Returns:
      null if not set
    • setFragsize

      public HighlightOptions setFragsize(Integer fragsize)
      set fragsize hl.fragsize.
      Parameters:
      fragsize -
    • getFormatter

      @Nullable public String getFormatter()
      Returns:
      null if not set
    • setFormatter

      public HighlightOptions setFormatter(String formatter)
      set formatter hl.formatter
      Parameters:
      formatter -
    • getNrSnipplets

      @Nullable public Integer getNrSnipplets()
      Returns:
      null if not set
    • setNrSnipplets

      public HighlightOptions setNrSnipplets(Integer nrSnipplets)
      set hl.snippets
      Parameters:
      nrSnipplets -
    • setSimplePrefix

      public HighlightOptions setSimplePrefix(String prefix)
      set hl.simple.pre
      Parameters:
      prefix -
    • getSimplePrefix

      @Nullable public String getSimplePrefix()
      Returns:
    • setSimplePostfix

      public HighlightOptions setSimplePostfix(String postfix)
      set hl.simple.post
      Parameters:
      postfix -
    • getSimplePostfix

      @Nullable public String getSimplePostfix()
      Returns:
    • getFields

      public List<Field> getFields()
      Returns:
      unmodifiable list of fields
    • getHighlightParameters

      public Collection<HighlightOptions.HighlightParameter> getHighlightParameters()
      Returns:
      collection of all parameters
    • addHighlightParameter

      public HighlightOptions addHighlightParameter(String parameterName, Object value)
      Add parameter by name
      Parameters:
      parameterName - must not be null
      value -
      Returns:
    • addHighlightParameter

      public HighlightOptions addHighlightParameter(HighlightOptions.HighlightParameter parameter)
      Add parameter
      Parameters:
      parameter - must not be null
      Returns:
    • getHighlightParameterValue

      @Nullable public <S> S getHighlightParameterValue(String parameterName)
      Get value of parameter with given type
      Parameters:
      parameterName -
      Returns:
      null if not present
    • getFieldsWithHighlightParameters

      public Collection<HighlightOptions.FieldWithHighlightParameters> getFieldsWithHighlightParameters()
      Get Collection of fields that have field specific highlight options.
      Returns:
    • hasQuery

      public boolean hasQuery()
      Returns:
      true if query is not null
    • hasFields

      public boolean hasFields()
      Returns:
      true if at least one field available