简体   繁体   English

Searchlogic限制

[英]Searchlogic Limit

How do I pass a search limit on searchlogic.... 如何通过对searchlogic的搜索限制。

user = User.name_like("John")

... and limit the search to 50 results? ...并将搜索限制为50个结果?

I have a User almost 3,000+ and base on New Relic(Application Tracking) it takes too much memory in the server. 我有一个将近3,000+的用户,并且基于New Relic(应用程序跟踪),它占用了服务器过多的内存。 I would like to limit the search to 50 for it to not search through all users. 我想将搜索限制为50个,以便不搜索所有用户。

user = User.name_like("John").limit(50)

or make use of other gems such as will_paginate? 还是利用will_paginate等其他宝石? (ie returning the first page which contains 50 results) (即返回包含50个结果的第一页)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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