|
|
@@ -689,6 +689,7 @@ SearchClient.prototype.parseQueryString = function(queryString) {
|
|
|
const prefixPaths = [];
|
|
|
const notPrefixPaths = [];
|
|
|
const tags = [];
|
|
|
+ const notTags = [];
|
|
|
|
|
|
queryString.trim();
|
|
|
queryString = queryString.replace(/\s+/g, ' '); // eslint-disable-line no-param-reassign
|
|
|
@@ -717,16 +718,18 @@ SearchClient.prototype.parseQueryString = function(queryString) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // https://regex101.com/r/lN4LIV/1
|
|
|
- const matchNegative = word.match(/^-(prefix:)?(.+)$/);
|
|
|
- // https://regex101.com/r/gVssZe/2
|
|
|
+ // https://regex101.com/r/pN9XfK/1
|
|
|
+ const matchNegative = word.match(/^-(prefix:|tag:)?(.+)$/);
|
|
|
+ // https://regex101.com/r/fP9ohQ/1
|
|
|
const matchPositive = word.match(/^(prefix:|tag:)?(.+)$/);
|
|
|
|
|
|
if (matchNegative != null) {
|
|
|
- const isPrefixCondition = (matchNegative[1] != null);
|
|
|
- if (isPrefixCondition) {
|
|
|
+ if (matchNegative[1] === 'prefix:') {
|
|
|
notPrefixPaths.push(matchNegative[2]);
|
|
|
}
|
|
|
+ else if (matchNegative[1] === 'tag:') {
|
|
|
+ notTags.push(matchNegative[2]);
|
|
|
+ }
|
|
|
else {
|
|
|
notMatchWords.push(matchNegative[2]);
|
|
|
}
|
|
|
@@ -752,6 +755,7 @@ SearchClient.prototype.parseQueryString = function(queryString) {
|
|
|
prefix: prefixPaths,
|
|
|
not_prefix: notPrefixPaths,
|
|
|
tag: tags,
|
|
|
+ not_tag: notTags,
|
|
|
};
|
|
|
};
|
|
|
|