You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2018/09/04 14:02:43 UTC

allura git commit: Add search help about specific fields, to blog, chat, discussion, wiki tools

Repository: allura
Updated Branches:
  refs/heads/master ea27fd54c -> e06a0c917


Add search help about specific fields, to blog, chat, discussion, wiki tools


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/e06a0c91
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/e06a0c91
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/e06a0c91

Branch: refs/heads/master
Commit: e06a0c917184f60e9a6e57fce51a42c87f59091c
Parents: ea27fd5
Author: Dave Brondsema <da...@brondsema.net>
Authored: Fri Aug 31 15:00:40 2018 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Fri Aug 31 15:00:40 2018 -0400

----------------------------------------------------------------------
 Allura/allura/lib/widgets/search.py                 |  3 ++-
 Allura/allura/templates/widgets/search_help.html    | 12 ++++++++++--
 ForgeBlog/forgeblog/main.py                         |  7 ++++++-
 ForgeChat/forgechat/main.py                         |  5 ++++-
 ForgeDiscussion/forgediscussion/controllers/root.py |  6 +++++-
 ForgeWiki/forgewiki/wiki_main.py                    |  7 ++++++-
 6 files changed, 33 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/e06a0c91/Allura/allura/lib/widgets/search.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/search.py b/Allura/allura/lib/widgets/search.py
index 32014c4..b923618 100644
--- a/Allura/allura/lib/widgets/search.py
+++ b/Allura/allura/lib/widgets/search.py
@@ -49,7 +49,7 @@ class SearchHelp(ffw.Lightbox):
         name='search_help_modal',
         trigger='a.search_help_modal')
 
-    def __init__(self, comments=True, history=True):
+    def __init__(self, comments=True, history=True, fields={}):
         super(SearchHelp, self).__init__()
         # can't use g.jinja2_env since this widget gets imported too early :(
         jinja2_env = jinja2.Environment(
@@ -57,4 +57,5 @@ class SearchHelp(ffw.Lightbox):
         self.content = jinja2_env.get_template('search_help.html').render(dict(
             comments=comments,
             history=history,
+            fields=fields,
         ))

http://git-wip-us.apache.org/repos/asf/allura/blob/e06a0c91/Allura/allura/templates/widgets/search_help.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_help.html b/Allura/allura/templates/widgets/search_help.html
index ab701db..a936e4c 100644
--- a/Allura/allura/templates/widgets/search_help.html
+++ b/Allura/allura/templates/widgets/search_help.html
@@ -19,8 +19,16 @@
 <div style="height:400px; overflow:auto;">
 
 <h1>Searching</h1>
-<p>To search for an exact phrase, put it in quotes.  Example: "getting started docs"</p>
-<p>To exclude a word or phrase, put a dash in front of it.  Example: docs -help</p>
+<p>To search for an exact phrase, put it in quotes.  Example: <code>"getting started docs"</code></p>
+<p>To exclude a word or phrase, put a dash in front of it.  Example: <code>docs -help</code></p>
+{% if fields %}
+    <p>To search on specific fields, use these field names instead of a general text search.  You can group with <code>AND</code> or <code>OR</code>.</p>
+    <ul>
+    {% for fld, descr in fields.iteritems() %}
+        <li><b>{{ fld }}:</b>{{ descr }}</li>
+    {% endfor %}
+    </ul>
+{% endif %}
 {% if comments %}
 <p>You can use the 'Search comments?' checkbox to include comments in the search results.</p>
 {% endif %}

http://git-wip-us.apache.org/repos/asf/allura/blob/e06a0c91/ForgeBlog/forgeblog/main.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/main.py b/ForgeBlog/forgeblog/main.py
index 657ba17..653400f 100644
--- a/ForgeBlog/forgeblog/main.py
+++ b/ForgeBlog/forgeblog/main.py
@@ -74,7 +74,12 @@ class W:
     preview_post_form = widgets.PreviewPostForm()
     subscribe_form = SubscribeForm(thing='post')
     search_results = SearchResults()
-    help_modal = SearchHelp()
+    help_modal = SearchHelp(fields={'title': 'Title',
+                                    'text': '"Post text"',
+                                    'labels_t': 'Labels',
+                                    'mod_date_dt': 'Last modified.  Example: mod_date_dt:[2018-01-01T00:00:00Z TO *]',
+                                    'author_user_name_t': 'username (for comments only)',
+                                    })
 
 
 class ForgeBlogApp(Application):

http://git-wip-us.apache.org/repos/asf/allura/blob/e06a0c91/ForgeChat/forgechat/main.py
----------------------------------------------------------------------
diff --git a/ForgeChat/forgechat/main.py b/ForgeChat/forgechat/main.py
index fb5d8b5..64b15e5 100644
--- a/ForgeChat/forgechat/main.py
+++ b/ForgeChat/forgechat/main.py
@@ -148,7 +148,10 @@ class RootController(BaseController):
                    project=validators.StringBool(if_empty=False)))
     def search(self, q=None, project=None, limit=None, page=0, **kw):
         c.search_results = SearchResults()
-        c.help_modal = SearchHelp(comments=False, history=False)
+        c.help_modal = SearchHelp(comments=False, history=False,
+                                  fields={'sender_t': 'username',
+                                          'text': '"Message text"',
+                                          })
         search_params = kw
         search_params.update({
             'q': q or '',

http://git-wip-us.apache.org/repos/asf/allura/blob/e06a0c91/ForgeDiscussion/forgediscussion/controllers/root.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/controllers/root.py b/ForgeDiscussion/forgediscussion/controllers/root.py
index 641e757..47c724c 100644
--- a/ForgeDiscussion/forgediscussion/controllers/root.py
+++ b/ForgeDiscussion/forgediscussion/controllers/root.py
@@ -61,7 +61,11 @@ class RootController(BaseController, DispatchIndex, FeedController):
         announcements_table = FW.AnnouncementsTable()
         add_forum = AddForumShort()
         search_results = SearchResults()
-        search_help = SearchHelp(comments=False, history=False)
+        search_help = SearchHelp(comments=False, history=False,
+                                 fields={'author_user_name_t': 'Username',
+                                         'text': '"Post text"',
+                                         'timestamp_dt': 'Date posted.  Example: timestamp_dt:[2018-01-01T00:00:00Z TO *]',
+                                         'name_s': 'Subject'})
 
     def _check_security(self):
         require_access(c.app, 'read')

http://git-wip-us.apache.org/repos/asf/allura/blob/e06a0c91/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index e3a8cfb..f7c1eca 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -73,7 +73,12 @@ class W:
     page_list = ffw.PageList()
     page_size = ffw.PageSize()
     search_results = SearchResults()
-    help_modal = SearchHelp()
+    help_modal = SearchHelp(fields={'title': 'title',
+                                    'text': '"Page text"',
+                                    'mod_date_dt': 'Last modified.  Example: mod_date_dt:[2018-01-01T00:00:00Z TO *]',
+                                    'labels_t': 'labels',
+                                    'author_user_name_t': 'username (for comments only)',
+                                    })
     icons = {
         24: 'images/wiki_24.png',
         32: 'images/wiki_32.png',