开发者

Rails + Thinking-Sphinx result ids

Hey. I use Rails 3.0.1 with thinking-sphinx.

How can I get a list of IDs from a sphinx request? If I do

MyModel.se开发者_如何学Goarch('boby').map(&:id)

it makes a request to the database which is redundant.


You can call search_for_idsmethod to return just the primary key values, instead of instances of ActiveRecord objects.

MyModel.search_for_ids 'body'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜