Aaf and dynamic attrs: a bug?

Hi!

I faced some issue while using it for dynamic attrs indexing/search.
Maybe I made something wrong. Here is test method. Everything works just
fine until last line http://pastie.caboo.se/66274 . Tested on both
stable and trunk of aaf and ferret 0.11.4.

the short version of code below:

Contact.acts_as_ferret :fields => [ :first_name ]
assert Contact.find(:first).respond_to?(:first_name_to_ferret)

assert_equal 1, Contact.find_by_contents(‘Y*’).total_hits
assert_equal 1, Contact.find_by_contents(‘first_name:Y*’).total_hits

Contact.aaf_index.close
FileUtils.rm_rf ‘index’

Contact.acts_as_ferret :fields => [ :first_name, :last_name ]
assert Contact.find(:first).respond_to?(:last_name_to_ferret)

assert_equal 1, Contact.find_by_contents(‘Y*’).total_hits
assert_equal 1, Contact.find_by_contents(‘first_name:Y*’).total_hits

assert_equal 1, Contact.find_by_contents(‘last_name:K*’).total_hits
assert_equal 1, Contact.find_by_contents(‘K*’).total_hits # assertion
fails here: get 0 instead of 1 !!

Maybe there is any better solution to add new fields to existing index?

Best regards,
Yury K.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs