From 523e300738c6d7fd730377c9cde875ac0759da00 Mon Sep 17 00:00:00 2001 From: Jez Ng Date: Sat, 3 Nov 2012 13:26:28 -0400 Subject: Minor touchups. --- background_scripts/completion.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index cf946b06..9e12d497 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -257,7 +257,7 @@ RankingUtils = regexp = RegexpCache.get(term) matchedTerm = false for thing in things - matchedTerm = matchedTerm || (thing?.match && thing.match regexp) + matchedTerm ||= thing.match regexp return false unless matchedTerm true @@ -268,8 +268,8 @@ RankingUtils = titleScore = 0.0 for term in queryTerms queryLength += term.length - urlScore += 1 if RankingUtils.matches [term], url - titleScore += 1 if RankingUtils.matches [term], title + urlScore += 1 if url && RankingUtils.matches [term], url + titleScore += 1 if title && RankingUtils.matches [term], title urlScore = urlScore / queryTerms.length urlScore = urlScore * RankingUtils.normalizeDifference(queryLength, url.length) if title -- cgit v1.2.3