none
How to get result sources and search schema in sharepoint 2013?

    Question

  • Hi friends,

    If this in not the right place for this query take my apology.

    I am in mid of creating a search client application. I got stuck while retrieving result source and schema. I found that, it can be achieved using SharePoint model. I need to use REST api.

    Can anyone explain how to retrieve result sources and search schema from SharePoint 2013?

    I fed up with exploring for documents / post / articles to read.  Can any one explain? 

    It will be more useful to develop the search application.

    Thanks in advance.

    Regards

    Karthi

    Thursday, December 27, 2012 1:28 PM

Answers

  • A list of managed properties is not available in CSOM or REST. It can still be retrieved using the Search.asmx web service GetSearchMetadata method. This is still available in SP2013. A list of result sources is not available from any remote api. You will have to do your own custom web service for this.

    http://msdn.microsoft.com/en-us/library/search.queryservice.getsearchmetadata(v=office.12).aspx


    Blog | SharePoint Field Notes Dev Tool | ClassMaster

    Wednesday, January 02, 2013 2:49 AM

All replies

  • Hi, 

    please review these items

    • http://blogs.msdn.com/b/nadeemis/archive/2012/08/24/sharepoint-2013-search-rest-api.aspx
    • http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2012/09/07/getting-started-with-the-search-rest-api-in-sharepoint-2013-preview.aspx

    This rest query tool might be helpful:

    • http://sp2013searchtool.codeplex.com/
    • http://blogs.msdn.com/b/nadeemis/archive/2012/11/10/sharepoint-2013-search-query-tool-released-on-codeplex.aspx

    Alexey.

    Thursday, December 27, 2012 1:43 PM
  • Thanks Alexey for quick reply.

    I had referred those links and its not explaining about retrieving of result sources and search schema available in the sharepoint server. Can u give some code snippet using REST api. It will be useful for me. 

    Thanks in advance.

    karthi

    Thursday, December 27, 2012 1:50 PM
  • Hi karthi, 

    if you're interested in search schema and result sources in particular, then I'm not sure it's available via current REST API -since it's not described in protocol here

    As for SCOM (client object model)  I dont see anything helpful in Microsoft.SharePoint.Client.Search.Administration as well. 



    Thursday, December 27, 2012 1:58 PM
  • Hi Alexey,

    This concludes REST api do not completely support search in sharepoint 2013?

    Any alternate direction to work for client application?

    Thursday, December 27, 2012 2:09 PM
  • Hi karthi, 

    could you describe what are the reasons for your client application to perform configuration of search? This may help to suggest you a better way out of this situation.

    I believe existing API is aimed mostly for search consumers, this could explain why not all search capabilities are exposed to REST.

    Thursday, December 27, 2012 2:13 PM
  • Hi Alexey,

    I want to create an application which will be running from client machine to search contents specified text as input. Since server want to be secure and not to allow strangers, I want to use client application. I had constructed REST query to search contents for Full text query. This works great. When come to search using Property Restriction, I need the collection of search schema and result source for creating search query using REST API.

    Can u help me?

    Thursday, December 27, 2012 2:20 PM
  • A list of managed properties is not available in CSOM or REST. It can still be retrieved using the Search.asmx web service GetSearchMetadata method. This is still available in SP2013. A list of result sources is not available from any remote api. You will have to do your own custom web service for this.

    http://msdn.microsoft.com/en-us/library/search.queryservice.getsearchmetadata(v=office.12).aspx


    Blog | SharePoint Field Notes Dev Tool | ClassMaster

    Wednesday, January 02, 2013 2:49 AM
  • Thank you Steve.

    I have one question for you.

    Is this issue in RTM or design of SharePoint 2013 search architecture?

    Why I am asking this is, I need to work from client application only and no custom web services / SharePoint Object Model.

    Regards,

    Karthi

    Thursday, January 03, 2013 6:32 AM
  • This is by design and I don't agree with it. The search.asmx is listed as deprecated but still can be used, however, it cannot be used from the on premises app model. 

    Blog | SharePoint Field Notes Dev Tool | ClassMaster

    Sunday, January 06, 2013 4:25 AM
  • Thanks Steve.

    Is there any documents officially released by Microsoft related to the stated issue? If so, please provide me the link to download the document.

    Monday, January 07, 2013 4:39 AM
  • There are quite a bit of challenges about Result Sources that I find quite frustrating.

    • A GUID is required to use them
    • They can't be passed to the ResultScriptWebPart by query string (from what I can tell)
    • They can't be created with PowerShell
    • There is no way to retrieve a list of them via CSOM / REST

    The latter makes developing an app around them next to impossible.  The only good news is that most of the built-in ones always have the same GUIDs.


    Corey Roth - SharePoint Server MVP blog: www.dotnetmafia.com twitter: @coreyroth | SP2 Apps

    Wednesday, January 09, 2013 3:32 PM
  • Thank you very much Corey.

    After lot of stumble and hit, finally I found a possible solution to retrieve Result Source from client (CSOM / REST).

    As per the design, Result Source can be created in the Site level settings itself. We can retrieve the custom result source from the site level using the SearchExportConfiguration method from  SearchConfigurationPortability class.

    If this doesn't work, we can use HTTP web request to get the search export configuration as an XML file by using the following URL.

    "http://hostname/sitename/_layouts/15/exportsearchconfiguration.aspx?level=site"

    We can retrieve custom result sources GUID by parsing the XML result. We can get the default result source as you list out here Default Result Source.

    I think this will help you.

    Tuesday, January 15, 2013 7:25 AM