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
 SEARCH = mycreole.render_simple(_(
42
 SEARCH = mycreole.render_simple(_(
43
     """
43
     """
44
 = Search
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
 === Search fields
48
 === Search fields
49
 * title (TEXT)
49
 * title (TEXT)
50
 * page_src (TEXT)
50
 * page_src (TEXT)
51
+* tag (TEXT)
51
 * creation_time (DATETIME)
52
 * creation_time (DATETIME)
52
 * modified_time (DATETIME)
53
 * modified_time (DATETIME)
53
 * modified_user (TEXT)
54
 * modified_user (TEXT)
80
 == Examples
81
 == Examples
81
 * [[/search/?q=modified_user:system-page|modified_user:system-page]] results in a list of all system pages.
82
 * [[/search/?q=modified_user:system-page|modified_user:system-page]] results in a list of all system pages.
82
 * [[/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.
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
 BACKUP = mycreole.render_simple(_(
87
 BACKUP = mycreole.render_simple(_(

+ 3
- 3
pages/search.py View File

18
     # Page
18
     # Page
19
     title=TEXT,
19
     title=TEXT,
20
     page_src=TEXT,
20
     page_src=TEXT,
21
-    page_tags=TEXT,
21
+    tag=TEXT,
22
     # metadata
22
     # metadata
23
     creation_time=DATETIME,
23
     creation_time=DATETIME,
24
     modified_time=DATETIME,
24
     modified_time=DATETIME,
64
         #
64
         #
65
         title=bp.title,
65
         title=bp.title,
66
         page_src=bp.raw_page_src,
66
         page_src=bp.raw_page_src,
67
-        page_tags=bp.page_tags,
67
+        tag=bp.page_tags,
68
         #
68
         #
69
         creation_time=datetime.fromtimestamp(bp._meta_data.get(bp._meta_data.KEY_CREATION_TIME)),
69
         creation_time=datetime.fromtimestamp(bp._meta_data.get(bp._meta_data.KEY_CREATION_TIME)),
70
         modified_time=datetime.fromtimestamp(bp._meta_data.get(bp._meta_data.KEY_MODIFIED_TIME)),
70
         modified_time=datetime.fromtimestamp(bp._meta_data.get(bp._meta_data.KEY_MODIFIED_TIME)),
79
 
79
 
80
 def whoosh_search(search_txt):
80
 def whoosh_search(search_txt):
81
     ix = load_index()
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
     qp.add_plugin(DateParserPlugin(free=True))
83
     qp.add_plugin(DateParserPlugin(free=True))
84
     try:
84
     try:
85
         q = qp.parse(search_txt)
85
         q = qp.parse(search_txt)

Loading…
Cancel
Save