From b757ceff57ae18de770b4615b1bcf2e71940ddca Mon Sep 17 00:00:00 2001 From: Matthew Scragg Date: Wed, 12 Nov 2014 22:11:13 -0600 Subject: [PATCH] made simple search suck less --- realms/modules/search/models.py | 2 +- realms/templates/search/search.html | 3 ++- realms/version.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/realms/modules/search/models.py b/realms/modules/search/models.py index eacce27..a9f019c 100644 --- a/realms/modules/search/models.py +++ b/realms/modules/search/models.py @@ -33,7 +33,7 @@ class SimpleSearch(BaseSearch): res = [] for entry in g.current_wiki.get_index(): name = filename_to_cname(entry['name']) - if query in name.split('-'): + if set(query.split()).intersection(name.split('-')): page = g.current_wiki.get_page(name) res.append(dict(name=name, content=page['data'])) return res diff --git a/realms/templates/search/search.html b/realms/templates/search/search.html index 8de77af..bb0e4ba 100644 --- a/realms/templates/search/search.html +++ b/realms/templates/search/search.html @@ -1,6 +1,7 @@ {% extends 'layout.html' %} {% block body %} {% if results %} +

Results for {{ request.args.get('q') }}

{% for r in results %} @@ -12,6 +13,6 @@ {% endfor %}
{% else %} - No Results Found +

No results found for {{ request.args.get('q') }}

{% endif %} {% endblock %} diff --git a/realms/version.py b/realms/version.py index 9bdd4d2..08d79c0 100644 --- a/realms/version.py +++ b/realms/version.py @@ -1 +1 @@ -__version__ = '0.5.0' \ No newline at end of file +__version__ = '0.5.1' \ No newline at end of file