Issue Details (XML | Word | Printable)

Key: LUCENE-1152
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Otis Gospodnetic
Reporter: Naveen Belkale
Votes: 0
Watchers: 1
Operations

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

SpellChecker does not work properly on calling indexDictionary after clearIndex

Created: 25/Jan/08 12:49 PM   Updated: 22/May/08 06:21 AM
Return to search
Component/s: contrib/spellchecker
Affects Version/s: 2.3
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works spellchecker.diff 2008-05-21 10:06 AM Naveen Belkale 2 kB
File Licensed for inclusion in ASF works spellchecker.diff 2008-01-25 12:52 PM Naveen Belkale 3 kB

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


 Description  « Hide
We have to call clearIndex and indexDictionary to rebuild dictionary from fresh. The call to SpellChecker clearIndex() function does not reset the searcher. Hence, when we call indexDictionary after that, many entries that are already in the stale searcher will not be indexed.

Also, I see that IndexReader reader is used for the sole purpose of obtaining the docFreq of a given term in exist() function. This functionality can also be obtained by using just the searcher by calling searcher.docFreq. Thus, can we get away completely with reader and code associated with it like
if (IndexReader.isLocked(spellIndex)){ IndexReader.unlock(spellIndex); }
and the reader related code in finalize?



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Naveen Belkale added a comment - 25/Jan/08 12:52 PM
Suggested patch.

Naveen Belkale added a comment - 25/Jan/08 01:06 PM - edited
One more small query. We have requirement where we have to add new words to our dictionary quite frequently. So multiple threads may concurrently call indexDictionary. This will cause problems as each call to indexDictionary will create a new IndexWriter. So is it possible to make indexDictionary function synchronized? Like this
public synchronized void indexDictionary(Dictionary dict) throws IOException {
........

Otis Gospodnetic added a comment - 17/May/08 04:41 AM
This patch no longer applies. Could you provide a new patch (against trunk)? Also, please use 2-spaces for indentation. Thanks.

As for synchronizing indexDictionary method, why not add synchronization logic to your application?


Naveen Belkale added a comment - 21/May/08 10:06 AM
Suggested patch against trunk

Otis Gospodnetic added a comment - 22/May/08 06:21 AM
Thank you for the patch!

Committed revision 659013.