|
a/src/python/samples/recollqsd.py |
|
b/src/python/samples/recollqsd.py |
|
... |
|
... |
10 |
query.sortby("title", 1)
|
10 |
query.sortby("title", 1)
|
11 |
|
11 |
|
12 |
nres = query.executesd(q)
|
12 |
nres = query.executesd(q)
|
13 |
print "Result count: ", nres
|
13 |
print "Result count: ", nres
|
14 |
print "Query: ", query.getxquery().encode('utf-8')
|
14 |
print "Query: ", query.getxquery().encode('utf-8')
|
15 |
sys.exit(0)
|
|
|
16 |
if nres > 10:
|
15 |
if nres > 10:
|
17 |
nres = 10
|
16 |
nres = 10
|
18 |
for i in range(nres):
|
17 |
for i in range(nres):
|
19 |
doc = query.fetchone()
|
18 |
doc = query.fetchone()
|
20 |
print query.next if type(query.next) == int else query.rownumber
|
19 |
print query.next if type(query.next) == int else query.rownumber
|
21 |
for k in ("url", "mtime", "title", "author", "abstract"):
|
20 |
for k in ("url", "mtime", "title", "author", "abstract"):
|
22 |
if getattr(doc, k):
|
21 |
if getattr(doc, k):
|
23 |
print k, ":", getattr(doc, k).encode('utf-8')
|
22 |
print k, ":", getattr(doc, k).encode('utf-8')
|
24 |
else:
|
23 |
else:
|
25 |
print k, ": None"
|
24 |
print k, ": None"
|
26 |
#abs = db.makeDocAbstract(doc, query).encode('utf-8')
|
|
|
27 |
#print abs
|
|
|
28 |
print
|
25 |
print
|
29 |
# End dotest
|
26 |
# End dotest
|
30 |
|
27 |
|
|
|
28 |
# addclause(type='and'|'or'|'filename'|'phrase'|'near'|'path'|'sub'
|
|
|
29 |
# qstring=string, slack=int, field=string, stemming=1|0,
|
|
|
30 |
# subSearch=SearchData, exclude=0|1, anchorstart=0|1, anchorend=0|1
|
|
|
31 |
# casesens=0|1, diacsens=0|1)
|
|
|
32 |
|
31 |
#sd.addclause("and", "dockes", field="author")
|
33 |
#sd.addclause("and", "dockes", field="author")
|
32 |
#sd.addclause("phrase", "jean francois", 1)
|
34 |
#sd.addclause("phrase", "jean francois", 1)
|
33 |
#sd.addclause("excl", "plage")
|
|
|
34 |
|
35 |
|
35 |
db = recoll.connect(confdir="/home/dockes/.recoll-prod")
|
36 |
db = recoll.connect(confdir="/home/dockes/.recoll-prod")
|
36 |
|
37 |
|
37 |
sd = recoll.SearchData(stemlang="english")
|
38 |
sd = recoll.SearchData(stemlang="english")
|
38 |
sd.addclause("and", "dockes", stemming = False, casesens = False, diacsens = True)
|
39 |
sd.addclause('filename', "recollqsd*")
|
39 |
|
40 |
|
40 |
dotest(db, sd)
|
41 |
dotest(db, sd)
|
41 |
|
42 |
|
42 |
sys.exit(0)
|
43 |
sys.exit(0)
|