|
a/src/rcldb/searchdataxml.cpp |
|
b/src/rcldb/searchdataxml.cpp |
|
... |
|
... |
54 |
// Searchdata
|
54 |
// Searchdata
|
55 |
os << "<SD>" << endl;
|
55 |
os << "<SD>" << endl;
|
56 |
|
56 |
|
57 |
// Clause list
|
57 |
// Clause list
|
58 |
os << "<CL>" << endl;
|
58 |
os << "<CL>" << endl;
|
|
|
59 |
|
|
|
60 |
// List conjunction: default is AND, else print it.
|
59 |
if (m_tp != SCLT_AND)
|
61 |
if (m_tp != SCLT_AND)
|
60 |
os << "<CLT>" << tpToString(m_tp) << "</CLT>" << endl;
|
62 |
os << "<CLT>" << tpToString(m_tp) << "</CLT>" << endl;
|
|
|
63 |
|
61 |
for (unsigned int i = 0; i < m_query.size(); i++) {
|
64 |
for (unsigned int i = 0; i < m_query.size(); i++) {
|
62 |
SearchDataClause *c = m_query[i];
|
65 |
SearchDataClause *c = m_query[i];
|
63 |
if (c->getTp() == SCLT_SUB) {
|
66 |
if (c->getTp() == SCLT_SUB) {
|
64 |
LOGERR(("SearchData::asXML: can't do subclauses !\n"));
|
67 |
LOGERR(("SearchData::asXML: can't do subclauses !\n"));
|
65 |
continue;
|
68 |
continue;
|
66 |
}
|
69 |
}
|
67 |
if (c->getexclude())
|
|
|
68 |
os << "<NEG/>" << endl;
|
|
|
69 |
if (c->getTp() == SCLT_PATH) {
|
70 |
if (c->getTp() == SCLT_PATH) {
|
70 |
// Keep these apart, for compat with the older history format
|
71 |
// Keep these apart, for compat with the older history format. NEG
|
|
|
72 |
// is ignored here, we have 2 different tags instead.
|
71 |
SearchDataClausePath *cl =
|
73 |
SearchDataClausePath *cl =
|
72 |
dynamic_cast<SearchDataClausePath*>(c);
|
74 |
dynamic_cast<SearchDataClausePath*>(c);
|
73 |
if (cl->getexclude()) {
|
75 |
if (cl->getexclude()) {
|
74 |
os << "<ND>" << base64_encode(cl->gettext()) << "</ND>" << endl;
|
76 |
os << "<ND>" << base64_encode(cl->gettext()) << "</ND>" << endl;
|
75 |
} else {
|
77 |
} else {
|
76 |
os << "<YD>" << base64_encode(cl->gettext()) << "</YD>" << endl;
|
78 |
os << "<YD>" << base64_encode(cl->gettext()) << "</YD>" << endl;
|
77 |
}
|
79 |
}
|
78 |
continue;
|
80 |
continue;
|
|
|
81 |
} else {
|
|
|
82 |
|
|
|
83 |
os << "<C>" << endl;
|
|
|
84 |
|
|
|
85 |
if (c->getexclude())
|
|
|
86 |
os << "<NEG/>" << endl;
|
|
|
87 |
|
|
|
88 |
if (c->getTp() != SCLT_AND) {
|
|
|
89 |
os << "<CT>" << tpToString(c->getTp()) << "</CT>" << endl;
|
|
|
90 |
}
|
|
|
91 |
if (c->getTp() == SCLT_FILENAME) {
|
|
|
92 |
SearchDataClauseFilename *cl =
|
|
|
93 |
dynamic_cast<SearchDataClauseFilename*>(c);
|
|
|
94 |
os << "<T>" << base64_encode(cl->gettext()) << "</T>" << endl;
|
|
|
95 |
} else {
|
|
|
96 |
SearchDataClauseSimple *cl =
|
|
|
97 |
dynamic_cast<SearchDataClauseSimple*>(c);
|
|
|
98 |
if (!cl->getfield().empty()) {
|
|
|
99 |
os << "<F>" << base64_encode(cl->getfield()) << "</F>" <<
|
|
|
100 |
endl;
|
|
|
101 |
}
|
|
|
102 |
os << "<T>" << base64_encode(cl->gettext()) << "</T>" << endl;
|
|
|
103 |
if (cl->getTp() == SCLT_NEAR || cl->getTp() == SCLT_PHRASE) {
|
|
|
104 |
SearchDataClauseDist *cld =
|
|
|
105 |
dynamic_cast<SearchDataClauseDist*>(cl);
|
|
|
106 |
os << "<S>" << cld->getslack() << "</S>" << endl;
|
|
|
107 |
}
|
|
|
108 |
}
|
|
|
109 |
os << "</C>" << endl;
|
79 |
}
|
110 |
}
|
80 |
|
|
|
81 |
SearchDataClauseSimple *cl =
|
|
|
82 |
dynamic_cast<SearchDataClauseSimple*>(c);
|
|
|
83 |
os << "<C>" << endl;
|
|
|
84 |
if (cl->getTp() != SCLT_AND) {
|
|
|
85 |
os << "<CT>" << tpToString(cl->getTp()) << "</CT>" << endl;
|
|
|
86 |
}
|
|
|
87 |
if (cl->getTp() != SCLT_FILENAME && !cl->getfield().empty()) {
|
|
|
88 |
os << "<F>" << base64_encode(cl->getfield()) << "</F>" << endl;
|
|
|
89 |
}
|
|
|
90 |
os << "<T>" << base64_encode(cl->gettext()) << "</T>" << endl;
|
|
|
91 |
if (cl->getTp() == SCLT_NEAR || cl->getTp() == SCLT_PHRASE) {
|
|
|
92 |
SearchDataClauseDist *cld =
|
|
|
93 |
dynamic_cast<SearchDataClauseDist*>(cl);
|
|
|
94 |
os << "<S>" << cld->getslack() << "</S>" << endl;
|
|
|
95 |
}
|
|
|
96 |
os << "</C>" << endl;
|
|
|
97 |
}
|
111 |
}
|
98 |
os << "</CL>" << endl;
|
112 |
os << "</CL>" << endl;
|
99 |
|
113 |
|
100 |
if (m_haveDates) {
|
114 |
if (m_haveDates) {
|
101 |
if (m_dates.y1 > 0) {
|
115 |
if (m_dates.y1 > 0) {
|