This commit is contained in:
Jean-Francois Dockes 2012-12-29 08:44:00 +01:00
parent 1384cd3d05
commit 5725194a00
3 changed files with 12 additions and 12 deletions

View File

@ -1,5 +1,7 @@
all: all:
python setup.py build python setup.py build
install:
sudo python setup.py install
clean: clean:
rm -rf build rm -rf build
distclean: clean distclean: clean

View File

@ -253,8 +253,7 @@ Doc_dealloc(recoll_DocObject *self)
LOGDEB(("Doc_dealloc\n")); LOGDEB(("Doc_dealloc\n"));
if (self->doc) if (self->doc)
the_docs.erase(self->doc); the_docs.erase(self->doc);
delete self->doc; deleteZ(self->doc);
self->doc = 0;
self->ob_type->tp_free((PyObject*)self); self->ob_type->tp_free((PyObject*)self);
} }
@ -268,6 +267,7 @@ Doc_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (self == 0) if (self == 0)
return 0; return 0;
self->doc = 0; self->doc = 0;
self->rclconfig = 0;
return (PyObject *)self; return (PyObject *)self;
} }
@ -344,6 +344,8 @@ Doc_keys(recoll_DocObject *self)
} }
PyObject *pkeys = PyList_New(0); PyObject *pkeys = PyList_New(0);
if (!pkeys)
return 0;
for (map<string,string>::const_iterator it = self->doc->meta.begin(); for (map<string,string>::const_iterator it = self->doc->meta.begin();
it != self->doc->meta.end(); it++) { it != self->doc->meta.end(); it++) {
PyList_Append(pkeys, PyUnicode_Decode(it->first.c_str(), PyList_Append(pkeys, PyUnicode_Decode(it->first.c_str(),
@ -367,6 +369,8 @@ Doc_items(recoll_DocObject *self)
} }
PyObject *pdict = PyDict_New(); PyObject *pdict = PyDict_New();
if (!pdict)
return 0;
for (map<string,string>::const_iterator it = self->doc->meta.begin(); for (map<string,string>::const_iterator it = self->doc->meta.begin();
it != self->doc->meta.end(); it++) { it != self->doc->meta.end(); it++) {
PyDict_SetItem(pdict, PyDict_SetItem(pdict,
@ -384,7 +388,6 @@ 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)
{ {
@ -430,12 +433,6 @@ Doc_getattr(recoll_DocObject *self, char *name)
PyErr_SetString(PyExc_AttributeError, "doc"); PyErr_SetString(PyExc_AttributeError, "doc");
return 0; return 0;
} }
#if 0
for (map<string,string>::const_iterator it = self->doc->meta.begin();
it != self->doc->meta.end(); it++) {
LOGDEB(("meta[%s] -> [%s]\n", it->first.c_str(), it->second.c_str()));
}
#endif
string key = rclconfig->fieldCanon(string(name)); string key = rclconfig->fieldCanon(string(name));
// Handle special cases, then check this is not a method then // Handle special cases, then check this is not a method then
@ -698,8 +695,8 @@ static PyTypeObject recoll_DocType = {
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
/// QUERY Query object /// QUERY Query object
struct recoll_DbObject;
struct recoll_DbObject;
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
/* Type-specific fields go here. */ /* Type-specific fields go here. */
@ -747,8 +744,9 @@ Query_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
self->query = 0; self->query = 0;
self->next = -1; self->next = -1;
self->rowcount = -1; self->rowcount = -1;
self->arraysize = 1;
self->sortfield = new string; self->sortfield = new string;
self->ascending = 1;
self->arraysize = 1;
self->connection = 0; self->connection = 0;
return (PyObject *)self; return (PyObject *)self;
} }

View File

@ -45,7 +45,7 @@ def extractofile(doc, outfilename=""):
def doquery(db, q): def doquery(db, q):
# Get query object # Get query object
query = db.query() query = db.query()
query.sortby("dmtime", ascending=True) #query.sortby("dmtime", ascending=True)
# Parse/run input query string # Parse/run input query string
nres = query.execute(q, stemming = 0, stemlang="english") nres = query.execute(q, stemming = 0, stemlang="english")