olivernn / lunr.js

A bit like Solr, but much smaller and not as bright
http://lunrjs.com
MIT License
8.94k stars 548 forks source link

Conjuctions like the/as/that etc. are not searched #480

Closed ar5had closed 3 years ago

ar5had commented 3 years ago

Hi,

It looks like lunr by default, not search for conjunctions. Is there any way to stop this default behaviour?

Example - search for the/as/that on https://olivernn.github.io/moonwalkers/

Related issue - https://github.com/olivernn/moonwalkers/issues/2

Thanks.

olivernn commented 3 years ago

These words are filtered out by the lunr.stopWordFilter. The goal is to remove additional words that are typically not very much use for determining the relevancy of a search to a document.

This behaviour is the default and it can be disabled by removing the lunr.stopWordFilter from both the indexing and searching pipelines:

lunr(config => {
  config.pipeline.remove(lunr.stopWordFilter)
  config.searchPipeline.remove(lunr.stopWordFilter)
})