简体   繁体   中英

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.search('boby').map(&:id)

it makes a request to the database which is redundant.

您可以调用search_for_ids方法以仅返回主键值,而不是ActiveRecord对象的实例。

MyModel.search_for_ids 'body'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM