Hi Matt

What's your define_index block looking like? I'll double-check the  
tests against 0.9.9.

-- 
Pat

On 24/01/2009, at 2:47 PM, Matt Murphy wrote:

> Pat,
>
> Do you know if facets work in the sphinx-0.9.9 branch?  I'm getting  
> an exception when I call Model.facets.  I've just added :facet =>  
> true to a few of the columns in the index definition.  Are there any  
> column types that can't be treated as a facet?
>
> Error below:
>
> >> Model.facets
> NoMethodError: You have a nil object when you didn't expect it!
> The error occurred while evaluating nil.columns
>     from /path/to/project/vendor/plugins/thinking-sphinx/lib/ 
> thinking_sphinx/attribute.rb:230:in `type_from_database'
>     from /path/to/project/vendor/plugins/thinking-sphinx/lib/ 
> thinking_sphinx/attribute.rb:236:in `translated_type_from_database'
>     from /path/to/project/vendor/plugins/thinking-sphinx/lib/ 
> thinking_sphinx/attribute.rb:148:in `type'
>     from /path/to/project/vendor/plugins/thinking-sphinx/lib/ 
> thinking_sphinx/facet.rb:29:in `value'
>     from /path/to/project/vendor/plugins/thinking-sphinx/lib/ 
> thinking_sphinx/facet_collection.rb:17:in `add_from_results'
>     from /path/to/project/vendor/plugins/thinking-sphinx/lib/ 
> thinking_sphinx/collection.rb:118:in `each_with_groupby_and_count'
>
>
>
>
> On Wed, Jan 21, 2009 at 6:50 PM, Pat Allan <p...@freelancing- 
> gods.com> wrote:
>
> 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