Skip to content

Commit b64ae27

Browse files
authored
Update keyword-query-language-kql-syntax-reference.md
Document how to query for a managed property with or without a value
1 parent 131570d commit b64ae27

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

docs/general-development/keyword-query-language-kql-syntax-reference.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Keyword Query Language (KQL) syntax reference
33
description: Describes how to construct KQL queries for Search in SharePoint and steps on how to use property restrictions and operators in KQL queries.
4-
ms.date: 03/09/2023
4+
ms.date: 04/16/2023
55
ms.assetid: d8489f59-522f-433c-b9c1-69e597be51c7
66
ms.localizationpriority: high
77
---
@@ -390,7 +390,6 @@ Matches would include Microsoft Word documents authored by John Smith. This is t
390390
`author:"John Smith" AND filetype:docx`
391391

392392

393-
394393
### Grouping property restrictions within a KQL query
395394
_**Applies to:** Office 365 | SharePoint Online | SharePoint 2019_
396395

@@ -430,13 +429,30 @@ can be rewritten as:
430429
> `title:page` return matches with the exact term *page* while `title:(page)` also return matches for the term *pages*.
431430
432431

432+
### Filter on items where a property is empty or contains a value
433+
_**Applies to:** Office 365 | SharePoint Online_
434+
435+
For managed properties in the search schema which are set to be [Queryable](https://msdn.microsoft.com/library/Microsoft.Office.Server.Search.Administration.ManagedProperty.Queryable.aspx) you can use the wildcard operator (*) as the property expression to filter on items which either have a value or does not have a value.
436+
437+
Syntax to return items where a property has a value:
438+
439+
`<Property Name>:*`
440+
441+
Syntax to return items where a property does not have a value:
442+
443+
`NOT <Property Name>:*`
444+
445+
The following example will return sites which are associated to a hub site, excluding the hub sites themselves:
446+
447+
`(DepartmentId:* OR RelatedHubSites:*) AND contentclass:sts_site NOT IsHubSite:true`
448+
449+
433450
## KQL operators for complex queries
434451
<a name="kql_operators"> </a>
435452

436453
KQL syntax includes several operators that you can use to construct complex queries.
437454

438-
439-
455+
440456

441457
### Boolean operators
442458

0 commit comments

Comments
 (0)