|
|
@@ -688,6 +688,7 @@ SearchClient.prototype.parseQueryString = function(queryString) {
|
|
|
const notPhraseWords = [];
|
|
|
const prefixPaths = [];
|
|
|
const notPrefixPaths = [];
|
|
|
+ const tags = [];
|
|
|
|
|
|
queryString.trim();
|
|
|
queryString = queryString.replace(/\s+/g, ' '); // eslint-disable-line no-param-reassign
|
|
|
@@ -718,8 +719,8 @@ SearchClient.prototype.parseQueryString = function(queryString) {
|
|
|
|
|
|
// https://regex101.com/r/lN4LIV/1
|
|
|
const matchNegative = word.match(/^-(prefix:)?(.+)$/);
|
|
|
- // https://regex101.com/r/gVssZe/1
|
|
|
- const matchPositive = word.match(/^(prefix:)?(.+)$/);
|
|
|
+ // https://regex101.com/r/gVssZe/2
|
|
|
+ const matchPositive = word.match(/^(prefix:|tag:)?(.+)$/);
|
|
|
|
|
|
if (matchNegative != null) {
|
|
|
const isPrefixCondition = (matchNegative[1] != null);
|
|
|
@@ -731,16 +732,18 @@ SearchClient.prototype.parseQueryString = function(queryString) {
|
|
|
}
|
|
|
}
|
|
|
else if (matchPositive != null) {
|
|
|
- const isPrefixCondition = (matchPositive[1] != null);
|
|
|
- if (isPrefixCondition) {
|
|
|
+ if (matchPositive[1] === 'prefix:') {
|
|
|
prefixPaths.push(matchPositive[2]);
|
|
|
}
|
|
|
+ else if (matchPositive[1] === 'tag:') {
|
|
|
+ tags.push(matchPositive[2]);
|
|
|
+ }
|
|
|
else {
|
|
|
matchWords.push(matchPositive[2]);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+ console.log(prefixPaths, tags);
|
|
|
return {
|
|
|
match: matchWords,
|
|
|
not_match: notMatchWords,
|
|
|
@@ -748,6 +751,7 @@ SearchClient.prototype.parseQueryString = function(queryString) {
|
|
|
not_phrase: notPhraseWords,
|
|
|
prefix: prefixPaths,
|
|
|
not_prefix: notPrefixPaths,
|
|
|
+ tag: tags,
|
|
|
};
|
|
|
};
|
|
|
|