4

This is my following scenario:

  • MySite Host Site Collection with a custom page called peoplesearch.aspx
  • peoplesearch.aspx has Refinement Panel, and Search Results Web Part (Search Box webpart is in the master page)
  • I have a Custom List with information about people outside the company (First Name, Last Name and Phone fields)

I need to retrieve Local People Results + Results from my custom List in the same page.

I have tried many things but it seems that only it is possible to get Local People Results or SharePoint Results but not a mix of both.

I would like to avoid developing a web part that inherits Search Result WebParts and launching the 2 queries via Code and mixing them in a DataTable or something like that.

1
  • Hmmm, I should have walked through it first. I see what you mean, you have to choose one or the other. Let me play with it a little before I try to answer again. Sorry for the confusion. Commented Apr 9, 2014 at 16:29

3 Answers 3

5

The real answer here is to create a result source where you for "Type" choose "People Search Results". You don't need to add

ContentClass=urn:content-class:SPSPeople

For example:

{?({searchTerms})} {?OR (({searchTerms}) spcontenttype:contact)}

will give people + results of contenttype=Contact

When testing this in the query wizard it will append contentclass for people and not show the list results, but it will work on the result page or via the query API.

For some reason this works in SharePoint Online but not on premises with SP1.

1
  • I have not tested on SPO but as you state this does not work in on premises :( Commented Apr 14, 2014 at 14:11
2

Check the result sources:

People:

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

Local Content:

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

For local the minus in front of the content class excludes the people results. For people the contentclass excludes your list.

Create a copy of the people result, add your custom list with a OR to the result source and both should be visible.

6
  • Finally this is working {SearchBoxQuery} ContentTypeid:0x0100127CFE71A6854A3492FF0FA975202BD2* OR ContentClass=urn:content-class:SPSPeople Commented Apr 10, 2014 at 17:18
  • Sadly this only works if you write in the SearchBox the asterisk character. If you write my name, for example, only results from User Profile are retrieved. I created the Managed Properties in the search schema and they are searchable, queryable and retrievable. Any idea? Commented Apr 14, 2014 at 8:18
  • Please follow this blog post, it explains the ? notation you are missing: melcher.it/s/2r Commented Apr 14, 2014 at 12:28
  • Try {?{SearchBoxQuery}} (ContentTypeid:0x0100127CFE71A6854A3492FF0FA975202BD2* OR ContentClass=urn:content-class:SPSPeople) Commented Apr 14, 2014 at 12:29
  • The query with the braces didn't work for me. Mikael Svenson has written today a great Post about my question and published in yammer too techmikael.blogspot.no/2014/04/… Commented Apr 14, 2014 at 12:51
1

My requirement was to mix three types of content types. I created new result source with below query.

{?{searchTerms} ContentClass=urn:content-class:SPSPeople} {?OR (({searchTerms}) ContentSource:WCFContacts)} {?OR (({searchTerms}) ContentSource:WCFAccounts)}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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