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
16 JVM.attachCurrentThread() # where to put this?
20 if 'q' in request.GET:
21 toks = srch.get_tokens(request.GET['q'])
22 results = srch.search_perfect(toks) + srch.search_everywhere(toks)
23 results.sort(lambda a, b: cmp(a[0], b[0]) < 0)
24 print("searched, results are: %s\n" % results)
26 return render_to_response('newsearch/search.html', {"results": results},
27 context_instance=RequestContext(request))