Class SpellCheckResult

java.lang.Object
com.broadleafcommerce.search.api.domain.SpellCheckResult
All Implemented Interfaces:
Serializable

public class SpellCheckResult extends Object implements Serializable
See Also:
  • Constructor Details

    • SpellCheckResult

      public SpellCheckResult(String originalQuery)
  • Method Details

    • addSpellSuggestion

      public void addSpellSuggestion(String incorrectWord, List<String> wordSuggestions, int startOffset, int endOffset)
      Add a new spell check suggestion to the results.
      Parameters:
      incorrectWord - the word to suggest a replacement for
      wordSuggestions - the suggested replacement words
      startOffset - the starting index of the incorrect word
      endOffset - the end index of the incorrect word
    • addQuerySuggestion

      public void addQuerySuggestion(String suggestedQuery, long numberOfHits)
      Add a suggested query replacement.
      Parameters:
      suggestedQuery - the suggested replacement query
      numberOfHits - the number of hits for the suggested query
    • getTopSuggestionQuery

      @Nullable public String getTopSuggestionQuery()
      Get the best suggested query based on the number of hits.
      Returns:
      best suggested query
    • getSuggestions

      public Collection<SpellCheckSuggestion> getSuggestions()
      Get all of the spell check suggestions.
      Returns:
      all spell check suggestions
    • getOriginalQuery

      public String getOriginalQuery()
      The original search query.
      Returns:
      original search query
    • getSuggestedQueries

      public List<SpellCheckResult.SuggestedQuery> getSuggestedQueries()
      The suggested queries after spell correction, in order of most to least recommended.
      Returns:
      suggested queries after spell correction
    • getSuggestionMap

      public Map<String,SpellCheckSuggestion> getSuggestionMap()
      Suggested spelling corrections of the original query to retrieve results.
      Returns:
      suggested spelling corrections
    • setOriginalQuery

      public void setOriginalQuery(String originalQuery)
      The original search query.
      Parameters:
      originalQuery - original search query
    • setSuggestedQueries

      public void setSuggestedQueries(List<SpellCheckResult.SuggestedQuery> suggestedQueries)
      The suggested queries after spell correction, in order of most to least recommended.
      Parameters:
      suggestedQueries - suggested queries after spell correction
    • setSuggestionMap

      public void setSuggestionMap(Map<String,SpellCheckSuggestion> suggestionMap)
      Suggested spelling corrections of the original query to retrieve results.
      Parameters:
      suggestionMap - suggested spelling corrections
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object