|
a/src/rcldb/rclquery.cpp |
|
b/src/rcldb/rclquery.cpp |
|
... |
|
... |
87 |
private:
|
87 |
private:
|
88 |
string m_fld;
|
88 |
string m_fld;
|
89 |
};
|
89 |
};
|
90 |
|
90 |
|
91 |
Query::Query(Db *db)
|
91 |
Query::Query(Db *db)
|
92 |
: m_nq(new Native(this)), m_db(db), m_sorter(0), m_sortAscending(true)
|
92 |
: m_nq(new Native(this)), m_db(db), m_sorter(0), m_sortAscending(true),
|
|
|
93 |
m_collapseDuplicates(false)
|
93 |
{
|
94 |
{
|
94 |
}
|
95 |
}
|
95 |
|
96 |
|
96 |
Query::~Query()
|
97 |
Query::~Query()
|
97 |
{
|
98 |
{
|
|
... |
|
... |
153 |
m_nq->query = xq;
|
154 |
m_nq->query = xq;
|
154 |
string ermsg;
|
155 |
string ermsg;
|
155 |
string d;
|
156 |
string d;
|
156 |
try {
|
157 |
try {
|
157 |
m_nq->enquire = new Xapian::Enquire(m_db->m_ndb->db);
|
158 |
m_nq->enquire = new Xapian::Enquire(m_db->m_ndb->db);
|
158 |
m_nq->enquire->set_query(m_nq->query);
|
159 |
if (m_collapseDuplicates) {
|
|
|
160 |
m_nq->enquire->set_collapse_key(Rcl::VALUE_MD5);
|
|
|
161 |
} else {
|
|
|
162 |
m_nq->enquire->set_collapse_key(Xapian::BAD_VALUENO);
|
|
|
163 |
}
|
159 |
if (!m_sortField.empty()) {
|
164 |
if (!m_sortField.empty()) {
|
160 |
if (m_sorter) {
|
165 |
if (m_sorter) {
|
161 |
delete (QSorter*)m_sorter;
|
166 |
delete (QSorter*)m_sorter;
|
162 |
m_sorter = 0;
|
167 |
m_sorter = 0;
|
163 |
}
|
168 |
}
|
|
... |
|
... |
165 |
// It really seems there is a xapian bug about sort order, we
|
170 |
// It really seems there is a xapian bug about sort order, we
|
166 |
// invert here.
|
171 |
// invert here.
|
167 |
m_nq->enquire->set_sort_by_key((QSorter*)m_sorter,
|
172 |
m_nq->enquire->set_sort_by_key((QSorter*)m_sorter,
|
168 |
!m_sortAscending);
|
173 |
!m_sortAscending);
|
169 |
}
|
174 |
}
|
|
|
175 |
m_nq->enquire->set_query(m_nq->query);
|
170 |
m_nq->mset = Xapian::MSet();
|
176 |
m_nq->mset = Xapian::MSet();
|
171 |
// Get the query description and trim the "Xapian::Query"
|
177 |
// Get the query description and trim the "Xapian::Query"
|
172 |
d = m_nq->query.get_description();
|
178 |
d = m_nq->query.get_description();
|
173 |
} XCATCHERROR(ermsg);
|
179 |
} XCATCHERROR(ermsg);
|
174 |
if (!ermsg.empty()) {
|
180 |
if (!ermsg.empty()) {
|