3 from django.shortcuts import render_to_response, get_object_or_404
4 from django.template import RequestContext
5 from django.contrib.auth.decorators import login_required
6 from django.views.decorators import cache
8 from catalogue.utils import get_random_hash
9 from catalogue.models import Book, Tag
10 from catalogue import forms
11 from search import MultiSearch, JVM, SearchResult
16 JVM.attachCurrentThread() # where to put this?
20 if 'q' in request.GET:
21 toks = srch.get_tokens(request.GET['q'])
22 results = SearchResult.aggregate(srch.search_perfect_book(toks),
23 srch.search_perfect_parts(toks),
24 srch.search_everywhere(toks))
25 results.sort(reverse=True)
30 return render_to_response('newsearch/search.html', {"results": results},
31 context_instance=RequestContext(request))