Skip to content

Commit

Permalink
Simplify title extraction, closes #1563
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Apr 28, 2022
1 parent 2b2bcbe commit 0fa8c24
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 20 deletions.
17 changes: 1 addition & 16 deletions assets/js/search-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function indexStorageKey () {
function createIndex () {
return lunr(function () {
this.ref('ref')
this.field('title', { boost: 3, extractor: titleExtractor })
this.field('title', { boost: 3 })
this.field('doc')
this.metadataWhitelist = ['position']
this.pipeline.remove(lunr.stopWordFilter)
Expand All @@ -96,21 +96,6 @@ function createIndex () {
})
}

function titleExtractor (document) {
const { title, type } = document

if (type === 'function' || type === 'callback' || type === 'type') {
const modFun = title.replace(/\/\d+$/, '')
const modOrFun = modFun.replace(/\./g, ' ')
const parts = title.split('.')
const funArity = parts[parts.length - 1]

return `${title} ${modFun} ${modOrFun} ${funArity}`
}

return title
}

function elixirTokenSplitter (builder) {
function elixirTokenFunction (token) {
const tokens = token
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit 0fa8c24

Please sign in to comment.