Issue Details (XML | Word | Printable)

Key: LUCENE-1046
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Otis Gospodnetic
Reporter: Joe
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Lucene - Java

Dead code in SpellChecker.java (branch never executes)

Created: 03/Nov/07 11:34 PM   Updated: 24/May/08 02:46 PM
Return to search
Component/s: contrib/spellchecker
Affects Version/s: 2.2
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works LUCENE-1046.diff 2007-11-26 10:31 PM Daniel Naber 2 kB

Lucene Fields: Patch Available, New
Resolution Date: 22/May/08 06:36 AM


 Description  « Hide
SpellChecker contains the following lines of code:

final int goalFreq = (morePopular && ir != null) ? ir.docFreq(new Term(field, word)) : 0;
// if the word exists in the real index and we don't care for word frequency, return the word itself
if (!morePopular && goalFreq > 0) {
return new String[] { word };
}

The branch will never execute: the only way for goalFreq to be greater than zero is if morePopular is true, but if morePopular is true, the expression in the if statement evaluates to false.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Hoss Man made changes - 06/Nov/07 12:46 AM
Field Original Value New Value
Component/s contrib/benchmark [ 12311676 ]
Component/s contrib/* [ 12312028 ]
Daniel Naber added a comment - 26/Nov/07 10:31 PM
Thanks for your report, could you try out this patch?

Daniel Naber made changes - 26/Nov/07 10:31 PM
Attachment LUCENE-1046.diff [ 12370246 ]
Otis Gospodnetic added a comment - 17/May/08 04:47 AM
Good catch. I'll commit next week.

Otis Gospodnetic made changes - 17/May/08 04:47 AM
Component/s contrib/* [ 12312028 ]
Component/s contrib/spellchecker [ 12312332 ]
Lucene Fields [New] [New, Patch Available]
Assignee Otis Gospodnetic [ otis ]
Repository Revision Date User Message
ASF #659019 Thu May 22 06:34:18 UTC 2008 otis LUCENE-1046: Removed dead code in SpellChecker
Files Changed
MODIFY /lucene/java/trunk/CHANGES.txt
MODIFY /lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java

Otis Gospodnetic added a comment - 22/May/08 06:36 AM
Danke schön.

Committed revision 659019.


Otis Gospodnetic made changes - 22/May/08 06:36 AM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Lucene Fields [Patch Available, New] [New, Patch Available]
Grant Ingersoll added a comment - 24/May/08 02:46 PM
Note, this patch has the effect of changing output from the spell checker. I think the new behavior is correct, just letting people know that they will now get the original word back for this case, where they did not before.