def search(self, rdata, user): form = SearchForm(rdata) output = render_page(rdata.get('page', 1), form.queryset(), 20) output['sidebar'] = render_to_string('search/_sidebar.html', { 'form': form, 'rdata': rdata, }) return output
def _search(self, rdata, user): form = SearchForm(rdata) output = render_page(rdata.get('page', 1), form.queryset(), 20) output['sidebar'] = render_to_string('search/_sidebar.html', { 'form': form, 'rdata': rdata, }) # Assume we're currently indexing if the number of public # indexed vids differs from the count of video objects by # more than 1000 is_indexing = cache.get('is_indexing') if is_indexing is None: is_indexing = Video.objects.all().count() - VideoIndex.public( ).count() > 1000 cache.set('is_indexing', is_indexing, 300) output['is_indexing'] = is_indexing return output
def get_search_qs(self, query, **params): form = SearchForm(RpcMultiValueDict(dict(q=query, **params))) return form.queryset()