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

Tokenizer trimming causes offset matches if document content begins with whitespace #417

Closed
rgaiken opened this issue Oct 4, 2019 · 2 comments

Comments

@rgaiken
Copy link

rgaiken commented Oct 4, 2019

If a document starts with a whitespace character, trim() in tokenizer.js will remove those characters, causing the returned match data to be offset.

See this fiddle for a simple example

hoelzro added a commit to hoelzro/lunr.js that referenced this issue Oct 5, 2019
hoelzro added a commit to hoelzro/lunr.js that referenced this issue Oct 5, 2019
@hoelzro hoelzro mentioned this issue Oct 5, 2019
@hoelzro
Copy link
Contributor

hoelzro commented Oct 5, 2019

Thanks for the report @rgaiken ! I wrote up a fix in #418

hoelzro added a commit to hoelzro/lunr.js that referenced this issue Oct 6, 2019
hoelzro added a commit to hoelzro/lunr.js that referenced this issue Oct 6, 2019
This can throw off the token position metadata, as reported in GH olivernn#417

Fixes GH olivernn#417
hoelzro added a commit to hoelzro/lunr.js that referenced this issue Oct 6, 2019
@olivernn
Copy link
Owner

olivernn commented Oct 6, 2019

I've just pushed 2.3.7 which includes the fix provided by @hoelzro .

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

No branches or pull requests

3 participants