Forráskód Böngészése

Minor search improvements

Thibaut Courouble 9 éve
szülő
commit
4cece4cec7
1 módosított fájl, 3 hozzáadás és 3 törlés
  1. 3 3
      assets/javascripts/app/searcher.coffee

+ 3 - 3
assets/javascripts/app/searcher.coffee

@@ -26,7 +26,7 @@ return unless index >= 0
 lastIndex = value.lastIndexOf(query)
 
 if index isnt lastIndex
-  return Math.max(scoreExactMatch(), (index = lastIndex) and scoreExactMatch())
+  return Math.max(scoreExactMatch(), ((index = lastIndex) and scoreExactMatch()) or 0)
 else
   return scoreExactMatch()
 `}`
@@ -112,7 +112,7 @@ class app.Searcher
     max_results: app.config.max_results
     fuzzy_min_length: 3
 
-  SEPARATORS_REGEXP = /\:?\ |#|::|->|\$(?=\w)|\-(?=\w)/g
+  SEPARATORS_REGEXP = /#|::|:-|->|\$(?=\w)|\-(?=\w)|\:(?=\w)|\ [\/\-&]\ |:\ |\ /g
   INFO_PARANTHESES_REGEXP = /\ \(\w+?\)$/
   EMPTY_PARANTHESES_REGEXP = /\(\)/
   EVENT_REGEXP = /\ event$/
@@ -166,7 +166,7 @@ class app.Searcher
     return
 
   isValid: ->
-    queryLength > 0
+    queryLength > 0 and query isnt SEPARATOR
 
   end: ->
     @triggerResults [] unless @totalResults