Using a file name clause in advanced search crashed the GUI because of a bad dynamic cast in the history management code
This commit is contained in:
parent
836040168f
commit
7dee82154f
@ -315,6 +315,12 @@ public:
|
||||
m_haveWildCards =
|
||||
(txt.find_first_of(cstr_minwilds) != std::string::npos);
|
||||
}
|
||||
SearchDataClauseSimple(const std::string& txt, SClType tp)
|
||||
: SearchDataClause(tp), m_text(txt), m_curcl(0)
|
||||
{
|
||||
m_haveWildCards =
|
||||
(txt.find_first_of(cstr_minwilds) != std::string::npos);
|
||||
}
|
||||
|
||||
virtual ~SearchDataClauseSimple()
|
||||
{
|
||||
@ -365,10 +371,10 @@ protected:
|
||||
* field, especially for file names, because this makes searches for
|
||||
* "*xx" much faster (no need to scan the whole main index).
|
||||
*/
|
||||
class SearchDataClauseFilename : public SearchDataClause {
|
||||
class SearchDataClauseFilename : public SearchDataClauseSimple {
|
||||
public:
|
||||
SearchDataClauseFilename(const std::string& txt)
|
||||
: SearchDataClause(SCLT_FILENAME), m_text(txt)
|
||||
: SearchDataClauseSimple(txt, SCLT_FILENAME)
|
||||
{
|
||||
// File name searches don't count when looking for wild cards.
|
||||
m_haveWildCards = false;
|
||||
@ -383,9 +389,6 @@ public:
|
||||
}
|
||||
|
||||
virtual bool toNativeQuery(Rcl::Db &, void *);
|
||||
|
||||
protected:
|
||||
std::string m_text;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -56,18 +56,20 @@ string SearchData::asXML()
|
||||
|
||||
// Clause list
|
||||
os << "<CL>" << endl;
|
||||
|
||||
// List conjunction: default is AND, else print it.
|
||||
if (m_tp != SCLT_AND)
|
||||
os << "<CLT>" << tpToString(m_tp) << "</CLT>" << endl;
|
||||
|
||||
for (unsigned int i = 0; i < m_query.size(); i++) {
|
||||
SearchDataClause *c = m_query[i];
|
||||
if (c->getTp() == SCLT_SUB) {
|
||||
LOGERR(("SearchData::asXML: can't do subclauses !\n"));
|
||||
continue;
|
||||
}
|
||||
if (c->getexclude())
|
||||
os << "<NEG/>" << endl;
|
||||
if (c->getTp() == SCLT_PATH) {
|
||||
// Keep these apart, for compat with the older history format
|
||||
// Keep these apart, for compat with the older history format. NEG
|
||||
// is ignored here, we have 2 different tags instead.
|
||||
SearchDataClausePath *cl =
|
||||
dynamic_cast<SearchDataClausePath*>(c);
|
||||
if (cl->getexclude()) {
|
||||
@ -76,24 +78,36 @@ string SearchData::asXML()
|
||||
os << "<YD>" << base64_encode(cl->gettext()) << "</YD>" << endl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
|
||||
SearchDataClauseSimple *cl =
|
||||
dynamic_cast<SearchDataClauseSimple*>(c);
|
||||
os << "<C>" << endl;
|
||||
if (cl->getTp() != SCLT_AND) {
|
||||
os << "<CT>" << tpToString(cl->getTp()) << "</CT>" << endl;
|
||||
os << "<C>" << endl;
|
||||
|
||||
if (c->getexclude())
|
||||
os << "<NEG/>" << endl;
|
||||
|
||||
if (c->getTp() != SCLT_AND) {
|
||||
os << "<CT>" << tpToString(c->getTp()) << "</CT>" << endl;
|
||||
}
|
||||
if (c->getTp() == SCLT_FILENAME) {
|
||||
SearchDataClauseFilename *cl =
|
||||
dynamic_cast<SearchDataClauseFilename*>(c);
|
||||
os << "<T>" << base64_encode(cl->gettext()) << "</T>" << endl;
|
||||
} else {
|
||||
SearchDataClauseSimple *cl =
|
||||
dynamic_cast<SearchDataClauseSimple*>(c);
|
||||
if (!cl->getfield().empty()) {
|
||||
os << "<F>" << base64_encode(cl->getfield()) << "</F>" <<
|
||||
endl;
|
||||
}
|
||||
os << "<T>" << base64_encode(cl->gettext()) << "</T>" << endl;
|
||||
if (cl->getTp() == SCLT_NEAR || cl->getTp() == SCLT_PHRASE) {
|
||||
SearchDataClauseDist *cld =
|
||||
dynamic_cast<SearchDataClauseDist*>(cl);
|
||||
os << "<S>" << cld->getslack() << "</S>" << endl;
|
||||
}
|
||||
}
|
||||
os << "</C>" << endl;
|
||||
}
|
||||
if (cl->getTp() != SCLT_FILENAME && !cl->getfield().empty()) {
|
||||
os << "<F>" << base64_encode(cl->getfield()) << "</F>" << endl;
|
||||
}
|
||||
os << "<T>" << base64_encode(cl->gettext()) << "</T>" << endl;
|
||||
if (cl->getTp() == SCLT_NEAR || cl->getTp() == SCLT_PHRASE) {
|
||||
SearchDataClauseDist *cld =
|
||||
dynamic_cast<SearchDataClauseDist*>(cl);
|
||||
os << "<S>" << cld->getslack() << "</S>" << endl;
|
||||
}
|
||||
os << "</C>" << endl;
|
||||
}
|
||||
os << "</CL>" << endl;
|
||||
|
||||
|
||||
@ -31,6 +31,8 @@ versions.</i></p>
|
||||
|
||||
<h2><a name="b_latest">recoll 1.19.0</a></h2>
|
||||
<ul>
|
||||
<li>Using a "file name" clause inside advanced search crashes the
|
||||
GUI because of a bug in the search history feature.</li>
|
||||
<li>On systems such as Debian Stable which use Evince version 2.x (not 3.x)
|
||||
as PDF viewer, the default "Open" command for PDF files will not work. You
|
||||
need to use the GUI preferences tool to change the --page-index option to
|
||||
|
||||
@ -79,7 +79,10 @@ Configuration</em> menu.</p>
|
||||
<li>It is now possible to use OR with "dir:" clauses, and wildcards have been
|
||||
enabled.</li>
|
||||
<li>When the option to follow symbolic links is not set -which is the
|
||||
default- symbolic links are now indexed as such (name and content).</li>
|
||||
default- symbolic links are now indexed as such (name and
|
||||
content).</li>
|
||||
<li>The advanced search panel now has a history feature. Use the
|
||||
up/down arrows to walk the search history list.</li>
|
||||
<li>There are new GUI configuration options to run in "search as you type"
|
||||
mode (which I don't find useful at all...), and to disable the Qt
|
||||
auto-completion inside the simple search string. The completion was often
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user