Skip to content

Instantly share code, notes, and snippets.

@CoderMChu
Last active May 24, 2024 15:18
Show Gist options
  • Save CoderMChu/df04c211c261463b0de0f6cd7726ce2f to your computer and use it in GitHub Desktop.
Save CoderMChu/df04c211c261463b0de0f6cd7726ce2f to your computer and use it in GitHub Desktop.
Snowstorm description search modes
There are 4 ways to search descriptions in snowstorm.
1. Standard
This is set by default. Standard search returns any descriptions matching or containing text specified in the term parameter. It is case insensitive.
e.g when searching term value "col", following descriptions are matched.
Red colour
Cold
Ice cold
2. Whole word
This is to search descriptions matching the whole word which is different from above. Snowstorm might not return any results with term "col" because there is no match. However if you search "cold" for example, it will match Cold or Ice cold.
3. Wild card
Wild card search returns terms matching a wildcard pattern which is similar to Regex.
e.g If you use col* it could match
Colitis
Columba
cold
Color wavelength
However you will find results returned are less than standard search with "col", because col* only searches for any descriptions starting with col and it will not include Ice cold or Red colour.
You could use an equivalent wild card pattern to do the same search but wild card and regex searches are quite expensive.
4. Regex
Regex search is powerful and can do more than wildcard search. However please be aware that this is case sensitive while the other 3 searches are case insensitive. For example Col.* and col.* will return different results. To return all descriptions start with Col or col you can use (C|c)ol.*
Please note not all regex syntax is supported. Snowstorm uses Apache Lucene's regular expression syntax. You can find more details via https://www.elastic.co/guide/en/elasticsearch/reference/current/regexp-syntax.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment