Forum: Ferret indexed 'text' (not string) column not used when searching,

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.
Cdff2cc7b20bc42b9e43520091c576df?d=identicon&s=25 Alain Ravet (Guest)
on 2007-06-15 15:06
(Received via mailing list)
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
Cdff2cc7b20bc42b9e43520091c576df?d=identicon&s=25 Alain Ravet (Guest)
on 2007-06-15 16:31
(Received via mailing list)
... 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
C9dd93aa135988cabf9183d3210665ca?d=identicon&s=25 Jens Kraemer (Guest)
on 2007-06-20 11:54
(Received via mailing list)
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:
>
> Ferret-talk@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@webit.de | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
This topic is locked and can not be replied to.