# Trying to open a Lucene-built index with Ferret

**URL:** <https://www.ruby-forum.com/t/trying-to-open-a-lucene-built-index-with-ferret/152347>\
**Category:** Ruby\
**Created:** [November 2, 2008, 11:04pm UTC](https://www.ruby-forum.com/t/trying-to-open-a-lucene-built-index-with-ferret/152347 "2008-11-02T23:04:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnpetterson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/41988e/32.png) [@johnpetterson](https://www.ruby-forum.com/u/johnpetterson)\
**Post date:** [November 2, 2008, 11:04pm UTC](https://www.ruby-forum.com/t/trying-to-open-a-lucene-built-index-with-ferret/152347/1 "2008-11-02T23:04:41Z")

</div>

But its wipes out the existing index and creates a new empty one - the  
pages for Ferret are currently unavailable - just wondering anybody else  
has come across this? Is the ‘create=\>false’ just not working or do I  
have it wrong here ? ( I have also tried : create=\>‘false’ - still the  
same thing).

Cheers

John

How do I get the version of Ferret I’m using by the way - I would have  
posted that here if I knew how !

– Search.rb –  
require ‘rubygems’  
require ‘ferret’

index=Ferret::I.new(:path =\> ‘index’, :create=\>false);  
index.search\_each(‘thane’) do |doc,score|  
puts doc, score  
end  
index.close  
– end

---

<div class="post-metadata">

**Author:** ![johnpetterson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/41988e/32.png) [@johnpetterson](https://www.ruby-forum.com/u/johnpetterson)\
**Post date:** [November 2, 2008, 11:22pm UTC](https://www.ruby-forum.com/t/trying-to-open-a-lucene-built-index-with-ferret/152347/2 "2008-11-02T23:22:12Z")

</div>

As far as i know, Ferret-built indexes are not binary-compatible with  
Lucene anymore.

To find out the version, open a console and type:

gem list ferret

the highest version behind the ferret gem is the one in use.

Regards,  
Florian G.

---

<div class="post-metadata">

**Author:** ![johnpetterson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/41988e/32.png) [@johnpetterson](https://www.ruby-forum.com/u/johnpetterson)\
**Post date:** [November 2, 2008, 11:46pm UTC](https://www.ruby-forum.com/t/trying-to-open-a-lucene-built-index-with-ferret/152347/3 "2008-11-02T23:46:46Z")

</div>

Thanks Florian, that would be shame if we’ve lost that binary  
compatibility ah well…

The version is:

\*\*\* LOCAL GEMS \*\*\*

ferret (0.11.6, 0.11.4)

And ignoring the Lucene/Ferret thing for the moment - the ‘search.rb’  
program above seems to write over the index directory in any case (if I  
run it twice , I get new mod times on the ‘segments’ files at least).

Cheers

John

---

<div class="post-metadata">

**Author:** ![johnpetterson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/41988e/32.png) [@johnpetterson](https://www.ruby-forum.com/u/johnpetterson)\
**Post date:** [November 3, 2008, 12:59am UTC](https://www.ruby-forum.com/t/trying-to-open-a-lucene-built-index-with-ferret/152347/4 "2008-11-03T00:59:20Z")

</div>

I don’t remember the reasoning behind it, but as far as i know, this  
happend quite a while ago.

If you search [http://www.ruby-forum.com/forum/5](http://www.ruby-forum.com/forum/5) for it, you might get  
more.

I think the ability to use Lucene directly from JRuby already makes  
the ability to manipulate it  
with ferret a cornercase most people will ignore.

Regards,  
Florian G.

---

<div class="post-metadata">

**Author:** ![johnpetterson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/41988e/32.png) [@johnpetterson](https://www.ruby-forum.com/u/johnpetterson)\
**Post date:** [November 3, 2008, 1:25pm UTC](https://www.ruby-forum.com/t/trying-to-open-a-lucene-built-index-with-ferret/152347/5 "2008-11-03T13:25:49Z")

</div>

On Mon, 3 Nov 2008, John Pritchard-williams wrote:

> And ignoring the Lucene/Ferret thing for the moment - the ‘search.rb’  
> program above seems to write over the index directory in any case (if I  
> run it twice , I get new mod times on the ‘segments’ files at least).

I have not explicitly checked for this behaviour with the ff.rb  
I modified (without touching that bit), but certainly the index is not  
rebuilt, that would take ages.  
[http://www.eng.cse.dmu.ac.uk/~hgs/ruby/ff.rb](http://www.eng.cse.dmu.ac.uk/~hgs/ruby/ff.rb)  
[http://www.eng.cse.dmu.ac.uk/~hgs/ruby/ferret\_helper.rb](http://www.eng.cse.dmu.ac.uk/~hgs/ruby/ferret_helper.rb)  
See  
[http://www.eng.cse.dmu.ac.uk/~hgs/ruby/#ff.rb](http://www.eng.cse.dmu.ac.uk/~hgs/ruby/#ff.rb)  
for a bit of blurb about what I did.  
You might like to experiment with that to see if its behaviour is  
useful.

[For those reading the archive: that machine is doomed to die, and the  
URL will change. I’d like to keep this stuff on the web somewhere, but  
I’m not sure how that will work out]

```
    Hugh

```
