Commits

Thomas Waldmann committed 7b28a1e

search: add name/content key terms as suggestions to search result view

Comments (0)

Files changed (2)

MoinMoin/apps/frontend/views.py

             results = searcher.search(q, limit=100)
             return render_template('search.html',
                                    results=results,
+                                   name_suggestions=u', '.join([word for word, score in results.key_terms('name', docs=20, numterms=10)]),
+                                   content_suggestions=u', '.join([word for word, score in results.key_terms('content', docs=20, numterms=10)]),
                                    query=query,
                                    medium_search_form=search_form,
                                    item_name='+search', # XXX

MoinMoin/templates/search.html

         </div>
     {{ gen.form.close() }}
     {% if results is defined %}
+    <div>
+        <p>{{ _("name term suggestions: %(termlist)s", termlist=name_suggestions) }}</p>
+        <p>{{ _("content term suggestions: %(termlist)s", termlist=content_suggestions) }}</p>
+    </div>
     <div class="searchresults">
         <table>
             {% for result in results %}