|
a/src/rcldb/searchdata.cpp |
|
b/src/rcldb/searchdata.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: searchdata.cpp,v 1.22 2008-08-28 15:42:43 dockes Exp $ (C) 2006 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: searchdata.cpp,v 1.23 2008-09-16 08:18:30 dockes Exp $ (C) 2006 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
149 |
m_query.clear();
|
149 |
m_query.clear();
|
150 |
m_filetypes.clear();
|
150 |
m_filetypes.clear();
|
151 |
m_topdir.erase();
|
151 |
m_topdir.erase();
|
152 |
m_description.erase();
|
152 |
m_description.erase();
|
153 |
m_reason.erase();
|
153 |
m_reason.erase();
|
|
|
154 |
}
|
|
|
155 |
|
|
|
156 |
void SearchData::setSortBy(const string& fld, bool ascending) {
|
|
|
157 |
RclConfig *cfg = RclConfig::getMainConfig();
|
|
|
158 |
m_sortField = cfg->fieldCanon(stringtolower(fld));
|
|
|
159 |
m_sortAscending = ascending;
|
|
|
160 |
LOGDEB0(("SearchData::setSortBy: [%s] %s\n", m_sortField.c_str(),
|
|
|
161 |
m_sortAscending ? "ascending" : "descending"));
|
154 |
}
|
162 |
}
|
155 |
|
163 |
|
156 |
// Am I a file name only search ? This is to turn off term highlighting
|
164 |
// Am I a file name only search ? This is to turn off term highlighting
|
157 |
bool SearchData::fileNameOnly()
|
165 |
bool SearchData::fileNameOnly()
|
158 |
{
|
166 |
{
|
|
... |
|
... |
570 |
list<string> patterns;
|
578 |
list<string> patterns;
|
571 |
stringToStrings(m_text, patterns);
|
579 |
stringToStrings(m_text, patterns);
|
572 |
list<string> names;
|
580 |
list<string> names;
|
573 |
for (list<string>::iterator it = patterns.begin();
|
581 |
for (list<string>::iterator it = patterns.begin();
|
574 |
it != patterns.end(); it++) {
|
582 |
it != patterns.end(); it++) {
|
575 |
// This relies on filenameWildExp not resetting and always
|
583 |
list<string> more;
|
576 |
// adding to the input
|
|
|
577 |
db.filenameWildExp(*it, names);
|
584 |
db.filenameWildExp(*it, more);
|
|
|
585 |
names.splice(names.end(), more);
|
578 |
}
|
586 |
}
|
579 |
// Build a query out of the matching file name terms.
|
587 |
// Build a query out of the matching file name terms.
|
580 |
*qp = Xapian::Query(Xapian::Query::OP_OR, names.begin(), names.end());
|
588 |
*qp = Xapian::Query(Xapian::Query::OP_OR, names.begin(), names.end());
|
581 |
return true;
|
589 |
return true;
|
582 |
}
|
590 |
}
|