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
26lastIndex = value.lastIndexOf(query)26lastIndex = value.lastIndexOf(query)
27 27
28if index isnt lastIndex28if index isnt lastIndex
29 return Math.max(scoreExactMatch(), (index = lastIndex) and scoreExactMatch())29 return Math.max(scoreExactMatch(), ((index = lastIndex) and scoreExactMatch()) or 0)
30else30else
31 return scoreExactMatch()31 return scoreExactMatch()
32`}`32`}`
@@ -112,7 +112,7 @@ class app.Searcher · 79 unmodified lines
112 max_results: app.config.max_results112 max_results: app.config.max_results
113 fuzzy_min_length: 3113 fuzzy_min_length: 3
114 114
115 SEPARATORS_REGEXP = /\:?\ |#|::|->|\$(?=\w)|\-(?=\w)/g115 SEPARATORS_REGEXP = /#|::|:-|->|\$(?=\w)|\-(?=\w)|\:(?=\w)|\ [\/\-&]\ |:\ |\ /g
116 INFO_PARANTHESES_REGEXP = /\ \(\w+?\)$/116 INFO_PARANTHESES_REGEXP = /\ \(\w+?\)$/
117 EMPTY_PARANTHESES_REGEXP = /\(\)/117 EMPTY_PARANTHESES_REGEXP = /\(\)/
118 EVENT_REGEXP = /\ event$/118 EVENT_REGEXP = /\ event$/
@@ -166,7 +166,7 @@ class app.Searcher · 47 unmodified lines
166 return166 return
167 167
168 isValid: ->168 isValid: ->
169 queryLength > 0169 queryLength > 0 and query isnt SEPARATOR
170 170
171 end: ->171 end: ->
172 @triggerResults [] unless @totalResults172 @triggerResults [] unless @totalResults