Class SpellCheckSuggestion

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

public class SpellCheckSuggestion extends Object implements Serializable
Represents a set of spelling suggestions on a spelling corrected term. Includes the offsets of the term location(s) in the original query so that it can be replaced.
See Also:
  • Constructor Details

    • SpellCheckSuggestion

      public SpellCheckSuggestion(String incorrectWord, List<String> suggestions, int startOffset, int endOffset)
      Parameters:
      incorrectWord - The incorrectly spelled word
      suggestions - The suggested spelling corrections for the incorrect word
      startOffset - The starting index in the original query of the incorrectly spelled string
      endOffset - The ending index in the original query of the incorrectly spelled string
  • Method Details

    • add

      public void add(String word)
      Adds a word to the suggestion list.
      Parameters:
      word - Suggested word.
    • addAll

      public void addAll(List<String> words)
      Adds a list of words to the suggestion list.
      Parameters:
      words - Suggested words.
    • addOccurrence

      public void addOccurrence(int startOffset, int endOffset)
      Adds an additional occurrence of this term in the search query.
      Parameters:
      startOffset - The starting index in the original query of the incorrectly spelled string
      endOffset - The ending index in the original query of the incorrectly spelled string
    • getIncorrectWord

      public String getIncorrectWord()
      The original word in the search query that is misspelled.
      Returns:
      original word in the search query that is misspelled
    • getSuggestions

      public List<String> getSuggestions()
      The suggested terms to replace the corrected word, ordered by recommendation.
      Returns:
      suggested terms to replace the corrected word
    • getOffsets

      The offset positions of this string in the original query. This is a list, as it's possible for a single term to appear multiple times in a single query.
      Returns:
      offset positions of this string in the original query
    • setIncorrectWord

      public void setIncorrectWord(String incorrectWord)
      The original word in the search query that is misspelled.
      Parameters:
      incorrectWords - original word in the search query that is misspelled
    • setSuggestions

      public void setSuggestions(List<String> suggestions)
      The suggested terms to replace the corrected word, ordered by recommendation.
      Parameters:
      suggestions - suggested terms to replace the corrected word
    • setOffsets

      public void setOffsets(List<SpellCheckSuggestion.TermPosition> offsets)
      The offset positions of this string in the original query. This is a list, as it's possible for a single term to appear multiple times in a single query.
      Parameters:
      offset - offset positions of this string in the original query
    • 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