Skip to content

Instantly share code, notes, and snippets.

@jacqui
Created December 12, 2008 05:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacqui/35029 to your computer and use it in GitHub Desktop.
Save jacqui/35029 to your computer and use it in GitHub Desktop.
@search_results = WillPaginate::Collection.create(page, per_page) do |pager|
xs = ActsAsXapian::Search.new(@search_models, @search_term, {:offset => pager.offset, :limit => pager.per_page})
results = xs.results.map {|r| r[:model] }
pager.replace(results)
pager.total_entries = xs.matches_estimated
end
## alternatively
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment