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 made changes - 25/Jan/08 12:52 PM
Field Original Value New Value
Attachment spellchecker.diff [ 12374030 ]
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 {
........

Naveen Belkale made changes - 25/Jan/08 02:11 PM
Priority Major [ 3 ] Minor [ 4 ]
Lucene Fields [Patch Available, New] [New, Patch Available]
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?


Otis Gospodnetic made changes - 17/May/08 04:41 AM
Component/s contrib/* [ 12312028 ]
Assignee Otis Gospodnetic [ otis ]
Component/s contrib/spellchecker [ 12312332 ]
Naveen Belkale added a comment - 21/May/08 10:06 AM
Suggested patch against trunk

Naveen Belkale made changes - 21/May/08 10:06 AM
Attachment spellchecker.diff [ 12382449 ]
Repository Revision Date User Message
ASF #659013 Thu May 22 06:21:17 UTC 2008 otis LUCENE-1152 Fix for calling indexDictionary after clearIndex call
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:21 AM
Thank you for the patch!

Committed revision 659013.


Otis Gospodnetic made changes - 22/May/08 06:21 AM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]