Class AbstractLuceneSpellChecker

java.lang.Object
org.apache.solr.spelling.SolrSpellChecker
org.apache.solr.spelling.AbstractLuceneSpellChecker
Direct Known Subclasses:
FileBasedSpellChecker, IndexBasedSpellChecker

public abstract class AbstractLuceneSpellChecker extends SolrSpellChecker
Abstract base class for all Lucene-based spell checking implementations.

Refer to https://solr.apache.org/guide/solr/latest/query-guide/spell-checking.html for more details.

Since:
solr 1.3
  • Field Details

  • Constructor Details

    • AbstractLuceneSpellChecker

      public AbstractLuceneSpellChecker()
  • Method Details

    • init

      public String init(org.apache.solr.common.util.NamedList<?> config, SolrCore core)
      Overrides:
      init in class SolrSpellChecker
    • getSuggestions

      public SpellingResult getSuggestions(SpellingOptions options) throws IOException
      Description copied from class: SolrSpellChecker
      Get suggestions for the given query. Tokenizes the query using a field appropriate Analyzer. The SpellingResult.getSuggestions() suggestions must be ordered by best suggestion first.
      Specified by:
      getSuggestions in class SolrSpellChecker
      Parameters:
      options - The SpellingOptions to use
      Returns:
      The SpellingResult suggestions
      Throws:
      IOException - if there is an error producing suggestions
    • determineReader

      protected org.apache.lucene.index.IndexReader determineReader(org.apache.lucene.index.IndexReader reader)
    • reload

      public void reload(SolrCore core, SolrIndexSearcher searcher) throws IOException
      Description copied from class: SolrSpellChecker
      Reloads the index. Useful if an external process is responsible for building the spell checker.
      Specified by:
      reload in class SolrSpellChecker
      Throws:
      IOException - If there is a low-level I/O error.
    • initIndex

      protected void initIndex() throws IOException
      Initialize the index variable based on the indexDir. Does not actually create the spelling index.
      Throws:
      IOException - If there is a low-level I/O error.
    • getAccuracy

      public float getAccuracy()
      Description copied from class: SolrSpellChecker
      Get the value of SpellingParams.SPELLCHECK_ACCURACY if supported. Otherwise throws UnsupportedOperationException.
      Overrides:
      getAccuracy in class SolrSpellChecker
    • getField

      public String getField()
    • getFieldTypeName

      public String getFieldTypeName()
    • getIndexDir

      public Path getIndexDir()
    • getSourceLocation

      public String getSourceLocation()
    • getStringDistance

      public org.apache.lucene.search.spell.StringDistance getStringDistance()
      Description copied from class: SolrSpellChecker
      Get the distance implementation used by this spellchecker, or NULL if not applicable.
      Overrides:
      getStringDistance in class SolrSpellChecker
    • getSpellChecker

      public org.apache.lucene.search.spell.SpellChecker getSpellChecker()