Tell me more ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

How might one implement SOSL paging, i.e. get the next 200 results, in Apex?

share|improve this question
2  
I know this doesn't answer your question (hence I'm not writing it as an answer!) but I think Jeff Atwood hits the nail on the head when it comes to pagination: codinghorror.com/blog/2012/03/the-end-of-pagination.html Do you really expect your user to flick through more than 200 results? Your best option might be to suggest to the user that they refine their query, or increase granularity of the query parameters available to them. – LaceySnr Aug 27 '12 at 3:32

2 Answers

These probably aren't the answers your looking for, but unless someone else has some clever ideas...

The current answer in the Force.com Discussion Boards : Pagination for SOSL query is:

"No, it's not possible to query more than 200 records in a SOSL query."

From SOSL Syntax

Syntax: LIMIT n

Description: Optional. Specifies the maximum number of rows returned in the text query, up to 200. If unspecified, the default is 200, the largest number of rows that can be returned.

IdeaExchange: Lift 200 record limit in SOSL

share|improve this answer

Use a WHERE (range) with an ORDER BY on the same column, and increase the WHERE on each page. General idea:

FIND {test}
RETURNING Account (id WHERE CreatedDate >= [last page's max createddate])
ORDER BY CreatedDate

Then you get the next 200 records, and the next paging click increments your search range criteria. It's not perfect but is a general pattern for getting around querying limits.

I somewhat agree with Lacey's reference to Atwood when it comes to building easy-to-use web software esp for B2C, but IMO there are plenty of valid use cases in business software for paging through 200+ records based on search/filter criteria.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.