Am 01.10.2009 um 00:05 schrieb Pat Allan:
>
> On 01/10/2009, at 12:00 AM, Jochen Kaechelin wrote:
>
>>
>> I'am not successfull in get this working:
>>
>> sphinx_scope(:latest_first) {
>> { :order => 'created_at DESC' }
>> }
>>
>> I always retrieve 0 hits.
>
> What does your define_index block look like?
indexes kadisnr, :sortable => true, :unique => true, :facet => true
indexes kadis_product, :sortable => true, :unique => true
indexes product, :sortable => true, :unique => true
indexes order_number, :sortable => true, :unique => true, :facet
=> true
indexes kadis_description, :sortable => true
indexes description, :sortable => true
indexes new_product, :sortable => true
indexes notepads.product_id , :as => :notepads
indexes brand, :sortable => true
indexes boost, :sortable => true
indexes created_at
indexes tags.name, :as => :tags
indexes taggings.tag_id, :as => :taggings
has taggings(:tag_id), :as => :taggings_ids
indexes active
set_property :delta => true
>
>> BTW is this possible with freelancing-god-thinking-sphinx?
>>
>> named_scope :old_product, lambda { {:conditions => ["created_at < ?",
>> 1.month.ago]} }
>
> Sphinx doesn't have the concept of greater/less-than, but you can get
> around it with a range:
> sphinx_scope :old_product {
> {:with => {:created_at => (0..1.month.ago)}}
> }
>
U missed the "(" and ")":
sphinx_scope(:old_product) {
{:with => {:created_at => (0..1.month.ago) } }
}
That works. But "0..1.month.ago" will be translated on application
start - or?
So it's not exactly the same as:
lambda { {:conditions => ["created_at < ?",1.month.ago]} }
> This is essentially filtering from the unix epoch (1st Jan 1970) up
> until 1 month ago.
>
> Cheers
>
> --
> Pat
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---