【发布时间】:2017-09-10 03:11:07
【问题描述】:
有谁知道哪个插件(使用 Django)是最好的来处理像 StackOverflow 这样的动态搜索?某事like this:
<input type="text" value="how to [django] or [python] duplicate:yes is:answer" style="width: 50%">
我只考虑复杂的查询。
query = request.GET.get('q')
text_query = # what regex here?
tags_query = #
is_duplicate = re.search(r'(?P<duplicate>\w+)', query)
Question.objects.filter(...)
Answer.objects.filter(...)
【问题讨论】:
-
不需要插件。使用正则表达式可以相对容易地处理它。您是在问如何处理上述查询作为示例?
-
@Jonathan 啊是的......你能提供一个例子吗?一些如何找到
text_query = 'how to'和其他..
标签: python django search django-queryset