如何创建简单的搜索引擎?我有这样的事情:
def search(request):
if 'search' in request.GET:
term = request.GET['search']
if len(term) > 3:
d = Data.objects.filter(Q(content__contains=term) | Q(
desc__contains=term))
count = d.count()
return render_to_response('search_result.html', {'d': d, 'count': count}, context_instance=RequestContext(request))
return render_to_response('search_result.html', context_instance=RequestContext(request))
如果我在模型中搜索,这没关系,但我需要在 html 内容中搜索(我使用 django-chunks)