'Return a paginated list of objects for a request.
`model`
Limit the search to a particular model
`facets`
A list of facets to include with the results'

def _search(self, request, model, facets=None, page_size=20, highlight=True):

    form = FacetedSearchForm(request.GET, facets=(facets or []), models=(model,), load_all=True)
    if (not form.is_valid()):
        return self.error_response({'errors': form.errors}, request)
    results = form.search()
    paginator = Paginator(results, page_size)
    try:
        page = paginator.page(int(request.GET.get('page', 1)))
    except InvalidPage:
        raise Http404(ugettext('Sorry,    no    results    on    that    page.'))
    objects = []
    query = request.GET.get('q', '')
    highlighter = Highlighter(query)
    for result in page.object_list:
        if (not result):
            continue
        text = result.text
        if highlight:
            text = highlighter.highlight(text)
        bundle = self.build_bundle(obj=result.object, request=request)
        bundle = self.full_dehydrate(bundle)
        bundle.data['text'] = text
        objects.append(bundle)
    url_template = self._url_template(query, form['selected_facets'].value())
    page_data = {'number': page.number, 'per_page': paginator.per_page, 'num_pages': paginator.num_pages, 'page_range': paginator.page_range, 'object_count': paginator.count, 'url_template': url_template}
    if page.has_next():
        page_data['url_next'] = url_template.format(page.next_page_number())
    if page.has_previous():
        page_data['url_prev'] = url_template.format(page.previous_page_number())
    object_list = {'page': page_data, 'objects': objects}
    if facets:
        object_list.update({'facets': results.facet_counts()})
    return object_list
