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 =
|
m_haveWildCards =
|
||||||
(txt.find_first_of(cstr_minwilds) != std::string::npos);
|
(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()
|
virtual ~SearchDataClauseSimple()
|
||||||
{
|
{
|
||||||
@ -365,10 +371,10 @@ protected:
|
|||||||
* field, especially for file names, because this makes searches for
|
* field, especially for file names, because this makes searches for
|
||||||
* "*xx" much faster (no need to scan the whole main index).
|
* "*xx" much faster (no need to scan the whole main index).
|
||||||
*/
|
*/
|
||||||
class SearchDataClauseFilename : public SearchDataClause {
|
class SearchDataClauseFilename : public SearchDataClauseSimple {
|
||||||
public:
|
public:
|
||||||
SearchDataClauseFilename(const std::string& txt)
|
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.
|
// File name searches don't count when looking for wild cards.
|
||||||
m_haveWildCards = false;
|
m_haveWildCards = false;
|
||||||
@ -383,9 +389,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual bool toNativeQuery(Rcl::Db &, void *);
|
virtual bool toNativeQuery(Rcl::Db &, void *);
|
||||||
|
|
||||||
protected:
|
|
||||||
std::string m_text;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -56,18 +56,20 @@ string SearchData::asXML()
|
|||||||
|
|
||||||
// Clause list
|
// Clause list
|
||||||
os << "<CL>" << endl;
|
os << "<CL>" << endl;
|
||||||
|
|
||||||
|
// List conjunction: default is AND, else print it.
|
||||||
if (m_tp != SCLT_AND)
|
if (m_tp != SCLT_AND)
|
||||||
os << "<CLT>" << tpToString(m_tp) << "</CLT>" << endl;
|
os << "<CLT>" << tpToString(m_tp) << "</CLT>" << endl;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_query.size(); i++) {
|
for (unsigned int i = 0; i < m_query.size(); i++) {
|
||||||
SearchDataClause *c = m_query[i];
|
SearchDataClause *c = m_query[i];
|
||||||
if (c->getTp() == SCLT_SUB) {
|
if (c->getTp() == SCLT_SUB) {
|
||||||
LOGERR(("SearchData::asXML: can't do subclauses !\n"));
|
LOGERR(("SearchData::asXML: can't do subclauses !\n"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (c->getexclude())
|
|
||||||
os << "<NEG/>" << endl;
|
|
||||||
if (c->getTp() == SCLT_PATH) {
|
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 =
|
SearchDataClausePath *cl =
|
||||||
dynamic_cast<SearchDataClausePath*>(c);
|
dynamic_cast<SearchDataClausePath*>(c);
|
||||||
if (cl->getexclude()) {
|
if (cl->getexclude()) {
|
||||||
@ -76,24 +78,36 @@ string SearchData::asXML()
|
|||||||
os << "<YD>" << base64_encode(cl->gettext()) << "</YD>" << endl;
|
os << "<YD>" << base64_encode(cl->gettext()) << "</YD>" << endl;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
SearchDataClauseSimple *cl =
|
os << "<C>" << endl;
|
||||||
dynamic_cast<SearchDataClauseSimple*>(c);
|
|
||||||
os << "<C>" << endl;
|
if (c->getexclude())
|
||||||
if (cl->getTp() != SCLT_AND) {
|
os << "<NEG/>" << endl;
|
||||||
os << "<CT>" << tpToString(cl->getTp()) << "</CT>" << 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;
|
os << "</CL>" << endl;
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,8 @@ versions.</i></p>
|
|||||||
|
|
||||||
<h2><a name="b_latest">recoll 1.19.0</a></h2>
|
<h2><a name="b_latest">recoll 1.19.0</a></h2>
|
||||||
<ul>
|
<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)
|
<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
|
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
|
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
|
<li>It is now possible to use OR with "dir:" clauses, and wildcards have been
|
||||||
enabled.</li>
|
enabled.</li>
|
||||||
<li>When the option to follow symbolic links is not set -which is the
|
<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"
|
<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
|
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
|
auto-completion inside the simple search string. The completion was often
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user