Skip to main content

Exercises: wildcard and regex

wildcard​

πŸ”— Playground link: words that starts-with not matching as expected
Solution
"analyzer": "lucene.standard"

The matching needs to occur at the word level, and thus needs (non-keyword) tokenization.

And allowAnalyzedField: true needs to be set, allowing searches when using a tokenizing analyzer.

πŸ”— solution

regex​

πŸ”— Playground link: Full string regex not working as expected
Solution
"analyzer": "lucene.keyword"

Matching needs to occur across the full string, and thus needs to be lucene.keyword analyzed so that the full string is indexed as a single unit.

πŸ”— solution