Commit f410fec2 authored by Jean-Francois Dockes's avatar Jean-Francois Dockes
Browse files

Use RECOLL_CONFDIR and RECOLL_EXTRADBS to change the confdir or add indexes.

These are retrieved from the wsgi environ (through the bottle request
variable), and, for example, can be set with an apache SetEnv directive.
parent 48adbfd8
......@@ -104,9 +104,15 @@ def normalise_filename(fn):
#{{{ get_config
def get_config():
config = {}
envdir = bottle.request.environ.get('RECOLL_CONFDIR')
# get useful things from recoll.conf
rclconf = rclconfig.RclConfig()
rclconf = rclconfig.RclConfig(envdir)
config['confdir'] = rclconf.getConfDir()
extradbs = bottle.request.environ.get('RECOLL_EXTRADBS')
if extradbs:
config['extradbs'] = shlex.split(extradbs)
else:
config['extradbs'] = None
config['dirs'] = [os.path.expanduser(d) for d in
shlex.split(rclconf.getConfParam('topdirs'))]
config['stemlang'] = rclconf.getConfParam('indexstemminglanguages')
......@@ -187,7 +193,7 @@ def query_to_recoll_string(q):
#{{{ recoll_initsearch
def recoll_initsearch(q):
config = get_config()
db = recoll.connect(config['confdir'])
db = recoll.connect(config['confdir'], extra_dbs = config['extradbs'])
db.setAbstractParams(config['maxchars'], config['context'])
query = db.query()
query.sortby(q['sort'], q['ascending'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment