use the rclconfig module if it is installed to find out and setup the external indexes according to current configuration
This commit is contained in:
parent
ee38ac72d7
commit
eea3ffc03a
1 changed files with 13 additions and 2 deletions
|
@ -6,9 +6,14 @@ import urllib
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
import locale
|
import locale
|
||||||
|
|
||||||
from gi.repository import Unity, GObject, Gio
|
from gi.repository import Unity, GObject, Gio
|
||||||
|
|
||||||
|
try:
|
||||||
|
import rclconfig
|
||||||
|
hasrclconfig = True
|
||||||
|
except:
|
||||||
|
hasrclconfig = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from recoll import recoll
|
from recoll import recoll
|
||||||
from recoll import rclextract
|
from recoll import rclextract
|
||||||
|
@ -106,12 +111,18 @@ class Scope (Unity.Scope):
|
||||||
self.last_connect_time = 0
|
self.last_connect_time = 0
|
||||||
self.timeout_id = None
|
self.timeout_id = None
|
||||||
language, self.localecharset = locale.getdefaultlocale()
|
language, self.localecharset = locale.getdefaultlocale()
|
||||||
|
if hasrclconfig:
|
||||||
|
self.config = rclconfig.RclConfig()
|
||||||
|
|
||||||
def _connect_db(self):
|
def _connect_db(self):
|
||||||
#print "Connecting to db"
|
#print "Connecting to db"
|
||||||
self.db = None
|
self.db = None
|
||||||
|
dblist = []
|
||||||
|
if hasrclconfig:
|
||||||
|
extradbs = rclconfig.RclExtraDbs(self.config)
|
||||||
|
dblist = extradbs.getActDbs()
|
||||||
try:
|
try:
|
||||||
self.db = recoll.connect()
|
self.db = recoll.connect(extra_dbs=dblist)
|
||||||
self.db.setAbstractParams(maxchars=200, contextwords=4)
|
self.db.setAbstractParams(maxchars=200, contextwords=4)
|
||||||
except Exception, s:
|
except Exception, s:
|
||||||
print >> sys.stderr, "recoll-lens: Error connecting to db:", s
|
print >> sys.stderr, "recoll-lens: Error connecting to db:", s
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue