Skip to content

Commit

Permalink
fixup! refactor: SearchQueryParser::getTextArgument
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Oct 10, 2023
1 parent 695cc46 commit 62da287
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/library/searchqueryparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,20 @@ SearchQueryParser::TextArgumentResult SearchQueryParser::getTextArgument(QString
}
}
StringMatch mode = StringMatch::Contains;
bool equalRequested = false;
if (argument.startsWith("=")) {
// strip the '=' from the argument
argument = argument.mid(1);
// TODO(ronso0) should 'tag:"string"' really be equal to 'tag:="string"?
mode = StringMatch::Equals;
equalRequested = true;
}
if (argument.startsWith("\"")) {
Quoted quoted;
std::tie(argument, quoted) = consumeQuotedArgument(argument, tokens);
mode = quoted == Quoted::Complete ? StringMatch::Equals : StringMatch::Contains;
mode = equalRequested && quoted == Quoted::Complete
? StringMatch::Equals
: StringMatch::Contains;
}
return {argument, mode};
}
Expand Down

0 comments on commit 62da287

Please sign in to comment.