Class SpellcheckOptions

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

public class SpellcheckOptions extends Object
SpellcheckOptions allows modification of query parameters targeting the SpellCheck component is designed to provide inline query suggestions based on other, similar, terms.
Since:
2.1
  • Method Details

    • spellcheck

      public static SpellcheckOptions spellcheck()
      Creates new SpellcheckOptions.
      Returns:
    • spellcheck

      public static SpellcheckOptions spellcheck(Query q)
      Creates new SpellcheckOptions with a given Query.
      Parameters:
      q -
      Returns:
    • getQuery

      @Nullable public Query getQuery()
      Get the query to be used for spellchecking.
      Returns:
      can be null.
    • getParams

      public Map<String,Object> getParams()
      Returns:
      never null.
    • buildDictionary

      public SpellcheckOptions buildDictionary()
      If set, Solr creates the dictionary that the SolrSpellChecker will use for spell-checking.
      Returns:
      new SpellcheckOptions
    • buildDirectory

      public boolean buildDirectory()
      Returns:
      can be null.
    • collate

      public SpellcheckOptions collate()
      If set, Solr will take the best suggestion for each token (if one exists) and construct a new query from the suggestions.
      Returns:
      new SpellcheckOptions
    • getCollate

      public boolean getCollate()
      Returns:
      can be null.
    • maxCollations

      public SpellcheckOptions maxCollations(long max)
      The maximum number of collations to return.
      Parameters:
      max -
      Returns:
    • getMaxCollations

      @Nullable public Long getMaxCollations()
      Returns:
      can be null.
    • maxCollationTries

      public SpellcheckOptions maxCollationTries(long tries)
      This parameter specifies the number of collation possibilities for Solr to try before giving up.
      Parameters:
      tries -
      Returns:
    • getMaxCollationTries

      @Nullable public Long getMaxCollationTries()
      Returns:
      can be null.
    • maxCollationEvaluations

      public SpellcheckOptions maxCollationEvaluations(long evaluations)
      This parameter specifies the maximum number of word correction combinations to rank and evaluate prior to deciding which collation candidates to test against the index.
      Parameters:
      evaluations -
      Returns:
    • getMaxCollationEvaluations

      @Nullable public Long getMaxCollationEvaluations()
      Returns:
      can be null.
    • extendedResults

      public SpellcheckOptions extendedResults()
      Enable the extended response format, which is more complicated but richer. Returns the document frequency for each suggestion and returns one suggestion block for each term in the query string.
      Returns:
    • getExtendedResults

      @Nullable public Boolean getExtendedResults()
      Returns:
      can be null.
    • collateExtendedResults

      public SpellcheckOptions collateExtendedResults()
      Instructs Solr to return an expanded response format detailing the collations found.
      Returns:
    • getCollateExtendedResults

      public boolean getCollateExtendedResults()
      Returns:
    • maxCollationCollectDocs

      public SpellcheckOptions maxCollationCollectDocs(long nr)
      This parameter specifies the maximum number of documents that should be collect when testing potential collations against the index.
      Parameters:
      nr -
      Returns:
    • getMaxCollationCollectDocs

      @Nullable public Long getMaxCollationCollectDocs()
      Returns:
      can be null.
    • collateParam

      public SpellcheckOptions collateParam(String param, Object value)
      This parameter prefix can be used to specify any additional parameters that you wish to the Spellchecker to use when internally validating collation queries.
      Parameters:
      param -
      value -
      Returns:
    • getCollateParams

      public Map<String,Object> getCollateParams()
      Returns:
      can be null.
    • count

      public SpellcheckOptions count(long nr)
      Specifies the maximum number of spelling suggestions to be returned.
      Parameters:
      nr -
      Returns:
    • getCount

      @Nullable public Long getCount()
      Returns:
      can be null.
    • dictionaries

      public SpellcheckOptions dictionaries(String... names)
      This parameter causes Solr to use the dictionary named in the parameter's argument. The default setting is "default". This parameter can be used to invoke a specific spellchecker on a per request basis.
      Returns:
    • getDictionary

      @Nullable public String[] getDictionary()
      Returns:
      can be null.
    • onlyMorePopular

      public SpellcheckOptions onlyMorePopular()
      Limits spellcheck responses to queries that are more popular than the original query.
      Returns:
    • getOnlyMorePopular

      public boolean getOnlyMorePopular()
      Returns:
      never null.
    • maxResultsForSuggest

      public SpellcheckOptions maxResultsForSuggest(long nr)
      The maximum number of hits the request can return in order to both generate spelling suggestions and set the correctlySpelled element to false.
      Parameters:
      nr -
      Returns:
    • getMaxResultsForSuggest

      @Nullable public Long getMaxResultsForSuggest()
      Returns:
      can be null.
    • alternativeTermCount

      public SpellcheckOptions alternativeTermCount(long nr)
      The count of suggestions to return for each query term existing in the index and/or dictionary.
      Parameters:
      nr -
      Returns:
    • getAlternativeTermCount

      @Nullable public Long getAlternativeTermCount()
      Returns:
      can be null.
    • accuracy

      public SpellcheckOptions accuracy(float nr)
      Specifies an accuracy value to be used by the spell checking implementation to decide whether a result is worthwhile or not. The value is a float between 0 and 1.
      Parameters:
      nr -
      Returns:
    • getAccuracy

      @Nullable public Float getAccuracy()
      Returns:
      can be null.