Thinking Sphinx creates a duplicate attribute called
[field_name]_facet, which you can use with the :with option after
crc'ing the value.

Product.facets(:with => {:field_facet => '10'.to_crc32})

As for why you get 9 instead of 4, it may be because searching for 10
matches both 10 and 10.5 (which might be indexed without the "."???).

James

On Wed, Nov 4, 2009 at 2:35 PM, Alan <[email protected]> wrote:
>
> Ok, I stumbled upon this issue, and I'm wondering if this is a bug or
> perhaps I'm not using TS correctly. Using the sample data models
> below, I get the following behavior(assume I have two shoe sizes "10"
> and "10.5", where both are strings).
>
> Product.facets
> #returns :shoe_size=>{"10"=>4, "10.5"=>5}
> if I then run:
>
> Product.facets :conditions=>{:shoe_size=>"10"}.for.size
>
> I get 9, vs the expected 4.
>
> Any idea why this happens? It's as if facets is doing an exact match,
> but when I actually add on as a condition, it seems to do a partial
> match?
>
> Perhaps related to this.. Is the with vs condition parameter. Although
> I get deprecation warnings about using :with vs :conditions, it seems
> as if only :conditions works
>
>
> **********
> class Product
> has_many shoe_options
> def_index
> indexes shoe_options.shoe_size :as=> shoe_size, :facet=>true
> end
> end
>
> class ShoeOption
> belongs_to shoe
> end
> >
>

--~--~---------~--~----~------------~-------~--~----~
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