From 061805aa73d3d5b418a61fa6d6591d1a7d03d9ed Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 18 Oct 2014 18:28:26 -0500 Subject: FS#30773: put exact matches at top There have been a few proposed solutions to this, but there really isn't anything without a drawback. Things break pagination, require loading the entire result set from the database, etc. Just plop a new table on the page if someone did a so-called "simple" search and we have a match. Only show on the first page of the search results. This results in a relatively fast experience for someone doing something like searching for the "perl" package. Signed-off-by: Dan McGee --- templates/packages/search.html | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'templates/packages/search.html') diff --git a/templates/packages/search.html b/templates/packages/search.html index db86fb67..ca95c3f0 100644 --- a/templates/packages/search.html +++ b/templates/packages/search.html @@ -40,6 +40,42 @@

Package Search

+{% if not is_paginated or page_obj.number == 1 %}{% with search_form.exact_matches as exact_matches %}{% if exact_matches %} +
+
+

{{ exact_matches|length }} exact match{{ exact_matches|pluralize:"es" }} found.

+
+ + + + + + + + + + + + + + {% for pkg in exact_matches %} + + + + {% if pkg.flag_date %} + + {% else %} + + {% endif %} + + + + {% endfor %} + +
ArchRepoNameVersionDescriptionLast UpdatedFlag Date
{{ pkg.arch.name }}{{ pkg.repo.name|capfirst }}{% pkg_details_link pkg %}{{ pkg.full_version }}{{ pkg.full_version }}{{ pkg.pkgdesc }}{{ pkg.last_update|date }}{{ pkg.flag_date|date }}
+
+{% endif %}{% endwith %}{% endif %} + {% if package_list %}
{% include "packages/search_paginator.html" %} -- cgit v1.2.3-54-g00ecf