If I am indexing ModelA and ModelB and I want to search both of them,
I usually just pick one arbitrarily and use it for #multi_search.
Is there a slicker pattern, regarding from which model to invoke #multi_search? Can it be invoked directly from the Ferret library?
Has anyone put together some sort of “dummy” search class?
If I am indexing ModelA and ModelB and I want to search both of them,
I usually just pick one arbitrarily and use it for #multi_search.
Is there a slicker pattern, regarding from which model to invoke #multi_search? Can it be invoked directly from the Ferret library?
Has anyone put together some sort of “dummy” search class?
acts_as_ferret is storing one index per model. That is why you need
the multi_search method. However, Ferret does not need to store
separate indexes per model. acts_as_ferret is using a so-called
MultiSearcher, see
to access several indexes at once to search them all. So yes, you
can use Ferrets own MultiSearcher to access all indexes you need
at once. However, acts_as_ferret may change the way the index is
stored in the future, so if you mix acts_as_ferret and ‘standard’ ferret
API calls, you might have a problem with future versions of AAF.
So if you don’t have a specific reason to use your own MultiSearcher,
you shouldn’t do it What do you want to achieve?
stored in the future, so if you mix acts_as_ferret and ‘standard’
ferret
API calls, you might have a problem with future versions of AAF.
Thanks Benjamin for your response.
So if you don’t have a specific reason to use your own MultiSearcher,
you shouldn’t do it What do you want to achieve?
If I am using ferret/AAF to index Car, Boat, and Train, and I want to
perform a search on all those objects and get mixed results from all
of them simultaneously, the only way I know of to achieve this is to
pick one of the models – say, Car – and invoke Car.multi_search,
with appropriate flags to specify searching all models. This works
fine but is a bit sloppy since the method could have been called on
any of the models. I was wondering if there is an official or
unofficial way to avoid this.
On Dec 27, 2007, at 9:15 PM, John Joseph B. wrote:
So if you don’t have a specific reason to use your own MultiSearcher,
you shouldn’t do it What do you want to achieve?
the only way I know of to achieve this is to pick one of the models
– say, Car – and invoke Car.multi_search, with appropriate flags
to specify searching all models. This works fine but is a bit sloppy
since the method could have been called on any of the models. I was
wondering if there is an official or unofficial way to avoid this.
To be clear-- I would like to do this via the AAF API if possible,
instead of directly via Ferret::Search::MultiSearcher.
Jon
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.