On 24.11.2006, at 12:07, Agnieszka Figiel wrote: > I'm a novice to ferret, so far only used it via acts_as_ferret. My > question is about a recommended pattern for an 'advanced search', > which > would be searching by all fields of a model and some fields from > related > models, with range search, expression search and wildcards. The > kind of > search in which a user is presented with a huge form that allows > them to > set the variuos criteria. > > is this something ferret (acts_as_ferret?) is suited for and is > there a > clean way to do it?
When I last checked, you could use Ferret's advanced query syntax in acts_as_ferret. So you can use wildcards, ranges, phrases, boolean expressions and field qualifiers just as if you used Ferret directly. If you haven't used Ferret's query language before, check out the RDoc documentation for Ferret::QueryParser. It's pretty well explained there. The 'pattern' for implementing an advanced search form would be to gather the information from the form an build a query string from that. As for indexing/searching fields from related models: This has been extensively discussed on this list recently, so you might want to consult the archives. In short, you provide an accessor method for the field in the related model and index that. Cheers, Andy _______________________________________________ Ferret-talk mailing list [email protected] http://rubyforge.org/mailman/listinfo/ferret-talk

