Skip to content

Commit

Permalink
Custom-only: remove omniSearchWeightOption.
Browse files Browse the repository at this point in the history
This option is no longer needed, since we don't do search completion
except for custom searches.
  • Loading branch information
smblott-github committed May 28, 2015
1 parent a3002fe commit ded18f3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions background_scripts/completion.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# - refresh(): (optional) refreshes the completer's data source (e.g. refetches the list of bookmarks).
# - cancel(): (optional) cancels any pending, cancelable action.
class Suggestion
showRelevancy: false # Set this to true to render relevancy when debugging the ranking scores.
showRelevancy: true # Set this to true to render relevancy when debugging the ranking scores.

constructor: (@options) ->
# Required options.
Expand Down Expand Up @@ -54,6 +54,7 @@ class Suggestion
<div class="vimiumReset vomnibarTopHalf">
<span class="vimiumReset vomnibarSource #{insertTextClass}">#{insertTextIndicator}</span><span class="vimiumReset vomnibarSource">#{@type}</span>
<span class="vimiumReset vomnibarTitle">#{@highlightQueryTerms Utils.escapeHtml @title}</span>
#{relevancyHtml}
</div>
"""
else
Expand Down Expand Up @@ -466,7 +467,7 @@ class SearchEngineCompleter
{ keyword, searchUrl, description } = engine
extend request, searchUrl, customSearchMode: true

factor = Math.max 0.0, Math.min 1.0, Settings.get "omniSearchWeight"
factor = 0.5
haveCompletionEngine = CompletionSearch.haveCompletionEngine searchUrl

# This filter is applied to all of the suggestions from all of the completers, after they have been
Expand Down Expand Up @@ -519,7 +520,6 @@ class SearchEngineCompleter
highlightTermsExcludeUrl: true
isCustomSearch: true
relevancyFunction: @computeRelevancy
relevancyData: factor

cachedSuggestions =
if haveCompletionEngine then CompletionSearch.complete searchUrl, queryTerms else null
Expand All @@ -544,7 +544,7 @@ class SearchEngineCompleter
# lowest-ranked suggestion from another completer (and there are already 10 suggestions), then
# there's no need to query the completion engine.
perfectRelevancyScore = @computeRelevancy new Suggestion
queryTerms: queryTerms, title: queryTerms.join(" "), relevancyData: factor
queryTerms: queryTerms, title: queryTerms.join " "

if 10 <= suggestions.length and perfectRelevancyScore < suggestions[suggestions.length-1].relevancy
console.log "skip (cannot make the grade):", suggestions.length, query if SearchEngineCompleter.debug
Expand All @@ -560,7 +560,7 @@ class SearchEngineCompleter
# scores here, and those provided by other completers.
# - Relevancy depends only on the title (which is the search terms), and not on the URL.
Suggestion.boostRelevancyScore 0.5,
relevancyData * RankingUtils.wordRelevancy queryTerms, title, title
0.7 * RankingUtils.wordRelevancy queryTerms, title, title

postProcessSuggestions: (request, suggestions) ->
return unless request.searchEngines
Expand Down
1 change: 0 additions & 1 deletion background_scripts/settings.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ root.Settings = Settings =
# or strings
defaults:
scrollStepSize: 60
omniSearchWeight: 0.4
smoothScroll: true
keyMappings: "# Insert your preferred key mappings here."
linkHintCharacters: "sadfjklewcmpgh"
Expand Down
3 changes: 3 additions & 0 deletions pages/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@
</tr>

<!-- Vimium Labs -->
<!--
Disabled. But we leave this code here as a template for the next time we need to introduce "Vimium Labs".
<tr>
<td colspan="2"><header>Vimium Labs</header></td>
</tr>
Expand All @@ -263,6 +265,7 @@
<input id="omniSearchWeight" type="number" min="0.0" max="1.0" step="0.05" />(0 to 1)
</td>
</tr>
-->
</tbody>
</table>
</div>
Expand Down

0 comments on commit ded18f3

Please sign in to comment.