Przeglądaj źródła

Revert "FB"

This reverts commit 0026cd9a5123b7b6998d74c00ad1d9b6b2f45808.
yusuketk 7 lat temu
rodzic
commit
f06531c2bd
1 zmienionych plików z 5 dodań i 9 usunięć
  1. 5 9
      src/server/util/search.js

+ 5 - 9
src/server/util/search.js

@@ -719,10 +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/cPbWPw/1
-    const matchTag = word.match(/^(tag:)?(.+)$/);
+    // https://regex101.com/r/gVssZe/2
+    const matchPositive = word.match(/^(prefix:|tag:)?(.+)$/);
 
     if (matchNegative != null) {
       const isPrefixCondition = (matchNegative[1] != null);
@@ -734,13 +732,11 @@ SearchClient.prototype.parseQueryString = function(queryString) {
       }
     }
     else if (matchPositive != null) {
-      const isPrefixCondition = (matchPositive[1] != null);
-      const isTagCondition = (matchTag[1] != null);
-      if (isPrefixCondition) {
+      if (matchPositive[1] === 'prefix:') {
         prefixPaths.push(matchPositive[2]);
       }
-      else if (isTagCondition) {
-        tags.push(matchTag[2]);
+      else if (matchPositive[1] === 'tag:') {
+        tags.push(matchPositive[2]);
       }
       else {
         matchWords.push(matchPositive[2]);