Alain Ravet
2007-Jun-15 13:05 UTC
[Ferret-talk] indexed ''text'' (not string) column not used when searching, unless explicitely specified!!
Hi all, I''ve included a mysql ''text'' column in my index, and aaf/Ferret doesn''t use it when I search, UNLESS I specify it as a restrictor, and then it only searches in that field! For example: => 0 results are returned by a standard (__all__ fields ?) search >> Entity.find_by_contents "zixi" Query: zixi total hits: 0, results delivered: 0 BUT if I search __only__ in 1 field, I find something >> Entity.find_by_contents "extra:zixi" Entity Load (0.001286) SELECT * FROM entities WHERE (entities.id in (''1723'')) AND ( (entities.`type` = ''Person'' ) ) Query: extra:zixi total hits: 1, results delivered: 1 => #<ActsAsFerret::SearchResults:0x24cd8b0 @total_hits=1, How is that possible? For info, here is my table schema : create_table "entities", :force => true do |t| t.string "type" t.text "extra" t.datetime "created_at" .... and my aaf setting : file: Entity.rb acts_as_ferret :remote => true, :fields => { :name => {:store => :yes, :boost => 1000}, :last_name => {:store => :yes, :boost => 100}, :tags_names => {:store => :yes, :boost => 30 } , :first_name => {:store => :yes, :boost => 10 }, :type => {:store => :yes}, :extra => {:store => :yes}, :slaves_list => {:store => :yes, :boost => 10 }, :masters_list => {:store => :yes, :boost => 10 }, :function => {:store => :yes}, :name_for_sort=> {:index => :untokenized} } TIA Alain
Alain Ravet
2007-Jun-15 14:30 UTC
[Ferret-talk] indexed ''text'' (not string) column not used when searching, unless explicitely specified!!
... additionally, I noticed that prefixing the query term with *: ''solves'' the problem. So, Person.find_by_contents "zixi" -> NO RESULT : WRONG but Person.find_by_contents "*:zixi" -> 1 RESULT : CORRECT Person.find_by_contents "extra:zixi" -> 1 RESULT : CORRECT This hack would get trickier to implement on queries like : (a OR B) c name:d so I''d rather do it the right way. Why does this happen : bug, or feature? Alain
Jens Kraemer
2007-Jun-20 09:53 UTC
[Ferret-talk] indexed ''text'' (not string) column not used when searching, unless explicitely specified!!
Hi Alain, could you please look in your application''s log for a line reading ''default field list: ...'' and see what''s in there? cheers, Jens On Fri, Jun 15, 2007 at 04:30:19PM +0200, Alain Ravet wrote:> ... additionally, I noticed that prefixing the query term with *: > ''solves'' the problem. > > So, > Person.find_by_contents "zixi" -> NO RESULT : WRONG > > but > Person.find_by_contents "*:zixi" -> 1 RESULT : CORRECT > Person.find_by_contents "extra:zixi" -> 1 RESULT : CORRECT > > > This hack would get trickier to implement on queries like : > (a OR B) c name:d > so I''d rather do it the right way. > > Why does this happen : bug, or feature? > > > Alain > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk >-- Jens Kr?mer webit! Gesellschaft f?r neue Medien mbH Schnorrstra?e 76 | 01069 Dresden Telefon +49 351 46766-0 | Telefax +49 351 46766-66 kraemer at webit.de | www.webit.de Amtsgericht Dresden | HRB 15422 GF Sven Haubold, Hagen Malessa