Minor search improvements

pull/438/head
Thibaut Courouble 9 years ago
parent d88a3b263b
commit 4cece4cec7

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

Loading…
Cancel
Save