This commit is contained in:
Jean-Francois Dockes 2020-09-04 16:16:01 +02:00
parent d62bb9016a
commit 7ba8a79ee7

View File

@ -84,11 +84,11 @@ SearchData_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
} }
PyDoc_STRVAR(doc_SearchDataObject, PyDoc_STRVAR(doc_SearchDataObject,
"SearchData([type=AND|OR], [stemlang=somelanguage|null])\n" "SearchData([type=AND|OR], [stemlang=somelanguage|null])\n"
"\n" "\n"
"A SearchData object describes a query. It has a number of global\n" "A SearchData object describes a query. It has a number of global\n"
"parameters and a chain of search clauses.\n" "parameters and a chain of search clauses.\n"
); );
static int static int
SearchData_init(recoll_SearchDataObject *self, PyObject *args, PyObject *kwargs) SearchData_init(recoll_SearchDataObject *self, PyObject *args, PyObject *kwargs)
@ -119,13 +119,13 @@ SearchData_init(recoll_SearchDataObject *self, PyObject *args, PyObject *kwargs)
/* Note: addclause necessite And/Or vient du fait que le string peut avoir /* Note: addclause necessite And/Or vient du fait que le string peut avoir
plusieurs mots. A transferer dans l'i/f Python ou pas ? */ plusieurs mots. A transferer dans l'i/f Python ou pas ? */
PyDoc_STRVAR(doc_addclause, PyDoc_STRVAR(doc_addclause,
"addclause(type='and'|'or'|'filename'|'phrase'|'near'|'path'|'sub',\n" "addclause(type='and'|'or'|'filename'|'phrase'|'near'|'path'|'sub',\n"
" qstring=string, slack=int, field=string, stemming=1|0,\n" " qstring=string, slack=int, field=string, stemming=1|0,\n"
" subSearch=SearchData, exclude=0|1, anchorstart=0|1, anchorend=0|1,\n" " subSearch=SearchData, exclude=0|1, anchorstart=0|1, anchorend=0|1,\n"
" casesens=0|1, diacsens=0|1)\n" " casesens=0|1, diacsens=0|1)\n"
"Adds a simple clause to the SearchData And/Or chain, or a subquery\n" "Adds a simple clause to the SearchData And/Or chain, or a subquery\n"
"defined by another SearchData object\n" "defined by another SearchData object\n"
); );
/* Forward declaration only, definition needs recoll_searchDataType */ /* Forward declaration only, definition needs recoll_searchDataType */
static PyObject * static PyObject *
@ -328,11 +328,11 @@ Doc_init(recoll_DocObject *self, PyObject *, PyObject *)
} }
PyDoc_STRVAR(doc_Doc_getbinurl, PyDoc_STRVAR(doc_Doc_getbinurl,
"getbinurl(none) -> binary url\n" "getbinurl(none) -> binary url\n"
"\n" "\n"
"Returns an URL with a path part which is a as bit for bit copy of the \n" "Returns an URL with a path part which is a as bit for bit copy of the \n"
"file system path, without encoding\n" "file system path, without encoding\n"
); );
static PyObject * static PyObject *
Doc_getbinurl(recoll_DocObject *self) Doc_getbinurl(recoll_DocObject *self)
@ -347,10 +347,10 @@ Doc_getbinurl(recoll_DocObject *self)
} }
PyDoc_STRVAR(doc_Doc_setbinurl, PyDoc_STRVAR(doc_Doc_setbinurl,
"setbinurl(url) -> binary url\n" "setbinurl(url) -> binary url\n"
"\n" "\n"
"Set the URL from binary path like file://may/contain/unencodable/bytes\n" "Set the URL from binary path like file://may/contain/unencodable/bytes\n"
); );
static PyObject * static PyObject *
Doc_setbinurl(recoll_DocObject *self, PyObject *value) Doc_setbinurl(recoll_DocObject *self, PyObject *value)
@ -371,8 +371,8 @@ Doc_setbinurl(recoll_DocObject *self, PyObject *value)
} }
PyDoc_STRVAR(doc_Doc_keys, PyDoc_STRVAR(doc_Doc_keys,
"keys() -> list of doc object keys (attribute names)\n" "keys() -> list of doc object keys (attribute names)\n"
); );
static PyObject * static PyObject *
Doc_keys(recoll_DocObject *self) Doc_keys(recoll_DocObject *self)
{ {
@ -394,8 +394,8 @@ Doc_keys(recoll_DocObject *self)
} }
PyDoc_STRVAR(doc_Doc_items, PyDoc_STRVAR(doc_Doc_items,
"items() -> dictionary of doc object keys/values\n" "items() -> dictionary of doc object keys/values\n"
); );
static PyObject * static PyObject *
Doc_items(recoll_DocObject *self) Doc_items(recoll_DocObject *self)
{ {
@ -501,9 +501,9 @@ static bool idocget(recoll_DocObject *self, const string& key, string& value)
} }
PyDoc_STRVAR(doc_Doc_get, PyDoc_STRVAR(doc_Doc_get,
"get(key) -> value\n" "get(key) -> value\n"
"Retrieve the named doc attribute\n" "Retrieve the named doc attribute\n"
); );
static PyObject * static PyObject *
Doc_get(recoll_DocObject *self, PyObject *args) Doc_get(recoll_DocObject *self, PyObject *args)
{ {
@ -740,41 +740,41 @@ static PyMappingMethods doc_as_mapping = {
PyDoc_STRVAR(doc_DocObject, PyDoc_STRVAR(doc_DocObject,
"Doc()\n" "Doc()\n"
"\n" "\n"
"A Doc object contains index data for a given document.\n" "A Doc object contains index data for a given document.\n"
"The data is extracted from the index when searching, or set by the\n" "The data is extracted from the index when searching, or set by the\n"
"indexer program when updating. The Doc object has no useful methods but\n" "indexer program when updating. The Doc object has no useful methods but\n"
"many attributes to be read or set by its user. It matches exactly the\n" "many attributes to be read or set by its user. It matches exactly the\n"
"Rcl::Doc c++ object. Some of the attributes are predefined, but, \n" "Rcl::Doc c++ object. Some of the attributes are predefined, but, \n"
"especially when indexing, others can be set, the name of which will be\n" "especially when indexing, others can be set, the name of which will be\n"
"processed as field names by the indexing configuration.\n" "processed as field names by the indexing configuration.\n"
"Inputs can be specified as unicode or strings.\n" "Inputs can be specified as unicode or strings.\n"
"Outputs are unicode objects.\n" "Outputs are unicode objects.\n"
"All dates are specified as unix timestamps, printed as strings\n" "All dates are specified as unix timestamps, printed as strings\n"
"Predefined attributes (index/query/both):\n" "Predefined attributes (index/query/both):\n"
" text (index): document plain text\n" " text (index): document plain text\n"
" url (both)\n" " url (both)\n"
" fbytes (both) optional) file size in bytes\n" " fbytes (both) optional) file size in bytes\n"
" filename (both)\n" " filename (both)\n"
" fmtime (both) optional file modification date. Unix time printed \n" " fmtime (both) optional file modification date. Unix time printed \n"
" as string\n" " as string\n"
" dbytes (both) document text bytes\n" " dbytes (both) document text bytes\n"
" dmtime (both) document creation/modification date\n" " dmtime (both) document creation/modification date\n"
" ipath (both) value private to the app.: internal access path\n" " ipath (both) value private to the app.: internal access path\n"
" inside file\n" " inside file\n"
" mtype (both) mime type for original document\n" " mtype (both) mime type for original document\n"
" mtime (query) dmtime if set else fmtime\n" " mtime (query) dmtime if set else fmtime\n"
" origcharset (both) charset the text was converted from\n" " origcharset (both) charset the text was converted from\n"
" size (query) dbytes if set, else fbytes\n" " size (query) dbytes if set, else fbytes\n"
" sig (both) app-defined file modification signature. \n" " sig (both) app-defined file modification signature. \n"
" For up to date checks\n" " For up to date checks\n"
" relevancyrating (query)\n" " relevancyrating (query)\n"
" abstract (both)\n" " abstract (both)\n"
" author (both)\n" " author (both)\n"
" title (both)\n" " title (both)\n"
" keywords (both)\n" " keywords (both)\n"
); );
static PyTypeObject recoll_DocType = { static PyTypeObject recoll_DocType = {
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
"recoll.Doc", /*tp_name*/ "recoll.Doc", /*tp_name*/
@ -841,8 +841,8 @@ typedef struct {
} recoll_QueryObject; } recoll_QueryObject;
PyDoc_STRVAR(doc_Query_close, PyDoc_STRVAR(doc_Query_close,
"close(). Deallocate query. Object is unusable after the call." "close(). Deallocate query. Object is unusable after the call."
); );
static PyObject * static PyObject *
Query_close(recoll_QueryObject *self) Query_close(recoll_QueryObject *self)
{ {
@ -910,11 +910,11 @@ Query_iter(PyObject *self)
} }
PyDoc_STRVAR(doc_Query_sortby, PyDoc_STRVAR(doc_Query_sortby,
"sortby(field=fieldname, ascending=True)\n" "sortby(field=fieldname, ascending=True)\n"
"Sort results by 'fieldname', in ascending or descending order.\n" "Sort results by 'fieldname', in ascending or descending order.\n"
"Only one field can be used, no subsorts for now.\n" "Only one field can be used, no subsorts for now.\n"
"Must be called before executing the search\n" "Must be called before executing the search\n"
); );
static PyObject * static PyObject *
Query_sortby(recoll_QueryObject* self, PyObject *args, PyObject *kwargs) Query_sortby(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
@ -942,14 +942,14 @@ Query_sortby(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
} }
PyDoc_STRVAR(doc_Query_execute, PyDoc_STRVAR(doc_Query_execute,
"execute(query_string, stemming=1|0, stemlang=\"stemming language\", " "execute(query_string, stemming=1|0, stemlang=\"stemming language\", "
"fetchtext=False)\n" "fetchtext=False)\n"
"\n" "\n"
"Starts a search for query_string, a Recoll search language string\n" "Starts a search for query_string, a Recoll search language string\n"
"(mostly Xesam-compatible).\n" "(mostly Xesam-compatible).\n"
"The query can be a simple list of terms (and'ed by default), or more\n" "The query can be a simple list of terms (and'ed by default), or more\n"
"complicated with field specs etc. See the Recoll manual.\n" "complicated with field specs etc. See the Recoll manual.\n"
); );
static PyObject * static PyObject *
Query_execute(recoll_QueryObject* self, PyObject *args, PyObject *kwargs) Query_execute(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
@ -1021,10 +1021,10 @@ Query_execute(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
} }
PyDoc_STRVAR(doc_Query_executesd, PyDoc_STRVAR(doc_Query_executesd,
"executesd(SearchData, fetchtext=False)\n" "executesd(SearchData, fetchtext=False)\n"
"\n" "\n"
"Starts a search for the query defined by the SearchData object.\n" "Starts a search for the query defined by the SearchData object.\n"
); );
static PyObject * static PyObject *
Query_executesd(recoll_QueryObject* self, PyObject *args, PyObject *kwargs) Query_executesd(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
@ -1113,10 +1113,10 @@ Query_iternext(PyObject *_self)
} }
PyDoc_STRVAR(doc_Query_fetchone, PyDoc_STRVAR(doc_Query_fetchone,
"fetchone(None) -> Doc\n" "fetchone(None) -> Doc\n"
"\n" "\n"
"Fetches the next Doc object in the current search results.\n" "Fetches the next Doc object in the current search results.\n"
); );
static PyObject * static PyObject *
Query_fetchone(PyObject *_self) Query_fetchone(PyObject *_self)
{ {
@ -1169,10 +1169,10 @@ Query_fetchmany(PyObject* _self, PyObject *args, PyObject *kwargs)
PyDoc_STRVAR(doc_Query_scroll, PyDoc_STRVAR(doc_Query_scroll,
"scroll(value, [, mode='relative'/'absolute' ]) -> new int position\n" "scroll(value, [, mode='relative'/'absolute' ]) -> new int position\n"
"\n" "\n"
"Adjusts the position in the current result set.\n" "Adjusts the position in the current result set.\n"
); );
static PyObject * static PyObject *
Query_scroll(recoll_QueryObject* self, PyObject *args, PyObject *kwargs) Query_scroll(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
{ {
@ -1210,14 +1210,14 @@ Query_scroll(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
} }
PyDoc_STRVAR(doc_Query_highlight, PyDoc_STRVAR(doc_Query_highlight,
"highlight(text, ishtml = 0/1, methods = object))\n" "highlight(text, ishtml = 0/1, methods = object))\n"
"Will insert <span \"class=rclmatch\"></span> tags around the match areas\n" "Will insert <span \"class=rclmatch\"></span> tags around the match areas\n"
"in the input text and return the modified text\n" "in the input text and return the modified text\n"
"ishtml can be set to indicate that the input text is html and html special\n" "ishtml can be set to indicate that the input text is html and html special\n"
" characters should not be escaped\n" " characters should not be escaped\n"
"methods if set should be an object with methods startMatch(i) and endMatch()\n" "methods if set should be an object with methods startMatch(i) and endMatch()\n"
" which will be called for each match and should return a begin and end tag\n" " which will be called for each match and should return a begin and end tag\n"
); );
class PyPlainToRich: public PlainToRich { class PyPlainToRich: public PlainToRich {
public: public:
@ -1314,11 +1314,11 @@ Query_highlight(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
} }
PyDoc_STRVAR(doc_Query_makedocabstract, PyDoc_STRVAR(doc_Query_makedocabstract,
"makedocabstract(doc, methods = object))\n" "makedocabstract(doc, methods = object))\n"
"Will create a snippets abstract for doc by selecting text around the match\n" "Will create a snippets abstract for doc by selecting text around the match\n"
" terms\n" " terms\n"
"If methods is set, will also perform highlighting. See the highlight method\n" "If methods is set, will also perform highlighting. See the highlight method\n"
); );
static PyObject * static PyObject *
Query_makedocabstract(recoll_QueryObject* self, PyObject *args,PyObject *kwargs) Query_makedocabstract(recoll_QueryObject* self, PyObject *args,PyObject *kwargs)
{ {
@ -1384,11 +1384,11 @@ Query_makedocabstract(recoll_QueryObject* self, PyObject *args,PyObject *kwargs)
} }
PyDoc_STRVAR(doc_Query_getxquery, PyDoc_STRVAR(doc_Query_getxquery,
"getxquery(None) -> Unicode string\n" "getxquery(None) -> Unicode string\n"
"\n" "\n"
"Retrieves the Xapian query description as a Unicode string.\n" "Retrieves the Xapian query description as a Unicode string.\n"
"Meaningful only after executexx\n" "Meaningful only after executexx\n"
); );
static PyObject * static PyObject *
Query_getxquery(recoll_QueryObject* self, PyObject *, PyObject *) Query_getxquery(recoll_QueryObject* self, PyObject *, PyObject *)
{ {
@ -1408,14 +1408,14 @@ Query_getxquery(recoll_QueryObject* self, PyObject *, PyObject *)
} }
PyDoc_STRVAR(doc_Query_getgroups, PyDoc_STRVAR(doc_Query_getgroups,
"getgroups(None) -> a list of pairs\n" "getgroups(None) -> a list of pairs\n"
"\n" "\n"
"Retrieves the expanded query terms. Meaningful only after executexx\n" "Retrieves the expanded query terms. Meaningful only after executexx\n"
"In each pair, the first entry is a list of user terms, the second a list of\n" "In each pair, the first entry is a list of user terms, the second a list of\n"
"query terms as derived from the user terms and used in the Xapian Query.\n" "query terms as derived from the user terms and used in the Xapian Query.\n"
"The size of each list is one for simple terms, or more for group and phrase\n" "The size of each list is one for simple terms, or more for group and phrase\n"
"clauses\n" "clauses\n"
); );
static PyObject * static PyObject *
Query_getgroups(recoll_QueryObject* self, PyObject *, PyObject *) Query_getgroups(recoll_QueryObject* self, PyObject *, PyObject *)
{ {
@ -1517,8 +1517,8 @@ static PyMemberDef Query_members[] = {
}; };
PyDoc_STRVAR(doc_QueryObject, PyDoc_STRVAR(doc_QueryObject,
"Recoll Query objects are used to execute index searches. \n" "Recoll Query objects are used to execute index searches. \n"
"They must be created by the Db.query() method.\n" "They must be created by the Db.query() method.\n"
); );
static PyTypeObject recoll_QueryType = { static PyTypeObject recoll_QueryType = {
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
@ -1779,11 +1779,11 @@ PyDoc_STRVAR(
"termMatch(match_type='wildcard|regexp|stem', expr, field='', " "termMatch(match_type='wildcard|regexp|stem', expr, field='', "
"maxlen=-1, casesens=False, diacsens=False, lang='english', freqs=False)" "maxlen=-1, casesens=False, diacsens=False, lang='english', freqs=False)"
" returns the expanded term list\n" " returns the expanded term list\n"
"\n" "\n"
"Expands the input expression according to the mode and parameters and " "Expands the input expression according to the mode and parameters and "
"returns the expanded term list, as raw terms if freqs is False, or " "returns the expanded term list, as raw terms if freqs is False, or "
"(term, totcnt, docnt) tuples if freqs is True.\n" "(term, totcnt, docnt) tuples if freqs is True.\n"
); );
static PyObject * static PyObject *
Db_termMatch(recoll_DbObject* self, PyObject *args, PyObject *kwargs) Db_termMatch(recoll_DbObject* self, PyObject *args, PyObject *kwargs)
{ {
@ -2014,15 +2014,15 @@ static PyMethodDef Db_methods[] = {
{NULL} /* Sentinel */ {NULL} /* Sentinel */
}; };
PyDoc_STRVAR(doc_DbObject, PyDoc_STRVAR(doc_DbObject,
"Db([confdir=None], [extra_dbs=None], [writable = False])\n" "Db([confdir=None], [extra_dbs=None], [writable = False])\n"
"\n" "\n"
"A Db object holds a connection to a Recoll index. Use the connect()\n" "A Db object holds a connection to a Recoll index. Use the connect()\n"
"function to create one.\n" "function to create one.\n"
"confdir specifies a Recoll configuration directory (default: \n" "confdir specifies a Recoll configuration directory (default: \n"
" $RECOLL_CONFDIR or ~/.recoll).\n" " $RECOLL_CONFDIR or ~/.recoll).\n"
"extra_dbs is a list of external databases (xapian directories)\n" "extra_dbs is a list of external databases (xapian directories)\n"
"writable decides if we can index new data through this connection\n" "writable decides if we can index new data through this connection\n"
); );
static PyTypeObject recoll_DbType = { static PyTypeObject recoll_DbType = {
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
"recoll.Db", /*tp_name*/ "recoll.Db", /*tp_name*/
@ -2077,15 +2077,15 @@ recoll_connect(PyObject *self, PyObject *args, PyObject *kwargs)
} }
PyDoc_STRVAR(doc_connect, PyDoc_STRVAR(doc_connect,
"connect([confdir=None], [extra_dbs=None], [writable = False])\n" "connect([confdir=None], [extra_dbs=None], [writable = False])\n"
" -> Db.\n" " -> Db.\n"
"\n" "\n"
"Connects to a Recoll database and returns a Db object.\n" "Connects to a Recoll database and returns a Db object.\n"
"confdir specifies a Recoll configuration directory\n" "confdir specifies a Recoll configuration directory\n"
"(the default is built like for any Recoll program).\n" "(the default is built like for any Recoll program).\n"
"extra_dbs is a list of external databases (xapian directories)\n" "extra_dbs is a list of external databases (xapian directories)\n"
"writable decides if we can index new data through this connection\n" "writable decides if we can index new data through this connection\n"
); );
static PyMethodDef recoll_methods[] = { static PyMethodDef recoll_methods[] = {
{"connect", (PyCFunction)recoll_connect, METH_VARARGS|METH_KEYWORDS, {"connect", (PyCFunction)recoll_connect, METH_VARARGS|METH_KEYWORDS,
@ -2096,7 +2096,7 @@ static PyMethodDef recoll_methods[] = {
PyDoc_STRVAR(pyrecoll_doc_string, PyDoc_STRVAR(pyrecoll_doc_string,
"This is an interface to the Recoll full text indexer."); "This is an interface to the Recoll full text indexer.");
struct module_state { struct module_state {
PyObject *error; PyObject *error;
@ -2140,8 +2140,8 @@ PyInit_recoll(void)
#else #else
#define INITERROR return #define INITERROR return
PyMODINIT_FUNC PyMODINIT_FUNC
initrecoll(void) initrecoll(void)
#endif #endif
{ {
// Note: we can't call recollinit here, because the confdir is only really // Note: we can't call recollinit here, because the confdir is only really