I understand.  Sorry, I do not know enough about how the inner workings of
Sphinx to be able to help.

Can anyone else help?

Colin

2009/5/25 Daniel Jorge <[email protected]>

>
> Hi thank you for your answer
>
> The models you wrote are ok, I just simplified them for illustration
> purposes.
>
> My problem is with search facets (filtering) using Thinking Sphinx.
> Suppose that I had a book model with the fields author, publisher and
> year. When a customer select the book category, he will be presented
> with a list of books and on the left side, he will have the "facets"
> like that:
>
> authors
>  -author 1 (203)
>  -author 2 (125)
>  -author 3 (99)
>  -author 4 (38)
>  ...
>
> publishers
>  -publisher1 (199)
>  -publisher1 (21)
>  -publisher1 (408)
>  -publisher1 (134)
>  ...
>
> years
>  -2009 (109)
>  -2008 (33)
>  -2007 (12)
>  -2006 (500)
>  ...
>
> This would be very easy if I had a book model. Thinking Sphinx requires
> a facet to be defined like this on the "book" model:
>
> define_index do
>  indexes author, :facet => true
>   indexes publisher, :facet => true
>  indexes year, :facet => true
> end
>
> THE PROBLEM IS THAT I DO NOT HAVE THIS MODEL AND THIS ATTRIBUTES
> DEFINED. I don't have this defined because I would have to know all the
> product types and all the possible attributes for each product type and
> create a different model for each product type.
>
> -------------------
> WHAT IM LOOKING FOR
> -------------------
> I'M LOOKING FOR SOME KIND OF METAPROGRAMMING THAT ENABLES ME TO FIND
> WHAT ARE THE ATTRIBUTE TYPES FOR A CATEGORY OF PRODUCTS AND BUILD THE
> FACETS AT RUNTIME. SOMETHING LIKE THIS IN MY PRODUCT MODEL:
>
> define_index do
>  find whatever attribute types are relevant for this category
>  and makes it :facet => true
> end
>
> THANKS!!
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to