Query language: it used to be that an entry lacking whitespace but

splittable, like [term1,term2] was transformed into a phrase search, which
made sense in some cases, but no so many. This commit changes this:
[term1,term2] now means term1 AND term2. [term1/term2] means
term1 OR term2. This is especially useful for field searches where you
would previously be forced to repeat the field name for every term.
[somefield:term1 somefield:term2] can now be expressed as somefield:term1,term2
This commit is contained in:
Jean-Francois Dockes
2014-06-12 17:12:08 +02:00
parent 5f05f5d588
commit 4a783beadc
6 changed files with 30 additions and 37 deletions
+2 -10
View File
@@ -312,16 +312,8 @@ bool RecollProtocol::doSearch(const QueryDesc& qd)
if (opt == 'f') {
clp = new Rcl::SearchDataClauseFilename(qs);
} else {
// If there is no white space inside the query, then the user
// certainly means it as a phrase.
bool isreallyaphrase = false;
if (!TextSplit::hasVisibleWhite(qs))
isreallyaphrase = true;
clp = isreallyaphrase ?
new Rcl::SearchDataClauseDist(Rcl::SCLT_PHRASE, qs, 0) :
new Rcl::SearchDataClauseSimple(opt == 'o' ?
Rcl::SCLT_OR : Rcl::SCLT_AND,
qs);
clp = new Rcl::SearchDataClauseSimple(opt == 'o' ? Rcl::SCLT_OR :
Rcl::SCLT_AND, qs);
}
sd = new Rcl::SearchData(Rcl::SCLT_OR, "english");
if (sd && clp)