|
a/src/qtgui/ssearch_w.cpp |
|
b/src/qtgui/ssearch_w.cpp |
|
... |
|
... |
130 |
Rcl::SearchData *sdata = 0;
|
130 |
Rcl::SearchData *sdata = 0;
|
131 |
|
131 |
|
132 |
if (tp == SST_LANG) {
|
132 |
if (tp == SST_LANG) {
|
133 |
string reason;
|
133 |
string reason;
|
134 |
if (prefs.autoSuffsEnable)
|
134 |
if (prefs.autoSuffsEnable)
|
135 |
sdata = wasaStringToRcl(theconfig, u8, reason, (const char *)prefs.autoSuffs.toUtf8());
|
135 |
sdata = wasaStringToRcl(theconfig, u8, reason,
|
|
|
136 |
(const char *)prefs.autoSuffs.toUtf8());
|
136 |
else
|
137 |
else
|
137 |
sdata = wasaStringToRcl(theconfig, u8, reason);
|
138 |
sdata = wasaStringToRcl(theconfig, u8, reason);
|
138 |
if (sdata == 0) {
|
139 |
if (sdata == 0) {
|
139 |
QMessageBox::warning(0, "Recoll", tr("Bad query string") + ": " +
|
140 |
QMessageBox::warning(0, "Recoll", tr("Bad query string") + ": " +
|
140 |
QString::fromAscii(reason.c_str()));
|
141 |
QString::fromAscii(reason.c_str()));
|
141 |
return;
|
142 |
return;
|
142 |
}
|
143 |
}
|
143 |
if (prefs.ssearchAutoPhrase) {
|
|
|
144 |
sdata->maybeAddAutoPhrase();
|
|
|
145 |
}
|
|
|
146 |
} else {
|
144 |
} else {
|
147 |
sdata = new Rcl::SearchData(Rcl::SCLT_OR);
|
145 |
sdata = new Rcl::SearchData(Rcl::SCLT_OR);
|
148 |
if (sdata == 0) {
|
146 |
if (sdata == 0) {
|
149 |
QMessageBox::warning(0, "Recoll", tr("Out of memory"));
|
147 |
QMessageBox::warning(0, "Recoll", tr("Out of memory"));
|
150 |
return;
|
148 |
return;
|
151 |
}
|
149 |
}
|
152 |
|
|
|
153 |
// If there is no white space inside the query, then the user
|
|
|
154 |
// certainly means it as a phrase.
|
|
|
155 |
bool isreallyaphrase = false;
|
|
|
156 |
if (!TextSplit::hasVisibleWhite(u8))
|
|
|
157 |
isreallyaphrase = true;
|
|
|
158 |
|
|
|
159 |
// Maybe add automatic phrase ? For ALL and ANY, and not if
|
|
|
160 |
// there is already a phrase or wildcard terms.
|
|
|
161 |
if (!isreallyaphrase &&
|
|
|
162 |
prefs.ssearchAutoPhrase && (tp == SST_ANY || tp == SST_ALL) &&
|
|
|
163 |
u8.find_first_of("\"*[]?") == string::npos &&
|
|
|
164 |
TextSplit::countWords(u8) > 1) {
|
|
|
165 |
sdata->addClause(new Rcl::SearchDataClauseDist(Rcl::SCLT_PHRASE,
|
|
|
166 |
u8, 0));
|
|
|
167 |
}
|
|
|
168 |
Rcl::SearchDataClause *clp = 0;
|
150 |
Rcl::SearchDataClause *clp = 0;
|
169 |
switch (tp) {
|
151 |
if (tp == SST_FNM) {
|
170 |
case SST_ANY:
|
|
|
171 |
default:
|
|
|
172 |
clp = isreallyaphrase ?
|
|
|
173 |
new Rcl::SearchDataClauseDist(Rcl::SCLT_PHRASE, u8, 0) :
|
|
|
174 |
new Rcl::SearchDataClauseSimple(Rcl::SCLT_OR, u8);
|
|
|
175 |
break;
|
|
|
176 |
case SST_ALL:
|
|
|
177 |
clp = isreallyaphrase ?
|
|
|
178 |
new Rcl::SearchDataClauseDist(Rcl::SCLT_PHRASE, u8, 0) :
|
|
|
179 |
new Rcl::SearchDataClauseSimple(Rcl::SCLT_AND, u8);
|
|
|
180 |
break;
|
|
|
181 |
case SST_FNM:
|
|
|
182 |
clp = new Rcl::SearchDataClauseFilename(u8);
|
152 |
clp = new Rcl::SearchDataClauseFilename(u8);
|
183 |
break;
|
153 |
} else if (!TextSplit::hasVisibleWhite(u8)) {
|
|
|
154 |
// If there is no white space inside the query, then the user
|
|
|
155 |
// certainly means it as a phrase.
|
|
|
156 |
clp = new Rcl::SearchDataClauseDist(Rcl::SCLT_PHRASE, u8, 0);
|
|
|
157 |
} else {
|
|
|
158 |
// ANY or ALL, several words.
|
|
|
159 |
if (tp == SST_ANY) {
|
|
|
160 |
clp = new Rcl::SearchDataClauseSimple(Rcl::SCLT_OR, u8);
|
|
|
161 |
} else {
|
|
|
162 |
clp = new Rcl::SearchDataClauseSimple(Rcl::SCLT_AND, u8);
|
|
|
163 |
}
|
184 |
}
|
164 |
}
|
185 |
sdata->addClause(clp);
|
165 |
sdata->addClause(clp);
|
|
|
166 |
}
|
|
|
167 |
|
|
|
168 |
if (prefs.ssearchAutoPhrase && rcldb) {
|
|
|
169 |
string stemLang = (const char *)prefs.queryStemLang.toAscii();
|
|
|
170 |
if (stemLang == "ALL") {
|
|
|
171 |
theconfig->getConfParam("indexstemminglanguages", stemLang);
|
|
|
172 |
}
|
|
|
173 |
sdata->setStemlang(stemLang);
|
|
|
174 |
sdata->maybeAddAutoPhrase(*rcldb,
|
|
|
175 |
prefs.ssearchAutoPhraseThreshPC / 100.0);
|
186 |
}
|
176 |
}
|
187 |
|
177 |
|
188 |
// Search terms history
|
178 |
// Search terms history
|
189 |
|
179 |
|
190 |
// We want to have the new text at the top and any older identical
|
180 |
// We want to have the new text at the top and any older identical
|