lunr-module
lunr-module copied to clipboard
Adding fuzzy search
As a workaround, I implemented this fix by extending the LunrSearch component:
<script>
import LunrSearch from 'lunr-module/search'
export default {
extends: LunrSearch,
methods: {
async search (txt) {
if (!this.searchIndex) {
const indexLoaded = await this.loadIndex()
if (!indexLoaded) {
return
}
}
this.setStatus('searching')
txt = txt + '* ' + txt
this.searchResults = this.searchIndex.search(txt)
if (!this.searchResults || !this.searchResults.length) {
this.setStatus('noresults')
} else {
this.clearStatus()
}
this.openResults()
},
}
}
</script>