Commit c2fb4b51 authored by Mario Chirinos's avatar Mario Chirinos

Rank

parent 07a83f45
......@@ -124,7 +124,7 @@ def getNewsByRequest(request, values=None):
print (myQuery)
news_result = News.objects.filter(myQuery).order_by(orderBy)
if textSearchFlag:
news_result=news_result.annotate(rank=SearchRank(SearchVector("text"), SearchQuery(request.GET['text']), normalization=Value(2).bitor(Value(4)),)).order_by("-rank")
news_result=news_result.annotate(rank=SearchRank(SearchVector("title", config="spanish"), SearchQuery(request.GET['text'], config="spanish", search_type='phrase'), normalization=Value(2).bitor(Value(4)),)).order_by("-rank")
return news_result
#-------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment