fix the python module for the new hldata structure
This commit is contained in:
parent
997a01db32
commit
05c4f87aed
@ -1425,8 +1425,9 @@ Query_getgroups(recoll_QueryObject* self, PyObject *, PyObject *)
|
|||||||
// We walk the groups vector. For each we retrieve the user group,
|
// We walk the groups vector. For each we retrieve the user group,
|
||||||
// make a python list of each, then group those in a pair, and
|
// make a python list of each, then group those in a pair, and
|
||||||
// append this to the main list.
|
// append this to the main list.
|
||||||
for (unsigned int i = 0; i < hld.groups.size(); i++) {
|
for (unsigned int i = 0; i < hld.index_term_groups.size(); i++) {
|
||||||
unsigned int ugidx = hld.grpsugidx[i];
|
HighlightData::TermGroup& tg{hld.index_term_groups[i]};
|
||||||
|
unsigned int ugidx = tg.grpsugidx;
|
||||||
ulist = PyList_New(hld.ugroups[ugidx].size());
|
ulist = PyList_New(hld.ugroups[ugidx].size());
|
||||||
for (unsigned int j = 0; j < hld.ugroups[ugidx].size(); j++) {
|
for (unsigned int j = 0; j < hld.ugroups[ugidx].size(); j++) {
|
||||||
PyList_SetItem(ulist, j,
|
PyList_SetItem(ulist, j,
|
||||||
@ -1435,12 +1436,21 @@ Query_getgroups(recoll_QueryObject* self, PyObject *, PyObject *)
|
|||||||
"UTF-8", "replace"));
|
"UTF-8", "replace"));
|
||||||
}
|
}
|
||||||
|
|
||||||
xlist = PyList_New(hld.groups[i].size());
|
// Not sure that this makes any sense after we changed from
|
||||||
for (unsigned int j = 0; j < hld.groups[i].size(); j++) {
|
// multiply_groups to using or-plists. TBD: check
|
||||||
PyList_SetItem(xlist, j,
|
if (tg.kind == HighlightData::TermGroup::TGK_TERM) {
|
||||||
PyUnicode_Decode(hld.groups[i][j].c_str(),
|
xlist = PyList_New(1);
|
||||||
hld.groups[i][j].size(),
|
PyList_SetItem(xlist, 0,
|
||||||
|
PyUnicode_Decode(tg.term.c_str(), tg.term.size(),
|
||||||
"UTF-8", "replace"));
|
"UTF-8", "replace"));
|
||||||
|
} else {
|
||||||
|
xlist = PyList_New(tg.orgroups.size());
|
||||||
|
for (unsigned int j = 0; j < tg.orgroups.size(); j++) {
|
||||||
|
PyList_SetItem(xlist, j,
|
||||||
|
PyUnicode_Decode(tg.orgroups[j][0].c_str(),
|
||||||
|
tg.orgroups[j][0].size(),
|
||||||
|
"UTF-8", "replace"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PyList_Append(mainlist, Py_BuildValue("(OO)", ulist, xlist));
|
PyList_Append(mainlist, Py_BuildValue("(OO)", ulist, xlist));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user