blob: cf27ca59ce6b3ff3c83652d0222d742de64f845e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# Search plugin for GNU Mediagoblin
N.B Only works with mediagoblin 0.9.0 and later.
`indexedsearch` is a plugin for GNU Mediagoblin that adds support for searching media.
By default, the search function will query the tags, title and description fields
of media for the given phrase.
More complex queries are supported, e.g:
searching for media with tagged with "hello"
and not tagged with "goodbye" (tag:hello -tag:goodbye),
or searching for any media added by the user "tom" (user:tom).
(See http://whoosh.readthedocs.org/en/latest/querylang.html for more syntax info.)
This plugin is based on an existing search plugin,
https://github.com/ayleph/mediagoblin-basicsearch/,
but uses a search index for queries.
## Dependencies
$ pip install whoosh
## Configure the search plugin
The search plugin adds a search link to the top header
bar of the MediaGoblin instance. You may specify the
display style of the search link in your mediagoblin
config file. There are three options for the
search link display style.
- `link` displays a normal text link next to the Log In link.
This is the default display style.
- `button` displays an action button link next to the Log In link.
- `none` does not display a link. This is useful if you want to
create your own search link in a user_dev template or custom theme.
If you choose to specify the display style,
add it to your mediagoblin.ini file like this.
[[mediagoblin.plugins.indexedsearch]]
SEARCH_LINK_STYLE = 'link'
Specifies the directory in which the plugin will create
a search index (the plugin will create the directory if it doesn't exist,
assuming correct permissions etc.).
By default the index will be created in `/path/to/mediagoblin/user_dev/searchindex`
INDEX_DIR = '/path/to/index/directory'
Specifies whether or not searching for content requires
being logged-in. Defaults to `True`.
USERS_ONLY = True
|