Hi! On Thu, Nov 16, 2006 at 07:04:55AM +0100, Brendon Muir wrote: [..] > acts_as_ferret( > :fields => :instance_name > ) > > def instance_name > instance.name > end > > end > > Now that looks like it should work. But when I search for an item by > name (knowing that it exists), nothing shows. I know the search itself > works because becure I added the :fields condition, it would pick up and > return results for the word "folder" as it was used to define the > polymorphic associations on the instances table.
have a look in your development log when you save an instance of class ComponentInstance. There should be a line like 'adding field instance_name with value ...' showing what value aaf indexed for your instance name. Maybe the instance isn't there yet when the save takes place ? > So firstly your help with that problem would be most appreciated. Then > we make things trickier by adding the fact that I'd like the end users > on the front end to be able to search the site not just using the name > field, but basically anything in any of the instance tables. that's easy, just index all the fields you want for frontend and backend search (including the instance_name field) and use a special QueryParser restricted to only the instance_name field for your backend search: QueryParser qp = QueryParser.new(:fields => [:instance_name]) ComponentInstance.find_by_contents(qp.parse user_query) with this solution, backend users could still manually construct complex queries to search other fields, but queries not using any field names will default to only search the instance_name field. > As a laughing point, when I wrote the original application in PHP using > Mysql fulltext search, the query for the frontend search was 2 pages > long! :) dont tell me any details ;-) cheers, Jens -- webit! Gesellschaft für neue Medien mbH www.webit.de Dipl.-Wirtschaftsingenieur Jens Krämer [EMAIL PROTECTED] Schnorrstraße 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66 _______________________________________________ Ferret-talk mailing list [email protected] http://rubyforge.org/mailman/listinfo/ferret-talk

