Fix KQL for instances when a property value includes a hyphen
If the property value contains a hyphen (-) together with the
property operator equals (=) or not-equals (<>), then the
query will not work due a bug in SharePoint
As a workaround, we can use use contains (:) instead when we
have a value with a hyphen. However, this can lead to unexpected results.
Here's an example. The goal is to search for people where "Department" is "Ex-employee". If we use Department="Ex-employee", the filtering is incorrect, and returns all people. We can use Department:"Ex-employee", but this would also return values like "Ex-employee Relations".
Note: This is a search topic, but there is no search category available.
Dan Gøran Lunde commented
Agreed. This is also adressed in this suggestion (which is declined):
I suspect this to be because of the same bug in the Tokenizer as I mentioned in the declined suggestion.