Question

There is a site column docowner, hence managed property docownerOWSUSER

docowner is user field.

In a document library the docowner field has value John Doe

Searching query docownerOWSUSER:John Doe returns result but docownerOWSUSER="John Doe"

Document Library

enter image description here

On basis of document library shown above:

Not result with query text: path:"http://spsvr" IsDocument:1 AND docownerOWSUSER="John Doe"

Returns result: path:"http://spsvr" IsDocument:1 AND docownerOWSUSER:"John Doe"

I want to use = to filter, so that it returns exact matching.

Was it helpful?

Solution

The reason why exact matching would not work is because of what the OWSUSER field consists of in terms of data.

A typical OWSUSER field contains the following elements for a user, say johndoe@abc.com:

johndoe@abc.com | Doe, John | 123A12345E777C123A12345B51234D123A1A1F1C12 i:0#.w|abc\johndoe

So unless you construct your "Equal to" value in exactly the same format, it's not going to work. The same reason, why contains (:) works!

If your requirement is to get unique results for a particular user without using "contains" on the name, do the comparison using email ID for the same field instead of name. enter image description here

Technet description for User Field Managed Property structure: https://technet.microsoft.com/en-us/library/jj613136.aspx

OTHER TIPS

When searching with Managed Properties you can test for an exact match (“=”), or if the property contains the word (“:”).

Equal: Use the equal sign to find an exact match. Searching for title=jet will not find our PowerPoint presentation as its title is “Jet Airplanes and the Future of Flight” not only “jet”.

Contains: Use the colon to perform a “contains” search. Searching for title:jet will find our presentation, and also find a lot of other files. Note that “:” looks for whole words. You can use the wildcard “” at the end of a word, “title:jet”, and find both “jet” and “jets”, and also “Jetsons”.

Note: Many of the property searches will return zero results when using “=” due to the way SharePoint internally stores data. On the other hand, “:” may return more than expected due to its wildcard like behavior. As an example "Path=somepath" will always return zero items.

Keyword Query Language (KQL) syntax reference

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top