nuxt-community / lunr-module

Full-text search with pre-build indexes for Nuxt.js using lunr.js
MIT License
47 stars 8 forks source link

How to configure the search to have already some results if no full word has typed. #7

Closed PetrusHahol closed 3 years ago

PetrusHahol commented 3 years ago

Hi! Having issue to find some solution for nuxt with a search which will provide some answers without necessity to complete at least a word that matches with document body. Is here a way to configure the lunr such way? So far I need to put at least a word to have some result.

pimlie commented 3 years ago

Hey,

I believe most search implementations requires the user to indicate they want to do a wildcard/partial search. Here is how to do that with Lunr: https://lunrjs.com/guides/searching.html (ie just append a *)

PetrusHahol commented 3 years ago

Thank you, seems what I need. Is here some simple way how to adjust the search that will work like it has * in the end of each word? 😃

PetrusHahol commented 3 years ago

Made a WA of it on webhook side in nuxt.config.js. Just simply indexed some subparts of words in text

sandoche commented 3 years ago

@PetrusHahol I created a PR about this: https://github.com/nuxt-community/lunr-module/pull/17

PetrusHahol commented 3 years ago

@sandoche Thank you for your contribution. I have badly looking WA for it, so now I will just remove it and make the solution of mine simpler :)

sandoche commented 3 years ago

You're welcome you can use this for now, until the PR is approved

npm install https://github.com/sandoche/lunr-module.git --save