fixed python scripts for next->rownumber Query change
This commit is contained in:
parent
df53e7e656
commit
9eb77d032c
@ -215,7 +215,7 @@ class Scope (Unity.Scope):
|
||||
return
|
||||
|
||||
actual_results = 0
|
||||
while query.next >= 0 and query.next < nres:
|
||||
for i in range(nres):
|
||||
try:
|
||||
doc = query.fetchone()
|
||||
except:
|
||||
|
||||
@ -1376,7 +1376,7 @@ static PyTypeObject recoll_QueryType = {
|
||||
0, /*tp_getattro*/
|
||||
0, /*tp_setattro*/
|
||||
0, /*tp_as_buffer*/
|
||||
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
|
||||
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_ITER, /*tp_flags*/
|
||||
doc_QueryObject, /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
|
||||
@ -136,12 +136,11 @@ class RecollQuery(QtCore.QAbstractTableModel):
|
||||
#print "RecollQuery.fetchMore:"
|
||||
self.beginInsertRows(QtCore.QModelIndex(), len(self.docs), \
|
||||
len(self.docs) + self.pagelen)
|
||||
count = 0
|
||||
while self.query.next >= 0 and self.query.next < self.totres \
|
||||
and count < self.pagelen:
|
||||
#print "Got: ", title.encode("utf-8")
|
||||
self.docs.append(self.query.fetchone())
|
||||
count += 1
|
||||
for count in range(self.pagelen):
|
||||
try:
|
||||
self.docs.append(self.query.fetchone())
|
||||
except:
|
||||
break
|
||||
self.endInsertRows()
|
||||
|
||||
|
||||
|
||||
@ -59,11 +59,14 @@ def doquery(db, q):
|
||||
print "Result count: ", nres, query.rowcount
|
||||
if nres > 20:
|
||||
nres = 20
|
||||
results = query.fetchmany(nres)
|
||||
for doc in results:
|
||||
# while query.next >= 0 and query.next < nres:
|
||||
# doc = query.fetchone()
|
||||
# print query.next, ":",
|
||||
#results = query.fetchmany(nres)
|
||||
#for doc in results:
|
||||
|
||||
for i in range(nres):
|
||||
doc = query.fetchone()
|
||||
rownum = query.next if type(query.next) == int else \
|
||||
query.rownumber
|
||||
print rownum, ":",
|
||||
#for k,v in doc.items().items():
|
||||
#print "KEY:", k.encode('utf-8'), "VALUE", v.encode('utf-8')
|
||||
#continue
|
||||
|
||||
@ -13,9 +13,9 @@ def dotest(db, q):
|
||||
print "Result count: ", nres
|
||||
if nres > 10:
|
||||
nres = 10
|
||||
while query.next >= 0 and query.next < nres:
|
||||
for i in range(nres):
|
||||
doc = query.fetchone()
|
||||
print query.next
|
||||
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')
|
||||
#abs = db.makeDocAbstract(doc, query).encode('utf-8')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user