fujisan
fujisan

Reputation: 221

Searchlogic Limit

How do I pass a search limit on searchlogic....

user = User.name_like("John")

... and limit the search to 50 results?

I have a User almost 3,000+ and base on New Relic(Application Tracking) it takes too much memory in the server. I would like to limit the search to 50 for it to not search through all users.

Upvotes: 0

Views: 111

Answers (1)

PeterWong
PeterWong

Reputation: 16011

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

or make use of other gems such as will_paginate? (i.e. returning the first page which contains 50 results)

Upvotes: 1

Related Questions