Possible Bug when Creating Indexes


#1

I’m running:

ferret (0.10.9)
ruby 1.8.5 (2006-08-25) [i386-mswin32]

on Windows XP(SP2)

When I create an index as follows:

field_infos = FieldInfos.new(:store => :yes, :term_vector => :no, :index
=> :yes)
field_infos.add_field(:id, :index => :untokenized)
field_infos.add_field(:subject)
field_infos.add_field(:author)
field_infos.add_field(:tags, :store => :no)
index = field_infos.create_index(THREAD_INDEX_DIR)

then try to add to the index as follows:

index << {:id => 1, :subject => “test subject”, :author => “test
author”, :tags => “tags, like, this”}

I get the following error:
build_ferret_index.rb:39:in `<<’: wrong argument type Hash (expected
Data) (TypeError)


When I create the index as follows:

field_infos = FieldInfos.new(:store => :yes, :term_vector => :no, :index
=> :yes)
field_infos.add_field(:id, :index => :untokenized)
field_infos.add_field(:subject)
field_infos.add_field(:author)
field_infos.add_field(:tags, :store => :no)
index = Index::Index.new(:path => THREAD_INDEX_DIR, :field_infos =>
field_infos, :analyzer => Analyzer::WhiteSpaceAnalyzer.new)

and run:

index << {:id => 1, :subject => “test subject”, :author => “test
author”, :tags => “tags, like, this”}

Everything seems to work fine…

Thoughts?


#2

On Mon, Jan 01, 2007 at 10:47:31PM +0100, Hh Hh wrote:

=> :yes)
field_infos.add_field(:id, :index => :untokenized)
field_infos.add_field(:subject)
field_infos.add_field(:author)
field_infos.add_field(:tags, :store => :no)
index = field_infos.create_index(THREAD_INDEX_DIR)

create_index does not return a created index instance, but self.
use
index = Ferret::I.new :path => THREAD_INDEX_DIR
after the create_index statement.

cheers,
Jens


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer removed_email_address@domain.invalid
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66


#3

Excerpts from Jens K.'s message of Mon Jan 08 00:41:54 -0800 2007:

create_index does not return a created index instance, but self.

Maybe it should.