question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot disable stemmer and search for exact word

See original GitHub issue

Thanks for this lunr.js lib which is great.

I would like to find exact matching word: For example:

When searching “implements”, I want only “implements” When searching “implemented”, I want only “implemented” When searching “implementation”, I want only “implementation”

Is that possible ?

I have tried disable the stemmer like this:

var index = lunr(function(){
        this.ref('headingid')
        this.field('headingname')
        this.field('text')
        this.metadataWhitelist = ['position']


        data.forEach(function(item) {
            this.add(item) 
        }, this);

        this.pipeline.remove(lunr.stemmer);
        this.pipeline.remove(lunr.stopWordFilter)

    })

But no effect.

What would be the could config ?

Thanks a lot

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
olivernncommented, Oct 12, 2017

Do you have an example, putting together a reproduction on something like jsfiddle makes it a lot easier to understand the problem you are having.

If you want to completely disable the stemmer you must remove it from both the indexing pipeline and the search pipeline, this should work:

var idx = lunr(function () {
  // ...snip...
  this.pipeline.remove(lunr.stemmer)
  this.searchPipeline.remove(lunr.stemmer)
  // ...snip...
})

There is more documentation on the builder object and the different properties/methods that are available.

0reactions
olivernncommented, Mar 7, 2018

@ToLuSt thanks. I’m going to close this one out, @fzingg feel free to comment and I’ll re-open to look further into your original question.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable stop words and stemming for phrases searches when ...
Disable stop words and stemming for phrases searches when using query_string · Create an extra field that has exact text · Run two...
Read more >
Searching exact word matches should not ignore "common ...
Bug JRASERVER-36719 - Cannot find exact phrase when searching text field. ... The only workaround we have for this at the moment is...
Read more >
have global search support exact matching (disabling ...
You are correct; we have no way to disable the porter stemming algorithm. ... Unfortunately, this would break phrase searching, so it's not...
Read more >
Understanding and Using Stemmed Searches - Documentation
When stemmed search is enabled, the search matches the exact term, ... you can enable and disable the use of stemming on a...
Read more >
How can i enforce whole word matching only (disable partial ...
xml distributed with Apache Solr Search Integration to enforce simple whole word matching ? If you can't support this request here I'd ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found