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

Exact matching for words that start/end with a symbol #481

Closed DorianaDD closed 3 years ago

DorianaDD commented 3 years ago

Seems like when a word starts/ends with a symbol (reserved or not by lunr), if searching for an entire match (including the symbol), lunr won't find it. Created a sandbox to reproduce this: https://codesandbox.io/s/lunr-end-special-char-wgd0j

Quick example: For a search against a text , if we search for tag> , <tag or there are no results, but searching for the word tag will retrieve all 3 findings though

Is there any way to fix this? Thanks!

Update: root cause - https://github.com/olivernn/lunr.js/blob/master/lib/trimmer.js Solution: update or remove it