FAQ
Hi,

I'm using SpellChecker (in Lucene contrib) to help users of SVNSearch
who can't type right:

http://svnsearch.org/svnsearch/repos/ASF/search?logMessage=lusene

SpellChecker works very well for my purpose, but I've encountered a
possible file resource leak issue:

I can't find any way to close the IndexSearcher (and IndexReader) that
is being used by SpellChecker internally.

I've worked around this issue by keeping a single SpellChecker open
for each repository, but I'd really like to be able to close it and
reopen it on demand without leaking file descriptors.

Could we add a close() method to SpellChecker that will close the
IndexSearcher and null the reference to it? And perhaps add some code
that reopens the searcher if the reference to it is null? Or would
that break thread safety of SpellChecker?

The attached patch adds a close method but leaves it to the user to
call setSpellIndex to reopen the searcher.

Thanks,
Eirik.

Search Discussions

  • Michael McCandless at Dec 3, 2009 at 1:16 pm
    This sounds like an important bug fix -- could you open a Jira issue &
    attach a patch? Thanks!

    Mike

    2009/12/2 Eirik Bjørsnøs <eirbjo@gmail.com>:
    Hi,

    I'm using SpellChecker (in Lucene contrib) to help users of SVNSearch
    who can't type right:

    http://svnsearch.org/svnsearch/repos/ASF/search?logMessage=lusene

    SpellChecker works very well for my purpose, but I've encountered a
    possible file resource leak issue:

    I can't find any way to close the IndexSearcher (and IndexReader) that
    is being used by SpellChecker internally.

    I've worked around this issue by keeping a single SpellChecker open
    for each repository, but I'd really like to be able to close it and
    reopen it on demand without leaking file descriptors.

    Could we add a close() method to SpellChecker that will close the
    IndexSearcher and null the reference to it? And perhaps add some code
    that reopens the searcher if the reference to it is null? Or would
    that break thread safety of SpellChecker?

    The attached patch adds a close method but leaves it to the user to
    call setSpellIndex to reopen the searcher.

    Thanks,
    Eirik.



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Eirik Bjørsnøs at Dec 3, 2009 at 8:20 pm

    On Thu, Dec 3, 2009 at 2:15 PM, Michael McCandless wrote:
    This sounds like an important bug fix -- could you open a Jira issue &
    attach a patch?  Thanks!
    Mike,

    I've opened an issue with a patch that should be pretty trivial:

    https://issues.apache.org/jira/browse/LUCENE-2108

    Looking forward to seeing it in 3.0.x :-)

    PS: Upgrading SVNSearch to 3.0.0 was close to painless thanks to
    Lucene's well thought out upgrade and deprecation policy. I really
    like the way I could gradually replace deprecated API calls and then
    make the final switch from 2.9.1 to 3.0.0. More projects should follow
    this path. Keep up the good work!

    Eirik.
    2009/12/2 Eirik Bjørsnøs <eirbjo@gmail.com>:
    Hi,

    I'm using SpellChecker (in Lucene contrib) to help users of SVNSearch
    who can't type right:

    http://svnsearch.org/svnsearch/repos/ASF/search?logMessage=lusene

    SpellChecker works very well for my purpose, but I've encountered a
    possible file resource leak issue:

    I can't find any way to close the IndexSearcher (and IndexReader) that
    is being used by SpellChecker internally.

    I've worked around this issue by keeping a single SpellChecker open
    for each repository, but I'd really like to be able to close it and
    reopen it on demand without leaking file descriptors.

    Could we add a close() method to SpellChecker that will close the
    IndexSearcher and null the reference to it? And perhaps add some code
    that reopens the searcher if the reference to it is null? Or would
    that break thread safety of SpellChecker?

    The attached patch adds a close method but leaves it to the user to
    call setSpellIndex to reopen the searcher.

    Thanks,
    Eirik.



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Michael McCandless at Dec 3, 2009 at 8:33 pm
    Thanks! I'm glad to hear your upgrade to 3.0.0 was smooth.

    Mike

    2009/12/3 Eirik Bjørsnøs <eirbjo@gmail.com>:
    On Thu, Dec 3, 2009 at 2:15 PM, Michael McCandless
    wrote:
    This sounds like an important bug fix -- could you open a Jira issue &
    attach a patch?  Thanks!
    Mike,

    I've opened an issue with a patch that should be pretty trivial:

    https://issues.apache.org/jira/browse/LUCENE-2108

    Looking forward to seeing it in 3.0.x :-)

    PS: Upgrading SVNSearch to 3.0.0 was close to painless thanks to
    Lucene's well thought out upgrade and deprecation policy. I really
    like the way I could gradually replace deprecated API calls and then
    make the final switch from 2.9.1 to 3.0.0. More projects should follow
    this path. Keep up the good work!

    Eirik.
    2009/12/2 Eirik Bjørsnøs <eirbjo@gmail.com>:
    Hi,

    I'm using SpellChecker (in Lucene contrib) to help users of SVNSearch
    who can't type right:

    http://svnsearch.org/svnsearch/repos/ASF/search?logMessage=lusene

    SpellChecker works very well for my purpose, but I've encountered a
    possible file resource leak issue:

    I can't find any way to close the IndexSearcher (and IndexReader) that
    is being used by SpellChecker internally.

    I've worked around this issue by keeping a single SpellChecker open
    for each repository, but I'd really like to be able to close it and
    reopen it on demand without leaking file descriptors.

    Could we add a close() method to SpellChecker that will close the
    IndexSearcher and null the reference to it? And perhaps add some code
    that reopens the searcher if the reference to it is null? Or would
    that break thread safety of SpellChecker?

    The attached patch adds a close method but leaves it to the user to
    call setSpellIndex to reopen the searcher.

    Thanks,
    Eirik.



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedDec 2, '09 at 5:44p
activeDec 3, '09 at 8:33p
posts4
users2
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase