SOLR-474 - Spellchecker javadoc improvements

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@686022 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Otis Gospodnetic 2008-08-14 20:27:55 +00:00
parent 514c45366a
commit 0aa8af11c1
7 changed files with 31 additions and 24 deletions

View File

@ -24,10 +24,11 @@ import org.apache.solr.schema.FieldType;
/**
* Abstract base class for all Lucene based spell checking implementations.
* Abstract base class for all Lucene-based spell checking implementations.
*
* <p>
* Refer to http://wiki.apache.org/solr/SpellCheckComponent for more details
* Refer to <a href="http://wiki.apache.org/solr/SpellCheckComponent">SpellCheckComponent</a>
* for more details.
* </p>
*
* @since solr 1.3

View File

@ -40,8 +40,7 @@ import org.apache.solr.search.SolrIndexSearcher;
/**
* <p>
* A spell checker implementation which can load words from a text
* file (one word per line).
* A spell checker implementation that loads words from a text file (one word per line).
* </p>
*
* @since solr 1.3

View File

@ -33,11 +33,12 @@ import java.util.logging.Logger;
/**
* <p>
* A spell checker implementation which can load words from Solr as well as arbitary Lucene indices.
* A spell checker implementation that loads words from Solr as well as arbitary Lucene indices.
* </p>
*
* <p>
* Refer to http://wiki.apache.org/solr/SpellCheckComponent for more details
* Refer to <a href="http://wiki.apache.org/solr/SpellCheckComponent">SpellCheckComponent</a>
* for more details.
* </p>
*
* @since solr 1.3
@ -109,7 +110,6 @@ public class IndexBasedSpellChecker extends AbstractLuceneSpellChecker {
initSourceReader();
}
public float getThreshold() {
return threshold;
}

View File

@ -17,14 +17,15 @@ import java.util.Collection;
* <p>
* It is only invoked for the CommonParams.Q parameter, and <b>not</b> the
* "spellcheck.q" parameter. Systems that use their own query parser or those
* that find issue with the basic implementation will want to implement their
* that find issue with the basic implementation should implement their
* own QueryConverter instead of using the provided implementation
* (SpellingQueryConverter) by overriding the appropriate methods on the
* SpellingQueryConverter and registering it in the solrconfig.xml
* </p>
*
* <p>
* Refer to http://wiki.apache.org/solr/SpellCheckComponent for more details
* Refer to <a href="http://wiki.apache.org/solr/SpellCheckComponent">SpellCheckComponent</a>
* for more details
* </p>
*
* @since solr 1.3

View File

@ -29,7 +29,8 @@ import java.util.Collection;
/**
* <p>
* Refer to http://wiki.apache.org/solr/SpellCheckComponent for more details
* Refer to <a href="http://wiki.apache.org/solr/SpellCheckComponent">SpellCheckComponent</a>
* for more details.
* </p>
*
* @since solr 1.3
@ -37,10 +38,11 @@ import java.util.Collection;
public abstract class SolrSpellChecker {
public static final String DICTIONARY_NAME = "name";
public static final String DEFAULT_DICTIONARY_NAME = "default";
/** Dictionary name */
protected String name;
protected Analyzer analyzer;
public String init(NamedList config, SolrCore core){
public String init(NamedList config, SolrCore core) {
name = (String) config.get(DICTIONARY_NAME);
if (name == null) {
name = DEFAULT_DICTIONARY_NAME;
@ -48,25 +50,23 @@ public abstract class SolrSpellChecker {
return name;
}
public Analyzer getQueryAnalyzer() {
public Analyzer getQueryAnalyzer() {
return analyzer;
}
public String getDictionaryName() {
return name;
}
/**
* Reload the index. Useful if an external process is responsible for building the spell checker.
* Reloads the index. Useful if an external process is responsible for building the spell checker.
*
* @throws java.io.IOException
*/
public abstract void reload() throws IOException;
/**
* (re)Build The Spelling index. May be a NOOP if the implementation doesn't require building, or can't be rebuilt
* (re)Builds the spelling index. May be a NOOP if the implementation doesn't require building, or can't be rebuilt.
*/
public abstract void build(SolrCore core, SolrIndexSearcher searcher);
@ -99,8 +99,8 @@ public abstract class SolrSpellChecker {
}
/**
* Get suggestions for the given query. Tokenizes the query using a field appropriate Analyzer. The {@link SpellingResult#getSuggestions()} suggestions must be ordered by
* best suggestion first
* Get suggestions for the given query. Tokenizes the query using a field appropriate Analyzer.
* The {@link SpellingResult#getSuggestions()} suggestions must be ordered by best suggestion first.
*
* @param tokens The Tokens to be spell checked.
* @param reader The (optional) IndexReader. If there is not IndexReader, than extendedResults are not possible

View File

@ -30,6 +30,8 @@ import org.apache.lucene.analysis.TokenStream;
/**
* Converts the query string to a Collection of Lucene tokens using a regular expression.
* Boolean operators AND and OR are skipped.
*
* @since solr 1.3
**/
@ -37,9 +39,13 @@ public class SpellingQueryConverter extends QueryConverter {
protected Pattern QUERY_REGEX = Pattern.compile("(?:(?!(\\w+:|\\d+)))\\w+");
/**
* Converts the original query string to a collection of Lucene Tokens.
* @param original the original query string
* @return a Collection of Lucene Tokens
*/
public Collection<Token> convert(String original) {
if( original == null ) { // this can happen with q.alt = and no query
if (original == null) { // this can happen with q.alt = and no query
return Collections.emptyList();
}
Collection<Token> result = new ArrayList<Token>();

View File

@ -10,7 +10,7 @@ import java.util.List;
/**
* Implementations of SolrSpellChecker must return suggestions as SpellResult instance.
* This is converted into the required NamedList format in SpellCheckComponent
* This is converted into the required NamedList format in SpellCheckComponent.
*
* @since solr 1.3
*/
@ -34,7 +34,7 @@ public class SpellingResult {
}
/**
* Add a whole bunch of suggestions, and don't worry about frequency
* Adds a whole bunch of suggestions, and does not worry about frequency.
*
* @param token The token to associate the suggestions with
* @param suggestions The suggestions
@ -58,7 +58,7 @@ public class SpellingResult {
}
/**
* Suggestions must be added with the best suggestion first. ORDER is important
* Suggestions must be added with the best suggestion first. ORDER is important.
* @param token The {@link org.apache.lucene.analysis.Token}
* @param suggestion The suggestion for the Token
* @param docFreq The document frequency
@ -74,7 +74,7 @@ public class SpellingResult {
}
/**
* Get the suggestions for the given token
* Gets the suggestions for the given token.
*
* @param token The {@link org.apache.lucene.analysis.Token} to look up
* @return A LinkedHashMap of the suggestions. Key is the suggestion, value is the token frequency in the index, else {@link #NO_FREQUENCY_INFO}.