diff --git a/nummi/main/templates/main/transactions.html b/nummi/main/templates/main/transactions.html index 3293675..edf421e 100644 --- a/nummi/main/templates/main/transactions.html +++ b/nummi/main/templates/main/transactions.html @@ -13,6 +13,7 @@

{% translate "Transactions" %}

{% transaction_table transactions %} +{% if page_obj %} +{% endif %} {% endblock %} diff --git a/nummi/main/views.py b/nummi/main/views.py index ae36576..fbc6039 100644 --- a/nummi/main/views.py +++ b/nummi/main/views.py @@ -217,22 +217,16 @@ def search(request): Transaction.objects.annotate( rank=SearchRank( SearchVector("name", weight="A") - + SearchVector("description", weight="C"), + + SearchVector("description", weight="B") + + SearchVector("trader", weight="B"), SearchQuery(_search, search_type="websearch"), ), similarity=TrigramSimilarity("name", _search), ) - .filter(models.Q(rank__gte=0.1) | models.Q(similarity__gte=0.1)) + .filter(models.Q(rank__gte=0.1) | models.Q(similarity__gte=0.3)) .order_by("-rank", "-date") ) - if _transactions.count() == 0: - _transactions = ( - Transaction.objects.annotate(rank=TrigramSimilarity("name", _search)) - .filter(rank__gte=0.1) - .order_by("-rank", "-date") - ) - return render( request, "main/transactions.html",