org.apache.solr.spelling
Class ConjunctionSolrSpellChecker

java.lang.Object
  extended by org.apache.solr.spelling.SolrSpellChecker
      extended by org.apache.solr.spelling.ConjunctionSolrSpellChecker

public class ConjunctionSolrSpellChecker
extends SolrSpellChecker

This class lets a query be run through multiple spell checkers. The initial use-case is to use WordBreakSolrSpellChecker in conjunction with a "standard" spell checker (such as DirectSolrSpellChecker


Field Summary
 
Fields inherited from class org.apache.solr.spelling.SolrSpellChecker
analyzer, DEFAULT_DICTIONARY_NAME, DICTIONARY_NAME, field, FIELD, FIELD_TYPE, fieldTypeName, name
 
Constructor Summary
ConjunctionSolrSpellChecker()
           
 
Method Summary
 void addChecker(SolrSpellChecker checker)
           
 void build(SolrCore core, SolrIndexSearcher searcher)
          (re)Builds the spelling index.
protected  float getAccuracy()
          Get the value of SpellingParams.SPELLCHECK_ACCURACY if supported.
 String getDictionaryName()
           
 Analyzer getQueryAnalyzer()
           
protected  StringDistance getStringDistance()
          Get the distance implementation used by this spellchecker, or NULL if not applicable.
 SpellingResult getSuggestions(SpellingOptions options)
          Get suggestions for the given query.
 String init(NamedList config, SolrCore core)
           
 boolean isSuggestionsMayOverlap()
           
 SpellingResult mergeSuggestions(SpellCheckMergeData mergeData, int numSug, int count, boolean extendedResults)
          Integrate spelling suggestions from the various shards in a distributed environment.
 void reload(SolrCore core, SolrIndexSearcher searcher)
          Reloads the index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConjunctionSolrSpellChecker

public ConjunctionSolrSpellChecker()
Method Detail

addChecker

public void addChecker(SolrSpellChecker checker)

init

public String init(NamedList config,
                   SolrCore core)
Overrides:
init in class SolrSpellChecker

build

public void build(SolrCore core,
                  SolrIndexSearcher searcher)
           throws IOException
Description copied from class: SolrSpellChecker
(re)Builds the spelling index. May be a NOOP if the implementation doesn't require building, or can't be rebuilt.

Specified by:
build in class SolrSpellChecker
Throws:
IOException

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

mergeSuggestions

public SpellingResult mergeSuggestions(SpellCheckMergeData mergeData,
                                       int numSug,
                                       int count,
                                       boolean extendedResults)
Description copied from class: SolrSpellChecker
Integrate spelling suggestions from the various shards in a distributed environment.

Overrides:
mergeSuggestions in class SolrSpellChecker

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.

getQueryAnalyzer

public Analyzer getQueryAnalyzer()
Overrides:
getQueryAnalyzer in class SolrSpellChecker

getDictionaryName

public String getDictionaryName()
Overrides:
getDictionaryName in class SolrSpellChecker

getAccuracy

protected float getAccuracy()
Description copied from class: SolrSpellChecker
Get the value of SpellingParams.SPELLCHECK_ACCURACY if supported. Otherwise throws UnsupportedOperationException.

Overrides:
getAccuracy in class SolrSpellChecker

getStringDistance

protected 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

isSuggestionsMayOverlap

public boolean isSuggestionsMayOverlap()
Overrides:
isSuggestionsMayOverlap in class SolrSpellChecker


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.