Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding fuzzy search #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

sandoche
Copy link

No description provided.

@Decipher
Copy link

Decipher commented Feb 19, 2022

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants