Here here.  I'm still just using results.each_with_groupby_and_count
to essentially hand-build my facets, because we need facets to be
based on all results in the DB, not just the current page.  I'm not
sure I can ever recall having seen a search where facets were supposed
to be relative to the current page.  I believe the "point" of facets
(at least as I've seen them used, on eBay, Yelp, etc) is to give the
user a sense of all the results returned, so the user can know which
additional filters they might want to apply to their search.

Until the Powers that Be see fit to revise facets to incorporate all
results, you can always try something like:

categories_hash = {}
categories = Item.search(search_string, :group_by =>
'category_ids', :group_function => :attr, :group_clause => "@count
DESC")
categories.each_with_groupby_and_count { |item, group, count|
categories_hash.merge!(group => count) }

We use the above to build that incorporates results grouped by
category_id across all 2 million items in our DB.  Its uglier than
facets, but it doesn't consider pagination.

Cheers,
Bill

On Apr 27, 3:12 pm, Eric Obershaw <[email protected]> wrote:
>  > Anyway, I feel it is unintuitive for pagination settings to interfere
>  > with facet information. If I do a search, and there are 500 results,
>  > the facet information should reflect the total result set
>
>  > I would like to find out how others have dealt with the faceted  
> search
>  > issues I'm having.
>
> I completely agree.  I just struggled with the same thing and ended up  
> just writing my own pagination.
>
> On Apr 27, 2009, at 11:38 AM, Thuva Tharma wrote:
>
>
>
> > Hello Sanjay,
>
> > Thank you for your reply. Your suggestion works. Suppose I have 1000
> > restaurants. Then the following returns the correct facet information:
>
> >facets= Restaurant.facets(:limit => 1000, :max_matches => 1000)
>
> > By the way, I'm not sure why I need to specify both :limit
> > and :max_matches.
>
> > Now, I have a different problem. The pagination no longer works. If I
> > do,facets.for, then all the restaurants are loaded at once. How do I
> > implement pagination?
>
> > Anyway, I feel it is unintuitive for pagination settings to interfere
> > with facet information. If I do a search, and there are 500 results,
> > the facet information should reflect the total result set (containing
> > 500 records). Currently, the facet information seems to reflect the
> > result set in the current page.
>
> > I would like to find out how others have dealt with the faceted search
> > issues I'm having.
>
> > P.S. If I put a configuration entry in sphinx.conf file for
> > max_matches and run rake ts:index, then the entry disappears. Running
> > rake:start and rake:stop doesn't behave that way.
>
> > Thank you in advance.
>
> > -- Thuva Tharma
>
> > On Apr 26, 11:34 am, Sanjay <[email protected]> wrote:
> >> I think this might be due to the pagination settings on your request.
> >> To increase the number of results on a specific request, try the
> >> request with the following parameters:
>
> >> Restaurant.facets(:limit => 50, :max_matches => 50)
>
> >> Set your limit based on the number of results you want.  Also note
> >> that max_matches can not be greater than the value in your sphinx
> >> configuration file.
>
> >> On Apr 24, 2:59 pm, Thuva Tharma <[email protected]> wrote:
>
> >>> I'm having problems with thefacetsfunctionality offered by  
> >>> Thinking
> >>> Sphinx. I have a restaurant model configured as shown in this  
> >>> pastie:http://gist.github.com/101305
>
> >>> When I do Restaurant.facets, the returned hash doesn't reflect the
> >>> records in the database. A sample hash that was returned can be seen
> >>> in this pastie:http://gist.github.com/101308
>
> >>> The facet information for region_id is completely correct.
>
> >>> However, the facet information for cuisine_ids and  
> >>> neighbourhood_id is
> >>> is wrong. The cuisine_ids and neighbourhood_id hashes are missing  
> >>> many
> >>> ids that should be there.
>
> >>> For example, there are 43 restaurants in the neighbourhood given  
> >>> by id
> >>> 238. Also, there are 407 restaurants with the cuisine given by id  
> >>> 11.
> >>> As you can see from the pastie above, those ids are not in the hash.
>
> >>> I couldn't figure out the issue. Reindexing didn't work. I also  
> >>> tried
> >>> deleting the files in db/sphinx and indexing. That didn't work as
> >>> well.
>
> >>> By the way, I'm using 0.9.8-release (r1371).
>
> >>> Thank you in advance.
>
> >>> -- Thuva Tharma
--~--~---------~--~----~------------~-------~--~----~
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