# Safe to read index while it is being written to?

**URL:** <https://www.ruby-forum.com/t/safe-to-read-index-while-it-is-being-written-to/74257>\
**Category:** Ferret\
**Created:** [November 3, 2006, 12:47am UTC](https://www.ruby-forum.com/t/safe-to-read-index-while-it-is-being-written-to/74257 "2006-11-03T00:47:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Yelp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ac91a4/32.png) [@Dan\_Yelp](https://www.ruby-forum.com/u/Dan_Yelp)\
**Post date:** [November 3, 2006, 12:47am UTC](https://www.ruby-forum.com/t/safe-to-read-index-while-it-is-being-written-to/74257/1 "2006-11-03T00:47:21Z")

</div>

Is it safe to open the index to do searches on while another process is  
writing to the index?

---

<div class="post-metadata">

**Author:** ![Dan\_Yelp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ac91a4/32.png) [@Dan\_Yelp](https://www.ruby-forum.com/u/Dan_Yelp)\
**Post date:** [November 3, 2006, 9:17pm UTC](https://www.ruby-forum.com/t/safe-to-read-index-while-it-is-being-written-to/74257/2 "2006-11-03T21:17:51Z")

</div>

Dan Yelp wrote:

> Is it safe to open the index to do searches on while another process is  
> writing to the index?

I don’t know the technical details, but I have experienced some problems  
when trying to do this. I have an index of about 275K short documents,  
and in an ideal world I’d be updating it continuously. Right now I wait  
until the off-hours because if I’m updating the index at all, searches  
tend to cause my mongrel procs to either hang (100% CPU util), or  
segfault (documented in a ticket on the ferret track). I have processes  
in place to correct these problems when they occur, but it’s still  
discouraging because I can’t keep the data as fresh as I’d like it to  
be.

Jim

---

<div class="post-metadata">

**Author:** ![Dan\_Yelp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ac91a4/32.png) [@Dan\_Yelp](https://www.ruby-forum.com/u/Dan_Yelp)\
**Post date:** [November 7, 2006, 10:57am UTC](https://www.ruby-forum.com/t/safe-to-read-index-while-it-is-being-written-to/74257/3 "2006-11-07T10:57:09Z")

</div>

On Nov 2, 2006, at 6:47 PM, Dan Yelp wrote:

> Is it safe to open the index to do searches on while another  
> process is  
> writing to the index?

Yes. The caveat is that an IndexReader or IndexSearcher only sees  
what was indexed at the time the index was opened, and will not see  
documents written since. Seeing changes requires re-opening. See  
Solr discussions on auto-warming if you need faster searches out of  
the gate.

```
Erik
```

---

<div class="post-metadata">

**Author:** ![Dan\_Yelp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ac91a4/32.png) [@Dan\_Yelp](https://www.ruby-forum.com/u/Dan_Yelp)\
**Post date:** [November 7, 2006, 10:58am UTC](https://www.ruby-forum.com/t/safe-to-read-index-while-it-is-being-written-to/74257/4 "2006-11-07T10:58:02Z")

</div>

oops… i replied as if this was the java-user list, not the Ferret  
one. sorry for mixing up my languages. ai ya!
