org.apache.solr.spelling
Class SolrSpellChecker

java.lang.Object
  extended by org.apache.solr.spelling.SolrSpellChecker
Direct Known Subclasses:
AbstractLuceneSpellChecker

public abstract class SolrSpellChecker
extends Object

Refer to SpellCheckComponent for more details.

Since:
solr 1.3

Field Summary
protected  Analyzer analyzer
           
static String DEFAULT_DICTIONARY_NAME
           
static String DICTIONARY_NAME
           
protected  String name
          Dictionary name
 
Constructor Summary
SolrSpellChecker()
           
 
Method Summary
abstract  void build(SolrCore core, SolrIndexSearcher searcher)
          (re)Builds the spelling index.
 String getDictionaryName()
           
 Analyzer getQueryAnalyzer()
           
 SpellingResult getSuggestions(Collection<Token> tokens, IndexReader reader)
          Assumes count = 1, onlyMorePopular = false, extendedResults = false
 SpellingResult getSuggestions(Collection<Token> tokens, IndexReader reader, boolean onlyMorePopular, boolean extendedResults)
          Assumes count = 1.
 SpellingResult getSuggestions(Collection<Token> tokens, IndexReader reader, int count)
          Assumes onlyMorePopular = false, extendedResults = false
abstract  SpellingResult getSuggestions(Collection<Token> tokens, IndexReader reader, int count, boolean onlyMorePopular, boolean extendedResults)
          Get suggestions for the given query.
 String init(NamedList config, SolrCore core)
           
abstract  void reload()
          Reloads the index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DICTIONARY_NAME

public static final String DICTIONARY_NAME
See Also:
Constant Field Values

DEFAULT_DICTIONARY_NAME

public static final String DEFAULT_DICTIONARY_NAME
See Also:
Constant Field Values

name

protected String name
Dictionary name


analyzer

protected Analyzer analyzer
Constructor Detail

SolrSpellChecker

public SolrSpellChecker()
Method Detail

init

public String init(NamedList config,
                   SolrCore core)

getQueryAnalyzer

public Analyzer getQueryAnalyzer()

getDictionaryName

public String getDictionaryName()

reload

public abstract void reload()
                     throws IOException
Reloads the index. Useful if an external process is responsible for building the spell checker.

Throws:
IOException

build

public abstract void build(SolrCore core,
                           SolrIndexSearcher searcher)
(re)Builds the spelling index. May be a NOOP if the implementation doesn't require building, or can't be rebuilt.


getSuggestions

public SpellingResult getSuggestions(Collection<Token> tokens,
                                     IndexReader reader)
                              throws IOException
Assumes count = 1, onlyMorePopular = false, extendedResults = false

Throws:
IOException
See Also:
getSuggestions(Collection, org.apache.lucene.index.IndexReader, int, boolean, boolean)

getSuggestions

public SpellingResult getSuggestions(Collection<Token> tokens,
                                     IndexReader reader,
                                     int count)
                              throws IOException
Assumes onlyMorePopular = false, extendedResults = false

Throws:
IOException
See Also:
getSuggestions(Collection, org.apache.lucene.index.IndexReader, int, boolean, boolean)

getSuggestions

public SpellingResult getSuggestions(Collection<Token> tokens,
                                     IndexReader reader,
                                     boolean onlyMorePopular,
                                     boolean extendedResults)
                              throws IOException
Assumes count = 1.

Throws:
IOException
See Also:
getSuggestions(Collection, org.apache.lucene.index.IndexReader, int, boolean, boolean)

getSuggestions

public abstract SpellingResult getSuggestions(Collection<Token> tokens,
                                              IndexReader reader,
                                              int count,
                                              boolean onlyMorePopular,
                                              boolean extendedResults)
                                       throws IOException
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.

Parameters:
tokens - The Tokens to be spell checked.
reader - The (optional) IndexReader. If there is not IndexReader, than extendedResults are not possible
count - The maximum number of suggestions to return
onlyMorePopular - TODO
extendedResults - TODO
Throws:
IOException


Copyright © 2010 Apache Software Foundation. All Rights Reserved.