Apache Lucene open-source search software
SOLR-474 - Spellchecker javadoc improvements
Otis Gospodnetic0aa8af11c18a
diff --git a/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java b/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.javaindex 9ac396e9a4e..d51367d92e2 100644--- a/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java+++ b/src/java/org/apache/solr/spelling/AbstractLuceneSpellChecker.java@@ -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.3diff --git a/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java b/src/java/org/apache/solr/spelling/FileBasedSpellChecker.javaindex d617c78efe1..0fa9244dadb 100644--- a/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java+++ b/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java@@ -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.3diff --git a/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java b/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.javaindex a416dcbf490..8ba7a69a2da 100644--- a/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java+++ b/src/java/org/apache/solr/spelling/IndexBasedSpellChecker.java@@ -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;}diff --git a/src/java/org/apache/solr/spelling/QueryConverter.java b/src/java/org/apache/solr/spelling/QueryConverter.javaindex b9d3c8e217a..8f6b7aaa342 100644--- a/src/java/org/apache/solr/spelling/QueryConverter.java+++ b/src/java/org/apache/solr/spelling/QueryConverter.java@@ -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.3diff --git a/src/java/org/apache/solr/spelling/SolrSpellChecker.java b/src/java/org/apache/solr/spelling/SolrSpellChecker.javaindex c23951bb086..eebe5c1bb03 100644--- a/src/java/org/apache/solr/spelling/SolrSpellChecker.java+++ b/src/java/org/apache/solr/spelling/SolrSpellChecker.java@@ -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 possiblediff --git a/src/java/org/apache/solr/spelling/SpellingQueryConverter.java b/src/java/org/apache/solr/spelling/SpellingQueryConverter.javaindex 000c46e22da..2db8216fbb3 100644--- a/src/java/org/apache/solr/spelling/SpellingQueryConverter.java+++ b/src/java/org/apache/solr/spelling/SpellingQueryConverter.java@@ -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 queryreturn Collections.emptyList();}Collection<Token> result = new ArrayList<Token>();diff --git a/src/java/org/apache/solr/spelling/SpellingResult.java b/src/java/org/apache/solr/spelling/SpellingResult.javaindex 1ef73a9d3ef..18d6c0b6fad 100644--- a/src/java/org/apache/solr/spelling/SpellingResult.java+++ b/src/java/org/apache/solr/spelling/SpellingResult.java@@ -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}.