I'm using sunspot_rails-2.0.0.pre.120417 with postgres
In model i added searchable columns:
searchable do
string :display_title
integer :created_at
integer :ending_at
end
order_by(:created_at,:desc) not working.
ruby-1.9.2-p180 :027 > res=Listing.search{order_by(:created_at,:desc)}
=> <Sunspot::Search:{:fq=>["type:Listing"], :sort=>"created_at_d desc",
:start=>0, :rows=>30, :q=>"*:*"}>
ruby-1.9.2-p180 :028 > res.results.map(&:id)
Listing Load (3.0ms) SELECT "listings".* FROM "listings" WHERE
"listings"."id" IN (100, 99, 94, 95, 96, 97, 98, 93, 88, 89, 90, 91, 92,
83, 84, 85, 86, 87, 77, 78, 79, 80, 81, 82, 72, 73, 74, 75, 76, 67)
=> [*100, 99, 94, 95, 96, 97, 98, 93, 88, 89, 90, 91, 92, 83, 84, 85, 86,
87, 77, 78, 79, 80, 81, 82, 72, 73, 74, 75, 76, 67*]
ruby-1.9.2-p180 :029 > ActiveRecord::Base.connection.execute('select
listings.id FROM "listings" order by created_at desc limit
30').column_values(0)
(0.9ms) select listings.id FROM "listings" order by created_at desc
limit 30
=> [*"100", "99", "98", "97", "96", "95", "94", "93", "92", "91", "90",
"89", "88", "87", "86", "85", "84", "83", "82", "81", "80", "79", "78",
"77", "76", "75", "74", "73", "72", "71"*]
Its working during sql order by and order_by(:ending_at,:desc) but not
for order_by(:created_at,:desc), i dont know why, Any suggestion?
Thanks,
Dhamodharan.N
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.