Fix search aliases not applying properly on versioned docs

Fixes #461.
pull/469/head
Thibaut Courouble 9 years ago
parent fd5626219d
commit c63be6889d

@ -39,10 +39,13 @@ class app.models.Doc extends app.Model
"#{app.indexHost()}/#{@slug}/#{app.config.index_filename}?#{@mtime}"
toEntry: ->
@entry ||= new app.models.Entry
return @entry if @entry
@entry = new app.models.Entry
doc: @
name: @fullName
path: 'index'
@entry.addAlias(@name) if @version
@entry
findEntryByPathAndHash: (path, hash) ->
if hash and entry = @entries.findBy 'path', "#{path}##{hash}"

@ -5,8 +5,13 @@ class app.models.Entry extends app.Model
constructor: ->
super
@text = app.Searcher.normalizeString(@name)
@text = applyAliases(@text)
@text = applyAliases(app.Searcher.normalizeString(@name))
addAlias: (name) ->
text = applyAliases(app.Searcher.normalizeString(name))
@text = [@text] unless Array.isArray(@text)
@text.push(if Array.isArray(text) then text[1] else text)
return
fullPath: ->
@doc.fullPath if @isIndex() then '' else @path
@ -45,8 +50,9 @@ class app.models.Entry extends app.Model
return string
@ALIASES = ALIASES =
'angular': 'ng'
'angular.js': 'ng'
'backbone': 'bb'
'backbone.js': 'bb'
'c++': 'cpp'
'coffeescript': 'cs'
'elixir': 'ex'

Loading…
Cancel
Save