Help for tagging (search) added.
This commit is contained in:
parent
d81c2df678
commit
6a401f322f
@ -42,12 +42,13 @@ ACCESS = mycreole.render_simple(_("""
|
|||||||
SEARCH = mycreole.render_simple(_(
|
SEARCH = mycreole.render_simple(_(
|
||||||
"""
|
"""
|
||||||
= Search
|
= Search
|
||||||
The search looks up full words in //title (page basename)// and //page_src (the creole source)// without giving \
|
The search looks up full words in //title (page basename)//, //page_src (the creole source)// and //tag (page tags)// \
|
||||||
special search commands in the search string.
|
without giving special search commands in the search string.
|
||||||
|
|
||||||
=== Search fields
|
=== Search fields
|
||||||
* title (TEXT)
|
* title (TEXT)
|
||||||
* page_src (TEXT)
|
* page_src (TEXT)
|
||||||
|
* tag (TEXT)
|
||||||
* creation_time (DATETIME)
|
* creation_time (DATETIME)
|
||||||
* modified_time (DATETIME)
|
* modified_time (DATETIME)
|
||||||
* modified_user (TEXT)
|
* modified_user (TEXT)
|
||||||
@ -80,6 +81,7 @@ This search pattern can also be combined with other search text via logical oper
|
|||||||
== Examples
|
== Examples
|
||||||
* [[/search/?q=modified_user:system-page|modified_user:system-page]] results in a list of all system pages.
|
* [[/search/?q=modified_user:system-page|modified_user:system-page]] results in a list of all system pages.
|
||||||
* [[/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.
|
* [[/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.
|
||||||
|
* [[/search/?q=tag%3Afoo| tag:foo ]] results in a list of all pages which are tagged with //foo//.
|
||||||
"""))
|
"""))
|
||||||
|
|
||||||
BACKUP = mycreole.render_simple(_(
|
BACKUP = mycreole.render_simple(_(
|
||||||
|
@ -18,7 +18,7 @@ SCHEMA = Schema(
|
|||||||
# Page
|
# Page
|
||||||
title=TEXT,
|
title=TEXT,
|
||||||
page_src=TEXT,
|
page_src=TEXT,
|
||||||
page_tags=TEXT,
|
tag=TEXT,
|
||||||
# metadata
|
# metadata
|
||||||
creation_time=DATETIME,
|
creation_time=DATETIME,
|
||||||
modified_time=DATETIME,
|
modified_time=DATETIME,
|
||||||
@ -64,7 +64,7 @@ def add_item(ix, bp: base_page):
|
|||||||
#
|
#
|
||||||
title=bp.title,
|
title=bp.title,
|
||||||
page_src=bp.raw_page_src,
|
page_src=bp.raw_page_src,
|
||||||
page_tags=bp.page_tags,
|
tag=bp.page_tags,
|
||||||
#
|
#
|
||||||
creation_time=datetime.fromtimestamp(bp._meta_data.get(bp._meta_data.KEY_CREATION_TIME)),
|
creation_time=datetime.fromtimestamp(bp._meta_data.get(bp._meta_data.KEY_CREATION_TIME)),
|
||||||
modified_time=datetime.fromtimestamp(bp._meta_data.get(bp._meta_data.KEY_MODIFIED_TIME)),
|
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):
|
|||||||
|
|
||||||
def whoosh_search(search_txt):
|
def whoosh_search(search_txt):
|
||||||
ix = load_index()
|
ix = load_index()
|
||||||
qp = qparser.MultifieldParser(['title', 'page_src', 'page_tags'], ix.schema)
|
qp = qparser.MultifieldParser(['title', 'page_src', 'tag'], ix.schema)
|
||||||
qp.add_plugin(DateParserPlugin(free=True))
|
qp.add_plugin(DateParserPlugin(free=True))
|
||||||
try:
|
try:
|
||||||
q = qp.parse(search_txt)
|
q = qp.parse(search_txt)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user