3

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.

4
  • Are you actually trying to find out "why" the operators work differently, or is there a question for "how" in the background? – moe Jul 21 '17 at 6:09
  • I am looking for solution finds exact match for docowner – Amit Bhagat Jul 21 '17 at 7:28
  • The question becomes unclear with your screenshots as they are not consistent with what you are writing. Your screenshots 1 and 3 are identical - they are the same picture. What are you trying to indicate with these? – moe Jul 21 '17 at 10:53
  • @moe Updated, please check – Amit Bhagat Jul 21 '17 at 14:34
7
+100

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

4
  • Why do = works with author field? – Amit Bhagat Jul 22 '17 at 7:24
  • @AmitKB Again, it is based on the content it holds. The Author or CreatedBy field (Created By is internally mapped to Author) holds the multi text value of the user. e.g. typical author field will hold data like "John Doe". So equals or compares works. OWSUSER fields are different in terms of the way they hold user data. – Ransher Singh Jul 24 '17 at 13:59
  • Thanks for information. If found that when the custom field docowner (of type user/group) was added in managed property it created one additional docownerOWSUSER continaing couple of elements including name of user, login id etc. as you described. – Amit Bhagat Jul 24 '17 at 15:27
  • @AmitKB Glad it helped! – Ransher Singh Jul 24 '17 at 16:20
2

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

1
  • I am aware of syntax, please check question update – Amit Bhagat Jul 18 '17 at 2:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.