Hi!

Hope you are all doing well! We are using searcherManager (
https://lucene.apache.org/core/7_4_0/core/org/apache/lucene/search/SearcherManager.html)
and get a little confused on applyAllDeletes parameter in the constructor
and the method maybeRefresh(). In our case, we need to search over
refreshed docs before we call writer.Commit(). So we are thinking of
constructing the SearcherManager with applyAllDeletes true. However, we
find there is another method ReferenceManager.maybeRefresh()
<https://lucene.apache.org/core/7_4_0/core/org/apache/lucene/search/ReferenceManager.html#maybeRefresh-->
where
we refresh instances.

My question is if we periodically call maybeRefresh(), and make sure the
manager is refreshed every time before we acquire a new searcher, do we
still need to set applyAllDeletes to true when constructing the manager?

For example, I wrote a simple test like:

> val manager = new SearcherManager(writer, false /*applyAllDeletes*/,
> false, null)
> writer.deleteDocuments(term) // delete some docs
>
> manager.maybeRefresh()
> val searcher = manager.acquire()

val hits = searcher.search(...)

hits.totalHits shouldBe 0

and the test would pass (deletes are applied)


Sincerely,
Ningshan

Reply via email to