Forum: Ferret Possible Bug when Creating Indexes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5f400e38a8ed574db5f5afa60f373470?d=identicon&s=25 Hh Hh (henry74)
on 2007-01-01 22:47
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?
C9dd93aa135988cabf9183d3210665ca?d=identicon&s=25 Jens Kraemer (Guest)
on 2007-01-08 09:40
(Received via mailing list)
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       kraemer@webit.de
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66
Bf2b5bfd50445978f8ecfdecc8ab3e0d?d=identicon&s=25 William Morgan (Guest)
on 2007-01-08 21:29
(Received via mailing list)
Excerpts from Jens Kraemer'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.
This topic is locked and can not be replied to.