History

Minor search improvements

Thibaut Courouble committed 10 years ago

Commit 4cece4c1 parent d88a3b21 file · +3 −3Browse files

Unified · Split

assets/javascripts/app/searcher.coffee+3−3
@@ -26,7 +26,7 @@ return unless index >= 0 · 25 unmodified lines
2626 lastIndex = value.lastIndexOf(query)
2727
2828 if index isnt lastIndex
29− return Math.max(scoreExactMatch(), (index = lastIndex) and scoreExactMatch())
29+ return Math.max(scoreExactMatch(), ((index = lastIndex) and scoreExactMatch()) or 0)
3030 else
3131 return scoreExactMatch()
3232 `}`
@@ -112,7 +112,7 @@ class app.Searcher · 79 unmodified lines
112112 max_results: app.config.max_results
113113 fuzzy_min_length: 3
114114
115− SEPARATORS_REGEXP = /\:?\ |#|::|->|\$(?=\w)|\-(?=\w)/g
115+ SEPARATORS_REGEXP = /#|::|:-|->|\$(?=\w)|\-(?=\w)|\:(?=\w)|\ [\/\-&]\ |:\ |\ /g
116116 INFO_PARANTHESES_REGEXP = /\ \(\w+?\)$/
117117 EMPTY_PARANTHESES_REGEXP = /\(\)/
118118 EVENT_REGEXP = /\ event$/
@@ -166,7 +166,7 @@ class app.Searcher · 47 unmodified lines
166166 return
167167
168168 isValid: ->
169− queryLength > 0
169+ queryLength > 0 and query isnt SEPARATOR
170170
171171 end: ->
172172 @triggerResults [] unless @totalResults