olivernn / lunr.js

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

Tokenization of Camel Case #372

Closed hammadzz closed 5 years ago

hammadzz commented 5 years ago

Why is camelcase not tokenized? When I am searching for "foo" the result will show up for "foo-bar" but not for "fooBar"

Do I need to write a custom tokenizer?

olivernn commented 5 years ago

If you search for "foo*" you should see results for "fooBar".

Lunr splits strings into tokens based on this regex, you can override this to get different behaviour.

In this case though it might be better off writing a custom pipeline function to split a camel cased word. I think there are examples of how to do this in some other (possibly closed) issues, #301 seems similar.

olivernn commented 5 years ago

This looks to have gone stale, resolving.