I apologize for being very pedantic, but to follow the example through
some request/response cycles to further drill into the facets would
help me.
Request/Response Cycle 1 controller:
@facets = Model.facets
Request/Response Cycle 1 view:
Iterate over @facets and create links.
Request/Response Cycle 2 controller:
Marshall @facets, presumably from the url?, and perform @facets.for
(:<facet_the_user_clicked_on_from_url> => <facet_value_from_url>) to
subset of results represented by selected facet.
In this step, what would be the best way to get the subset of facets
since @facets.for only returns results? Should we filter via
Model.facets(:with => {:<facet_the_user_clicked_on_from_url> =>
<facet_value_from_url>}) or ? I think I tried this and it didn't work
correctly as far as results.
Request/Response 2 view:
Iterate over results and display them
Same for facets.
Let user repeat step 2.
Thanks!
On May 8, 5:03 pm, Pat Allan <[email protected]> wrote:
> Hi Chris
>
> You should be able to get the count first by the following code:
>
> �...@facets= Model.facets
>
> That will return a Hash-like object (well, a subclass of Hash), which
> will look something like:
>
> {:s_service_address => {"Value A" => 3, "Value B" => 4, "Value C"
> => 1}}
>
> These results can be used in your views to provide a summary of the
> breakdown of search results. You can then drill down on those results
> as follows:
>
> �[email protected](:s_service_address => "Value B")
>
> I'm not quite sure if this is what you're after, going by your
> description, but hopefully it's helpful nonetheless.
>
> Cheers
>
> --
> Pat
>
> On 29/04/2009, at 8:26 PM, internetchris wrote:
>
>
>
> > Hey Everyone,
>
> > I'm on to my next task. I would like to implement / try out the facet
> > feature in my search results. As a test I added this to my
> > "define_index" block...
>
> > define_index do
> > indexes s_property_no, :sortable => true
> > indexes s_service_address, :facet => true
> > indexes names.name, :as => :property_name
> > indexes names.address :as => :property_address
> > end
>
> > I understand I can view my facet field using "Model.facets" , but I'm
> > not sure how I implement this in a controller/view. Can someone
> > explain how I can implement a facet where at the top of my search
> > results I have a field that basically looks like this...
>
> > Service Address (3)
>
> > The 3 would represent the number of search results returned for the
> > "s_service_address" field. If a user clicks on "Service Address (3)"
> > the search results would then get filtered. Any help in the right
> > direction would be appreciated. To view my model/controller/view info,
> > you can use the example I posted on my blog. This is my current setup.
>
> >http://railstrip.ourgreatjourney.com/rails_thinkingsphinx_2_models/
>
> > I started using my blog as an online diary of my troubles/solutions,
> > so if I get this figured out I will be sure to add a new post on how
> > to do it.
>
> > Thanks!
>
> > Chris
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---