Hi Tom

You need to define the facets in your define_index block - either by  
using existing fields or attributes:
   indexes location, :facet => true
   has age, :facet => true
Or by adding an explicit column for the facet:
   facet location

Keep in mind facets need to have unique names across facets,  
attributes and fields - so you couldn't put all three of the above  
lines together, you'd need to give the last one an alias via the :as  
option.

Once that's set up and you've stopped Sphinx, re-indexed and  
restarted, then you can use it on the model as follows:
   Model.facets
Which returns a collection accessible as a hash, with keys for each  
facet and results as the values. You can also drill down into a full  
result set:
   Model.facets.for(:location => "Melbourne")

There's also a little bit more detail in this gist:
http://gist.github.com/48328

Multi-model faceting is not supported *yet*, but it's in the pipeline.

Cheers

-- 
Pat

On 22/01/2009, at 4:27 AM, Tom Hunter wrote:

>
> Could someone give me a brief explanation of how to use the facets?
> I'm not sure quite what to put as arguments when calling the facets
> method and if anything needs go to in the define_index block?  Thanks
> in advance!
>
> - Tom Hunter
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to