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