Jens Kraemer wrote:
> Hi!
>
> On Thu, Nov 16, 2006 at 07:04:55AM +0100, Brendon Muir wrote:
> [..]
>> 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 ?
>
I already had a few records in the database so I assumed when i added
the ferrit aa that it would index those. I will try adding a new record
and see what it says when i get back to work on Monday. :)
>> 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.
>
Excellent! Sounds like a good solution. Will this mean I will have to do
a while bunch of these type of accessor's in my model. One for each
field in my seperate polymorphic instances?
def instance_linkurl
instance.linkurl
end
etc...
Will that break when ferret trys to trawl a polymorphic model that
doesn't have a linkurl attribute?
>> 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?e Medien mbH www.webit.de
> Dipl.-Wirtschaftsingenieur Jens Krä¥r [EMAIL PROTECTED]
> Schnorrstraߥ 76 Tel +49 351 46766 0
> D-01069 Dresden Fax +49 351 46766 66
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk