LUCENE-1046: Removed dead code in SpellChecker

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@659019 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Otis Gospodnetic 2008-05-22 06:34:18 +00:00
parent f68c9544de
commit b4f7c37bd1
2 changed files with 7 additions and 3 deletions

View File

@ -99,6 +99,9 @@ Bug fixes
methods, plus removal of IndexReader reference. methods, plus removal of IndexReader reference.
(Naveen Belkale via Otis Gospodnetic) (Naveen Belkale via Otis Gospodnetic)
10. LUCENE-1046: Removed dead code in SpellChecker
(Daniel Naber via Otis Gospodnetic)
New features New features
1. LUCENE-1137: Added Token.set/getFlags() accessors for passing more information about a Token through the analysis 1. LUCENE-1137: Added Token.set/getFlags() accessors for passing more information about a Token through the analysis

View File

@ -152,7 +152,7 @@ public class SpellChecker {
* @param ir the indexReader of the user index (can be null see field param) * @param ir the indexReader of the user index (can be null see field param)
* @param field the field of the user index: if field is not null, the suggested * @param field the field of the user index: if field is not null, the suggested
* words are restricted to the words present in this field. * words are restricted to the words present in this field.
* @param morePopular return only the suggest words that are more frequent than the searched word * @param morePopular return only the suggest words that are as frequent or more frequent than the searched word
* (only if restricted mode = (indexReader!=null and field!=null) * (only if restricted mode = (indexReader!=null and field!=null)
* @throws IOException * @throws IOException
* @return String[] the sorted list of the suggest words with these 2 criteria: * @return String[] the sorted list of the suggest words with these 2 criteria:
@ -166,9 +166,10 @@ public class SpellChecker {
final TRStringDistance sd = new TRStringDistance(word); final TRStringDistance sd = new TRStringDistance(word);
final int lengthWord = word.length(); final int lengthWord = word.length();
final int goalFreq = (morePopular && ir != null) ? ir.docFreq(new Term(field, word)) : 0; final int freq = (ir != null && field != null) ? ir.docFreq(new Term(field, word)) : 0;
final int goalFreq = (morePopular && ir != null && field != null) ? freq : 0;
// if the word exists in the real index and we don't care for word frequency, return the word itself // if the word exists in the real index and we don't care for word frequency, return the word itself
if (!morePopular && goalFreq > 0) { if (!morePopular && freq > 0) {
return new String[] { word }; return new String[] { word };
} }