Quantcast

Searchable plugin collection filtering

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Searchable plugin collection filtering

dstarh
Does anyone know if you can get the searchable plugin to filter based on collections

Lets say Person has many cars.

I want to do a full text search on people who have a particular car but I cant seem to get the syntax correct in the search for it to work

Can anyone give me some pointers here?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Searchable plugin collection filtering

John Stoneham
On Wed, May 19, 2010 at 10:44 AM, David Herman <[hidden email]> wrote:
> Does anyone know if you can get the searchable plugin to filter based on
> collections
> Lets say Person has many cars.
> I want to do a full text search on people who have a particular car but I
> cant seem to get the syntax correct in the search for it to work
> Can anyone give me some pointers here?

Well, how are you planning on matching the Car with your search?

You have a couple of options. One is making the Car a searchable
component so that its searchable fields are brought up into the Person
object as if they were Person fields. Downside is that multiple Cars'
properties are brought in as multivalued fields, so if you had a
Car(make: 'Mini', model: 'Cooper') and a Car(make: 'Ford', model:
'Focus'), you'd match the Person if you searched for make:Mini AND
model:Focus.

The other is to define a transient property on your searchable domain
class, then have Searchable index that. This is a versatile strategy
that allows you to match using Compass/Lucene in a lot of creative
ways (in fact it's basically how Compass works anyway). For example,
add the property 'carMakeModel' as a transient property of your Person
class, and define def getCarMakeModel() { "${car.make}_${car.model}" }
etc. I'm not quite sure how to make this work as a collection yet, it
might be as simple as returning a List but I'm not sure.

--
John Stoneham
[hidden email]

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Searchable plugin collection filtering

Konstantyn Smirnov
In reply to this post by dstarh
if you want to use proper Lucene's filtering, you need to call Lucene API through the Compas' hook, which is considered to be *low-level* :)
AFAIK, it works as a callback, alot like withSession{}
Loading...