You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by ot...@apache.org on 2007/03/02 19:28:55 UTC
svn commit: r513878 -
/lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java
Author: otis
Date: Fri Mar 2 10:28:55 2007
New Revision: 513878
URL: http://svn.apache.org/viewvc?view=rev&rev=513878
Log:
- LUCENE-786: Javadoc improvements from Karl Wettin and an extra searcher.close() from me
Modified:
lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java
Modified: lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java?view=diff&rev=513878&r1=513877&r2=513878
==============================================================================
--- lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java (original)
+++ lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java Fri Mar 2 10:28:55 2007
@@ -88,6 +88,10 @@
IndexWriter writer = new IndexWriter(spellIndex, null, true);
writer.close();
}
+ // close the old searcher, if there was one
+ if (searcher != null) {
+ searcher.close();
+ }
searcher = new IndexSearcher(this.spellIndex);
}
@@ -99,6 +103,14 @@
}
/**
+ * As the Lucene similarity that is used to fetch the most relevant n-grammed terms
+ * is not the same as the edit distance strategy used to calculate the best
+ * matching spell-checked word from the hits that Lucene found, one usually has
+ * to retrieve a couple of numSug's in order to get the true best match.
+ *
+ * I.e. if numSug == 1, don't count on that suggestion being the best one.
+ * Thus, you should set this value to <b>at least</b> 5 for a good suggestion.
+ *
* Suggest similar words
* @param word String the word you want a spell check done on
* @param numSug int the number of suggest words
@@ -110,6 +122,14 @@
}
/**
+ * As the Lucene similarity that is used to fetch the most relevant n-grammed terms
+ * is not the same as the edit distance strategy used to calculate the best
+ * matching spell-checked word from the hits that Lucene found, one usually has
+ * to retrieve a couple of numSug's in order to get the true best match.
+ *
+ * I.e. if numSug == 1, don't count on that suggestion being the best one.
+ * Thus, you should set this value to <b>at least</b> 5 for a good suggestion.
+ *
* Suggest similar words (restricted or not to a field of a user index)
* @param word String the word you want a spell check done on
* @param numSug int the number of suggest words