FAQ
I read that in a lot of cases IndexWriter.optimize does not have to be called.

I then deleted it and my junit test case broke because results were coming back in the query that were not supposed to be coming back :(. I think everything is single tested. Maybe I should write a more raw junit test first? But I thought I would ask what exactly is optimize doing and is Lucene thread safe...I read that it was somewhere(but also read elsewhere it wasn't).

I kind of assumed my IndexWriters are not thread safe, but my IndexSearcher could be running while another thread is using the IndexWriter, right?

(Of course, while my unit test is single threaded and failed with just this one line change, our production system will be multithreaded which is why I ask).

Thanks,
Dean

This message and any attachments are intended only for the use of the addressee and
may contain information that is privileged and confidential. If the reader of the
message is not the intended recipient or an authorized representative of the
intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication in
error, please notify us immediately by e-mail and delete the message and any
attachments from your system.

Search Discussions

  • Ian Lea at Jun 23, 2011 at 10:05 am
    From the 3.2.0 javadocs:
    "Optimize is a fairly costly operation, so you should only do it if
    your search performance really requires it. Many search applications
    do fine never calling optimize."


    See the FAQ and javadocs on searchers and writers for thread safety info.

    One thing that optimize does do is clear out deleted documents. Could
    that be relevant to your test failure? If so, there is an
    expungeDeletes() method you could maybe use instead.


    --
    Ian.

    On Wed, Jun 22, 2011 at 8:24 PM, Hiller, Dean x66079
    wrote:
    I read that in a lot of cases IndexWriter.optimize does not have to be called.

    I then deleted it and my junit test case broke because results were coming back in the query that were not supposed to be coming back :(.  I think everything is single tested.  Maybe I should write a more raw junit test first? But I thought I would ask what exactly is optimize doing and is Lucene thread safe...I read that it was somewhere(but also read elsewhere it wasn't).

    I kind of assumed my IndexWriters are not thread safe, but my IndexSearcher could be running while another thread is using the IndexWriter, right?

    (Of course, while my unit test is single threaded and failed with just this one line change, our production system will be multithreaded which is why I ask).

    Thanks,
    Dean
    ---------------------------------------------------------------------
    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
postedJun 22, '11 at 7:25p
activeJun 23, '11 at 10:05a
posts2
users2
websitelucene.apache.org

2 users in discussion

Ian Lea: 1 post Hiller, Dean x66079: 1 post

People

Translate

site design / logo © 2022 Grokbase