LIKE search with wildcard seems to be breaking on '-'

query

#1

Hi, I’m having a similar issue than this ticket Fail on LIKE query while document contain “\n”

In my case i have documents with fields with these type of values:

[
  {
    "drug_name": "PROMETHAZINE HCL"
  },
 {
    "drug_name": "PROMETHAZINE-CODEINE"
  }
]

If i do a LIKE search like this: drug_name LIKE "PROMETH%" it will only return PROMETHAZINE HCL
And if i complete the search param to include the ‘-’ like this drug_name LIKE "PROMETHAZINE-%" it will only return PROMETHAZINE-CODEINE.
First query should return two objects but it is only returning the one without ‘-’

I’ve tried simple workarounds that would not slow down the query but i haven’t manage to pull that out, the issue on the referenced issue appears to be fixed only for the new line character, any ideas on this one?

We are using Enterprise Edition 5.0.1


#2

In 5.1.0

drug_name LIKE "PROMETH%"  returns 2 objects
drug_name LIKE "PROMETHAZINE-%"  returns 1 object

The results are right. ’ -’ is not wild card why do you expect 2 results in second case. (’_’ is single character wild card) cc @marcoeg


#3

You’re right, my bad. Problem is that first query should return two objects but it is returning only one, the one without ‘-’.


#4

Try with latest version of 5.5 or 6.0


#5

Confirmed working in version 6.0

image