Ejemplo n.º 1
0
	def get(self, request, *args, **kwargs):
		complete = request.GET.get("complete")
		if complete:
			page_index = get_index_by_name("pages")
			result = get_connection().completion_suggest(page_index, complete, fuzzy=2)
			return HttpResponse(content=json.dumps(result.options), content_type="application/json")
		return super(SearchView, self).get(request, *args, **kwargs)
Ejemplo n.º 2
0
	def handle(self, *args, **options):
		conn = get_connection()
		index = get_index_by_name("pages")
		wg = WordGatherer(conn, "word-suggest")
		wg.reset()
		wg.update(index, ("abstract", "title"), tokenizer=smart_finnish_tokenizer)
		for x in wg.search("juna"):
			print x
Ejemplo n.º 3
0
 def handle(self, *args, **options):
     conn = get_connection()
     index = get_index_by_name("pages")
     wg = WordGatherer(conn, "word-suggest")
     wg.reset()
     wg.update(index, ("abstract", "title"),
               tokenizer=smart_finnish_tokenizer)
     for x in wg.search("juna"):
         print x
Ejemplo n.º 4
0
 def get(self, request, *args, **kwargs):
     complete = request.GET.get("complete")
     if complete:
         page_index = get_index_by_name("pages")
         result = get_connection().completion_suggest(page_index,
                                                      complete,
                                                      fuzzy=2)
         return HttpResponse(content=json.dumps(result.options),
                             content_type="application/json")
     return super(SearchView, self).get(request, *args, **kwargs)