|
a/src/python/recoll/pyrecoll.cpp |
|
b/src/python/recoll/pyrecoll.cpp |
|
... |
|
... |
54 |
//////////////////////////////////////////////////////////////////////
|
54 |
//////////////////////////////////////////////////////////////////////
|
55 |
/// SEARCHDATA SearchData code
|
55 |
/// SEARCHDATA SearchData code
|
56 |
typedef struct {
|
56 |
typedef struct {
|
57 |
PyObject_HEAD
|
57 |
PyObject_HEAD
|
58 |
/* Type-specific fields go here. */
|
58 |
/* Type-specific fields go here. */
|
59 |
STD_SHARED_PTR<Rcl::SearchData> sd;
|
59 |
std::shared_ptr<Rcl::SearchData> sd;
|
60 |
} recoll_SearchDataObject;
|
60 |
} recoll_SearchDataObject;
|
61 |
|
61 |
|
62 |
static void
|
62 |
static void
|
63 |
SearchData_dealloc(recoll_SearchDataObject *self)
|
63 |
SearchData_dealloc(recoll_SearchDataObject *self)
|
64 |
{
|
64 |
{
|
|
... |
|
... |
106 |
if (steml) {
|
106 |
if (steml) {
|
107 |
stemlang = steml;
|
107 |
stemlang = steml;
|
108 |
} else {
|
108 |
} else {
|
109 |
stemlang = "english";
|
109 |
stemlang = "english";
|
110 |
}
|
110 |
}
|
111 |
self->sd = STD_SHARED_PTR<Rcl::SearchData>(new Rcl::SearchData(tp, stemlang));
|
111 |
self->sd = std::shared_ptr<Rcl::SearchData>(new Rcl::SearchData(tp, stemlang));
|
112 |
return 0;
|
112 |
return 0;
|
113 |
}
|
113 |
}
|
114 |
|
114 |
|
115 |
/* Note: addclause necessite And/Or vient du fait que le string peut avoir
|
115 |
/* Note: addclause necessite And/Or vient du fait que le string peut avoir
|
116 |
plusieurs mots. A transferer dans l'i/f Python ou pas ? */
|
116 |
plusieurs mots. A transferer dans l'i/f Python ou pas ? */
|
|
... |
|
... |
951 |
if (!sd) {
|
951 |
if (!sd) {
|
952 |
PyErr_SetString(PyExc_ValueError, reason.c_str());
|
952 |
PyErr_SetString(PyExc_ValueError, reason.c_str());
|
953 |
return 0;
|
953 |
return 0;
|
954 |
}
|
954 |
}
|
955 |
|
955 |
|
956 |
STD_SHARED_PTR<Rcl::SearchData> rq(sd);
|
956 |
std::shared_ptr<Rcl::SearchData> rq(sd);
|
957 |
self->query->setSortBy(*self->sortfield, self->ascending);
|
957 |
self->query->setSortBy(*self->sortfield, self->ascending);
|
958 |
self->query->setQuery(rq);
|
958 |
self->query->setQuery(rq);
|
959 |
int cnt = self->query->getResCnt();
|
959 |
int cnt = self->query->getResCnt();
|
960 |
self->next = 0;
|
960 |
self->next = 0;
|
961 |
self->rowcount = cnt;
|
961 |
self->rowcount = cnt;
|
|
... |
|
... |
1219 |
the_queries.find(self->query) == the_queries.end()) {
|
1219 |
the_queries.find(self->query) == the_queries.end()) {
|
1220 |
PyErr_SetString(PyExc_AttributeError, "query");
|
1220 |
PyErr_SetString(PyExc_AttributeError, "query");
|
1221 |
return 0;
|
1221 |
return 0;
|
1222 |
}
|
1222 |
}
|
1223 |
|
1223 |
|
1224 |
STD_SHARED_PTR<Rcl::SearchData> sd = self->query->getSD();
|
1224 |
std::shared_ptr<Rcl::SearchData> sd = self->query->getSD();
|
1225 |
if (!sd) {
|
1225 |
if (!sd) {
|
1226 |
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
1226 |
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
1227 |
return 0;
|
1227 |
return 0;
|
1228 |
}
|
1228 |
}
|
1229 |
HighlightData hldata;
|
1229 |
HighlightData hldata;
|
|
... |
|
... |
1270 |
if (the_queries.find(self->query) == the_queries.end()) {
|
1270 |
if (the_queries.find(self->query) == the_queries.end()) {
|
1271 |
LOGERR("Query_makeDocAbstract: query not found " << (self->query) << "\n" );
|
1271 |
LOGERR("Query_makeDocAbstract: query not found " << (self->query) << "\n" );
|
1272 |
PyErr_SetString(PyExc_AttributeError, "query");
|
1272 |
PyErr_SetString(PyExc_AttributeError, "query");
|
1273 |
return 0;
|
1273 |
return 0;
|
1274 |
}
|
1274 |
}
|
1275 |
STD_SHARED_PTR<Rcl::SearchData> sd = self->query->getSD();
|
1275 |
std::shared_ptr<Rcl::SearchData> sd = self->query->getSD();
|
1276 |
if (!sd) {
|
1276 |
if (!sd) {
|
1277 |
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
1277 |
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
1278 |
return 0;
|
1278 |
return 0;
|
1279 |
}
|
1279 |
}
|
1280 |
string abstract;
|
1280 |
string abstract;
|
|
... |
|
... |
1326 |
if (self->query == 0 ||
|
1326 |
if (self->query == 0 ||
|
1327 |
the_queries.find(self->query) == the_queries.end()) {
|
1327 |
the_queries.find(self->query) == the_queries.end()) {
|
1328 |
PyErr_SetString(PyExc_AttributeError, "query");
|
1328 |
PyErr_SetString(PyExc_AttributeError, "query");
|
1329 |
return 0;
|
1329 |
return 0;
|
1330 |
}
|
1330 |
}
|
1331 |
STD_SHARED_PTR<Rcl::SearchData> sd = self->query->getSD();
|
1331 |
std::shared_ptr<Rcl::SearchData> sd = self->query->getSD();
|
1332 |
if (!sd) {
|
1332 |
if (!sd) {
|
1333 |
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
1333 |
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
1334 |
return 0;
|
1334 |
return 0;
|
1335 |
}
|
1335 |
}
|
1336 |
string desc = sd->getDescription();
|
1336 |
string desc = sd->getDescription();
|
|
... |
|
... |
1354 |
if (self->query == 0 ||
|
1354 |
if (self->query == 0 ||
|
1355 |
the_queries.find(self->query) == the_queries.end()) {
|
1355 |
the_queries.find(self->query) == the_queries.end()) {
|
1356 |
PyErr_SetString(PyExc_AttributeError, "query");
|
1356 |
PyErr_SetString(PyExc_AttributeError, "query");
|
1357 |
return 0;
|
1357 |
return 0;
|
1358 |
}
|
1358 |
}
|
1359 |
STD_SHARED_PTR<Rcl::SearchData> sd = self->query->getSD();
|
1359 |
std::shared_ptr<Rcl::SearchData> sd = self->query->getSD();
|
1360 |
if (!sd) {
|
1360 |
if (!sd) {
|
1361 |
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
1361 |
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
1362 |
return 0;
|
1362 |
return 0;
|
1363 |
}
|
1363 |
}
|
1364 |
HighlightData hld;
|
1364 |
HighlightData hld;
|