Hey Navin, Thanks for the insight. I'll keep that in mind.
On Fri, Jun 25, 2010 at 12:57 AM, Navin Samuel <[email protected]>wrote: > Hi Jim, > I usually store price info as an integer value (float rounded to 2 > decimal places * 100 or whatever precision you would like to keep). This > way it makes it easy to filter during search in addition to having other > benefits. > > - Navin > > > On Wed, Jun 23, 2010 at 8:38 PM, Jim Ruther Nill <[email protected]> wrote: > >> ok thanks! I was thinking of putting the index on size, instead of >> product, since you can still index product attributes from size. >> >> Thanks again! >> >> >> On Thu, Jun 24, 2010 at 11:35 AM, Pat Allan <[email protected]>wrote: >> >>> No worries :) >>> >>> One other thing to mention - if you really want price as a float/decimal, >>> then perhaps it's worth putting an index on Size, with a product_id >>> attribute, so you could search on Size and group by product_id (ie: limit to >>> one result per product). >>> >>> http://freelancing-god.github.com/ts/en/searching.html#grouping >>> >>> Cheers >>> >>> -- >>> Pat >>> >>> On 24/06/2010, at 1:31 PM, Jim Ruther Nill wrote: >>> >>> > Everything noted. Thanks for the fast reply! and, of course, this >>> wonderful app. :D >>> > >>> > On Thu, Jun 24, 2010 at 11:21 AM, Pat Allan <[email protected]> >>> wrote: >>> > Hi Jim >>> > >>> > Two things to note: >>> > >>> > * Sphinx has no concept of float arrays, only integer arrays >>> > * If price is/can-be an integer, then a normal filter should work, I'm >>> pretty sure: >>> > >>> > :with => {:size_prices => 0..10} >>> > >>> > Keep in mind the range arguments need to be integers. Also, aliases for >>> fields & attributes should be symbols, not strings. >>> > >>> > Cheers >>> > >>> > -- >>> > Pat >>> > >>> > On 24/06/2010, at 1:15 PM, Jim Ruther Nill wrote: >>> > >>> > > Hi! >>> > > >>> > > If you have a one-to-many association, >>> > > >>> > > Product - has_many :sizes >>> > > Size - belongs_to :product >>> > > >>> > > and a price attribute is on the Size model, how would you filter for >>> a particular price range? >>> > > >>> > > The define index block in the product model >>> > > >>> > > define_index do >>> > > has sizes(:price), :as => 'size_prices' >>> > > end >>> > > >>> > > Thanks! >>> > > >>> > > ------------------------------------------------------------- >>> > > visit my blog at http://jimlabs.heroku.com >>> > > >>> > > -- >>> > > 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]<thinking-sphinx%[email protected]> >>> . >>> > > For more options, visit this group at >>> http://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]<thinking-sphinx%[email protected]> >>> . >>> > For more options, visit this group at >>> http://groups.google.com/group/thinking-sphinx?hl=en. >>> > >>> > >>> > >>> > >>> > -- >>> > ------------------------------------------------------------- >>> > visit my blog at http://jimlabs.heroku.com >>> > >>> > -- >>> > 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]<thinking-sphinx%[email protected]> >>> . >>> > For more options, visit this group at >>> http://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]<thinking-sphinx%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/thinking-sphinx?hl=en. >>> >>> >> >> >> -- >> ------------------------------------------------------------- >> visit my blog at http://jimlabs.heroku.com >> >> -- >> 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]<thinking-sphinx%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/thinking-sphinx?hl=en. >> > > > > -- > Regards, > Navin > > -- > 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]<thinking-sphinx%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/thinking-sphinx?hl=en. > -- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- 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.
