From 30f4f85d488696e1b2835d15080d0f2f7a5913b0 Mon Sep 17 00:00:00 2001 From: Paul Masurel Date: Fri, 14 Sep 2018 09:11:07 +0900 Subject: [PATCH] Closes #414. (#417) Updating documentation for load_searchers. --- src/core/index.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/core/index.rs b/src/core/index.rs index da1744961..a7bef841d 100644 --- a/src/core/index.rs +++ b/src/core/index.rs @@ -273,12 +273,16 @@ impl Index { self.num_searchers.store(num_searchers, Ordering::Release); } - /// Creates a new generation of searchers after - - /// a change of the set of searchable indexes. + /// Update searchers so that they reflect the state of the last + /// `.commit()`. /// - /// This needs to be called when a new segment has been - /// published or after a merge. + /// If indexing happens in the same process as searching, + /// you most likely want to call `.load_searchers()` right after each + /// successful call to `.commit()`. + /// + /// If indexing and searching happen in different processes, the way to + /// get the freshest `index` at all time, is to watch `meta.json` and + /// call `load_searchers` whenever a changes happen. pub fn load_searchers(&self) -> Result<()> { let _meta_lock = LockType::MetaLock.acquire_lock(self.directory())?; let searchable_segments = self.searchable_segments()?;