updated python searchdata object to match current C++ interface

This commit is contained in:
Jean-Francois Dockes
2013-03-01 11:50:35 +01:00
parent 66a5d9ab83
commit b0e296235f
3 changed files with 90 additions and 52 deletions
+12 -5
View File
@@ -3,7 +3,7 @@
Not good for anything except showing/trying the code."""
import sys
import recoll
from recoll import recoll
def dotest(db, q):
query = db.query()
@@ -11,25 +11,32 @@ def dotest(db, q):
nres = query.executesd(q)
print "Result count: ", nres
print "Query: ", query.getxquery().encode('utf-8')
sys.exit(0)
if nres > 10:
nres = 10
for i in range(nres):
doc = query.fetchone()
print query.next if type(query.next) == int else query.rownumber
for k in ("url", "mtime", "title", "author", "abstract"):
print k, ":", getattr(doc, k).encode('utf-8')
if getattr(doc, k):
print k, ":", getattr(doc, k).encode('utf-8')
else:
print k, ": None"
#abs = db.makeDocAbstract(doc, query).encode('utf-8')
#print abs
print
# End dotest
sd = recoll.SearchData()
sd.addclause("and", "essaouira maroc")
#sd.addclause("and", "dockes", field="author")
#sd.addclause("phrase", "jean francois", 1)
#sd.addclause("excl", "plage")
db = recoll.connect()
db = recoll.connect(confdir="/home/dockes/.recoll-prod")
sd = recoll.SearchData(stemlang="english")
sd.addclause("and", "dockes", stemming = False, casesens = False, diacsens = True)
dotest(db, sd)
sys.exit(0)