diff --git a/src/doc/user/usermanual.html b/src/doc/user/usermanual.html index 2957ed0d..22bf4179 100644 --- a/src/doc/user/usermanual.html +++ b/src/doc/user/usermanual.html @@ -6681,7 +6681,8 @@ text/html [file:///Users/uncrypted-dockes/projets/bateaux/ilur/factEtCie/r
The Recoll Python programming interface can be used both for searching and for creating/updating an index. Bindings exist for - Python2 and Python3.
+ Python2 and Python3 (Jan 2021: python2 support will be + dropped soon).The search interface is used in a number of active
projects: the
You can also take a look at the source for the
The You need to import the Adapting to the new package structure: Adapting to the change of nature of the
- #!/usr/bin/env python
+#!/usr/bin/python3
- from recoll import recoll
+from recoll import recoll
- db = recoll.connect()
- query = db.query()
- nres = query.execute("some query")
- results = query.fetchmany(20)
- for doc in results:
- print("%s %s" % (doc.url, doc.title))
-
+db = recoll.connect()
+query = db.query()
+nres = query.execute("some query")
+results = query.fetchmany(20)
+for doc in results:
+ print("%s %s" % (doc.url, doc.title))
+
rclextract module
can give access to the original document and to the
document text content (if not stored by the index, or
- to access an HTML version of the text). Acessing the
+ to access an HTML version of the text). Accessing the
original document is particularly useful if it is
embedded (e.g. an email attachment).
-#!/usr/bin/env python
+#!/usr/bin/python3
from recoll import recoll
@@ -7455,17 +7456,15 @@ db.setAbstractParams(maxchars=80, contextwords=4)
query = db.query()
nres = query.execute("some user question")
-print "Result count: ", nres
+print("Result count: %d" % nres)
if nres > 5:
nres = 5
for i in range(nres):
doc = query.fetchone()
- print "Result #%d" % (query.rownumber,)
+ print("Result #%d" % (query.rownumber))
for k in ("title", "size"):
- print k, ":", getattr(doc, k).encode('utf-8')
- abs = db.makeDocAbstract(doc, query).encode('utf-8')
- print abs
- print
+ print("%s : %s" % (k, getattr(doc, k)))
+ print("%s\n" % db.makeDocAbstract(doc, query))
@@ -7651,9 +7650,9 @@ for i in range(nres):
Recoll source (which sets rclbes="MBOX"):[MBOX]
- fetch = /path/to/recoll/src/python/samples/rclmbox.py fetch
- makesig = path/to/recoll/src/python/samples/rclmbox.py makesig
-
+fetch = /path/to/recoll/src/python/samples/rclmbox.py fetch
+makesig = path/to/recoll/src/python/samples/rclmbox.py makesig
+
fetch and makesig define two commands to execute
to respectively retrieve the document text and compute
@@ -7708,27 +7707,21 @@ for i in range(nres):
of course).
-
- try:
- from recoll import recoll
- from recoll import rclextract
- hasextract = True
- except:
- import recoll
- hasextract = False
-
-
+try:
+from recoll import recoll
+from recoll import rclextract
+hasextract = True
+except:
+import recoll
+hasextract = False
+
next Query
member. The same test can be used to choose to use the
scroll() method (new) or set
the next value (old).
-
- rownum = query.next if type(query.next) == int else \
- query.rownumber
-
-
+ rownum = query.next if type(query.next) == int else query.rownumber
diff --git a/src/doc/user/usermanual.xml b/src/doc/user/usermanual.xml
index 508dfaf9..3ed1a898 100644
--- a/src/doc/user/usermanual.xml
+++ b/src/doc/user/usermanual.xml
@@ -5144,7 +5144,8 @@ text/html [file:///Users/uncrypted-dockes/projets/bateaux/ilur/factEtCie/r