http://pastie.org/991197
Here is the error when I change the Article model's define_index to..
define_index do
indexes user.username, :as => :author
indexes subject, :as => :subject
indexes content, :as => :content
indexes article_category.category_name, :as
=> category, :facet => true
indexes city, :as => city, :facet => true
has created_at, updated_at
has article_category_id, :as => :article_category_id
has user(:id), :as => :author
has 'RADIANS(lat)', :as => :lat, :type => :float
has 'RADIANS(lng)',:as => :lng, :type => :float
set_property :latitude_attr => "lat"
set_property :longitude_attr => "lng"
end
On Jun 2, 11:08 pm, Pat Allan <[email protected]> wrote:
> Yes, you can have facets of the same name in different models. You can also
> explicitly request all facets - just pass in :all_facets => true in the facet
> search call.
>
> That said, if you want facets from multiple models to be treated as a single
> facet, then they must have the same name. If you can get details of that
> error to the list, that'd be fantastic.
>
> Cheers
>
> --
> Pat
>
> On 03/06/2010, at 8:58 AM, badnaam wrote:
>
> > I have two models merchant and article with define_index (condensed
> > version) as follows
>
> > define_index do
> > indexes user.username, :as => :author
> > indexes subject, :as => :subject
> > indexes content, :as => :content
> > indexes article_category.category_name, :as
> > => :article_category, :facet => true
> > indexes city, :as => :article_city, :facet => true
>
> > has created_at, updated_at
> > has article_category_id, :as => :article_category_id
>
> > has user(:id), :as => :author
>
> > has 'RADIANS(lat)', :as => :lat, :type => :float
> > has 'RADIANS(lng)',:as => :lng, :type => :float
> > set_property :latitude_attr => "lat"
> > set_property :longitude_attr => "lng"
> > end
>
> > define_index do
> > indexes :name, :sortable => true
> > indexes merchant_category.category_name, :as
> > => :category, :facet => true
> > indexes :description, :as => :description
> > indexes :city, :as => :city, :facet => true
> > indexes :state, :as => :state
> > indexes :country, :as => :country
>
> > has created_at, updated_at
> > # has :city, :as => :merchant_city
>
> > has 'RADIANS(lat)', :as => :lat, :type => :float
> > has 'RADIANS(lng)',:as => :lng, :type => :float
>
> > set_property :latitude_attr => "lat"
> > set_property :longitude_attr => "lng"
> > end
>
> > When I do Model.facets I see all facets as expected. If I do
> > ThinkingSphinx.facets, the I only see class facets, which I guess is
> > expected as well, since it will only list common facets across models?
> > Now if I want rename the alias of my facets, i.e rename :article_city
> > to :city, so that both models have a :city facets, it throws some
> > weird error. Not on my machine, so dont have access to the error, but
> > the question is can I have same named facets?
>
> > Thanks
>
> > --
> > 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
> > athttp://groups.google.com/group/thinking-sphinx?hl=en.
>
>
--
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.