rclabo commented on issue #720:
URL: https://github.com/apache/lucenenet/issues/720#issuecomment-1293462652

   @zhangbaodan 
   
   >Create an IndexReader from the IndexWriter during each search. This ensures 
that the IndexReader can see the new data in the IndexWriter and the data on 
the disk. Here is the corresponding code
   
   You don't need to recreate `IndexReader` from the `IndexWriter` during each 
search.  Use the same `IndexReader`  over and over that you initially obtained 
from `IndexWrite.GetReader()` and then call `searcherManager.MaybeRefresh()` 
before each search is performed. That's all that's needed to ensure the 
`IndexReader` can see the new data that the `IndexWriter` has written.  
   
   `searcherManager.MaybeRefresh()`  is about "Visibility" and commit is about 
"Durability".  So when you call `searcherManager.MaybeRefresh()` the 
`IndexReader` will see the data even if you haven't called commit yet.   
`searcherManager.MaybeRefresh()`  causes you to see the data, commit causes the 
data to be written to disk and committed to the index. They each work totally 
independently of each other.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to