3

I have configured the people browser based on Search service. I want to show only those employees who have some value in user profile property. I have created the managed property for that custom property in user profile. How should I configure the search query which will show only those names who have some value in the managed property?

My current query is:

{?{searchTerms} ContentClass=urn:content-class:SPSPeople} -xyz:''

In the query, xyz is the managed property mapped with custom user profile property. The query is not working correctly. What am I missing?

  • That would check if property containts blank spaces, as space is a character as well. You could try -xyz:'' or -xyz<>''. Did you ran a full crawl after you mapped the property? – Christoffer Nov 16 '15 at 6:52
  • I tried that but not working. @user19952 – users1100 Nov 16 '15 at 6:57
  • There is really no way to exclude items that has no values, as they might be indexed in the first place but wont be returned if you just filter for one value. So you could try to turn it around and get all items where xyz has a value instead. xyz:* – Christoffer Nov 16 '15 at 7:08
0

True, there is no way to filter out blanks. I have a Department managed property in people search, I only want to show users that have this field populated. Solution is to append an inclusion filter for each letter of the alphabet.

contentclass=SPSPeople  {?Title:{searchboxquery}*} 
 Department:a* 
Department:b* 
Department:c* 
Department:d* 
Department:e* 
Department:f* 
Department:g* 
Department:h* 
Department:i* 
Department:h* 
Department:k* 
Department:l* 
Department:m* 
Department:n* 
Department:o* 
Department:p* 
Department:q* 
Department:r* 
Department:s* 
Department:t* 
Department:u* 
Department:v* 
Department:w* 
Department:x* 
Department:y* 
Department:z*
  • This sounds like a brute force approach, and has a pretty bad code smell, to boot. – fbueckert Jul 14 '17 at 14:57
  • True, but it actually works, while we wait for regex support in KQL #waitingforever – Kasper Bo Larsen Jan 28 '18 at 12:29

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.