problem with IndexSearcher

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with IndexSearcher

Stefano Buliani-2
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: problem with IndexSearcher

Tony Schwartz
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
[hidden email]
"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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]