Browse Source

Help for tagging (search) added.

master
Dirk Alders 2 months ago
parent
commit
6a401f322f
2 changed files with 7 additions and 5 deletions
  1. 4
    2
      pages/help.py
  2. 3
    3
      pages/search.py

+ 4
- 2
pages/help.py View File

@@ -42,12 +42,13 @@ ACCESS = mycreole.render_simple(_("""
42 42
 SEARCH = mycreole.render_simple(_(
43 43
     """
44 44
 = Search
45
-The search looks up full words in //title (page basename)// and //page_src (the creole source)// without giving \
46
-special search commands in the search string.
45
+The search looks up full words in //title (page basename)//, //page_src (the creole source)// and //tag (page tags)// \
46
+without giving special search commands in the search string.
47 47
 
48 48
 === Search fields
49 49
 * title (TEXT)
50 50
 * page_src (TEXT)
51
+* tag (TEXT)
51 52
 * creation_time (DATETIME)
52 53
 * modified_time (DATETIME)
53 54
 * modified_user (TEXT)
@@ -80,6 +81,7 @@ This search pattern can also be combined with other search text via logical oper
80 81
 == Examples
81 82
 * [[/search/?q=modified_user:system-page|modified_user:system-page]] results in a list of all system pages.
82 83
 * [[/search/?q=modified_time%3A%5B-5d+to+now%5D| modified_time:[-5d to now] ]] results in a list of all pages which have been modified within the last 5 days.
84
+* [[/search/?q=tag%3Afoo| tag:foo ]] results in a list of all pages which are tagged with //foo//.
83 85
 """))
84 86
 
85 87
 BACKUP = mycreole.render_simple(_(

+ 3
- 3
pages/search.py View File

@@ -18,7 +18,7 @@ SCHEMA = Schema(
18 18
     # Page
19 19
     title=TEXT,
20 20
     page_src=TEXT,
21
-    page_tags=TEXT,
21
+    tag=TEXT,
22 22
     # metadata
23 23
     creation_time=DATETIME,
24 24
     modified_time=DATETIME,
@@ -64,7 +64,7 @@ def add_item(ix, bp: base_page):
64 64
         #
65 65
         title=bp.title,
66 66
         page_src=bp.raw_page_src,
67
-        page_tags=bp.page_tags,
67
+        tag=bp.page_tags,
68 68
         #
69 69
         creation_time=datetime.fromtimestamp(bp._meta_data.get(bp._meta_data.KEY_CREATION_TIME)),
70 70
         modified_time=datetime.fromtimestamp(bp._meta_data.get(bp._meta_data.KEY_MODIFIED_TIME)),
@@ -79,7 +79,7 @@ def add_item(ix, bp: base_page):
79 79
 
80 80
 def whoosh_search(search_txt):
81 81
     ix = load_index()
82
-    qp = qparser.MultifieldParser(['title', 'page_src', 'page_tags'], ix.schema)
82
+    qp = qparser.MultifieldParser(['title', 'page_src', 'tag'], ix.schema)
83 83
     qp.add_plugin(DateParserPlugin(free=True))
84 84
     try:
85 85
         q = qp.parse(search_txt)

Loading…
Cancel
Save