Tuesday, August 6, 2019

Search nugget - Grouping property restrictions within a KQL query

image

Figured I’d alert you guys to a small nugget I was made aware of, and which I have officially documented at https://docs.microsoft.com/en-us/sharepoint/dev/general-development/keyword-query-language-kql-syntax-reference#grouping-property-restrictions-within-a-kql-query.

The gist of it all is that you can now use parenthesis on property queries.

<Property Name>:(<Expression>)

As an example:

author:"John Smith" AND author:"Jane Smith"

can be rewritten as:

author:("John Smith" "Jane Smith")

The other cool side effect of adding () around the property value is that the term(s) will be lemmatized. The query title:page return matches with the exact term page only, while title:(page) also return matches for the term pages.

Head over to the docs to read all about it and check out some more complex samples. Start adding those parenthesis, and may the search be with you!

Note: Works for SharePoint Online and SharePoint 2019 only.