How to make a search for "60" include results with "60mm"?

Amin Sabet

Well-known member
I have camera forums, and I want a search for "60" to include results for "60mm".

I've tried the Standard analyzer and the Stemming analyzer, but neither seems to work. Am I out of luck?
 

RobParker

Well-known member
Unfortunately, this isn't something we really expose -- it's not really a "standard" way of splitting a word. Elasticsearch does have very complex tokenizer options, though we don't expose a UI for changing this. (I'm not positive, but the word delimiter token filterer may have options that fit your needs: https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-word-delimiter-tokenfilter.html)
I'm curious after just doing a quick test, why does searching for "50" return 50% and £50 but not 50mm?
 

Mike

XenForo developer
Staff member
When you write "50mm", then that's the word that's in the index. That word won't match "50" (though it should match "50*") for the same reason that searching for "cat" doesn't match "catch".

In terms of the % or £, those aren't indexed character (or at delimiter characters), so they are just discarded. (In the same way that "cat," / "cat." / "cat?" and so on should really all just be considered "cat").
 
Top