Switch to unified view

a/src/python/samples/recollq.py b/src/python/samples/recollq.py
...
...
14
def Usage():
14
def Usage():
15
    print >> sys.stderr, "Usage: recollq.py [-c conf] [-i extra_index] <recoll query>"
15
    print >> sys.stderr, "Usage: recollq.py [-c conf] [-i extra_index] <recoll query>"
16
    sys.exit(1);
16
    sys.exit(1);
17
17
18
def doquery(db, q):
18
def doquery(db, q):
19
    """Parse and execute query on open db"""
20
    # Get query object
19
    # Get query object
21
    query = db.query()
20
    query = db.query()
22
    # Parse/run input query string
21
    # Parse/run input query string
23
    nres = query.execute(q)
22
    nres = query.execute(q)
24
23
25
    # Print results:
24
    # Print results:
26
    print "Result count: ", nres
25
    print "Result count: ", nres
27
    while query.next >= 0 and query.next < nres: 
26
    while query.next >= 0 and query.next < nres: 
28
        doc = query.fetchone()
27
        doc = query.fetchone()
29
        print query.next, ":",
28
        print query.next, ":",
30
        for k in ("title", "url", "mtime"):
29
        for k in ("title", "mtime", "author"):
31
            print k, ":", getattr(doc, k).encode('utf-8')
30
            print k, ":", getattr(doc, k).encode('utf-8')
31
        print "Bin URL :", doc.getbinurl()
32
        abs = db.makeDocAbstract(doc, query).encode('utf-8')
32
        abs = db.makeDocAbstract(doc, query).encode('utf-8')
33
        print abs
33
        print abs
34
        print
34
        print
35
35
36
36