Java

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • problem with IndexSearcher

    1 answers - 1333 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi,
    I'm currently using Lucene on a java web site; I've a class containing a
    synchronized method that runs all the update on the index, this class
    also contains a method (not synchronized) called getSearcher which
    returns an IndexSearcher object.
    I'm using the singleton pattern for this class so there can be only one
    instance.
    When I update the index I close() the IndexSearcher object in the class,
    run the update then create a new IndexSearcher.
    This is my problem:
    I add a document to the index and search for I can find it.
    If I remove the document and search for it again it doesn't find
    anything (correct behaviour).
    If I add again the same document to the index I can't find it until I
    restart the application server (I should be able to find it).
    I've noticed that if I create a new IndexSearcher every time they call
    the method getSearcher instead of returning the one already instanced it
    works fine, that's strange because I create a new IndexSearcher every
    time I run the synchronized update method.
    Any suggestion?
    Regards,
    Stefano
    To unsubscribe, e-mail: java-user-unsubscribe (AT) lucene (DOT) apache.org
    For additional commands, e-mail: java-user-help (AT) lucene (DOT) apache.org
  • No.1 | | 1791 bytes | |

    It appears you have answered your own question. The problem seems to be in your code.
    Without seeing it though, how can we help?

    Tony Schwartz
    tony (AT) simpleobjects (DOT) com
    "What we need is more cowbell."

    Hi,
    I'm currently using Lucene on a java web site; I've a class containing a
    synchronized method that runs all the update on the index, this class
    also contains a method (not synchronized) called getSearcher which
    returns an IndexSearcher object.

    I'm using the singleton pattern for this class so there can be only one
    instance.
    When I update the index I close() the IndexSearcher object in the class,
    run the update then create a new IndexSearcher.

    This is my problem:
    I add a document to the index and search for I can find it.
    If I remove the document and search for it again it doesn't find
    anything (correct behaviour).
    If I add again the same document to the index I can't find it until I
    restart the application server (I should be able to find it).

    I've noticed that if I create a new IndexSearcher every time they call
    the method getSearcher instead of returning the one already instanced it
    works fine, that's strange because I create a new IndexSearcher every
    time I run the synchronized update method.
    Any suggestion?

    Regards,
    Stefano
    >
    >
    >
    >


    To unsubscribe, e-mail: java-user-unsubscribe (AT) lucene (DOT) apache.org
    For additional commands, e-mail: java-user-help (AT) lucene (DOT) apache.org
    --

    To unsubscribe, e-mail: java-user-unsubscribe (AT) lucene (DOT) apache.org
    For additional commands, e-mail: java-user-help (AT) lucene (DOT) apache.org

Re: problem with IndexSearcher


max 4000 letters.
Your nickname that display:
In order to stop the spam: 6 + 5 =
QUESTION ON "Java"

EMSDN.COM