none
spsearch.asmx vs search.asmx

    Question

  • I want to search my sharepoint site from another external application.

    what search web service should I use? what are there differences?

    I want to redirect the user to the search result page after a button is clicked.

    thanks!


    ----------------------- Sharepoint Newbie

    Wednesday, April 11, 2012 8:18 AM

Answers

All replies

  • Hi,

    You can query SharePoint Search or Enterprise Search in the exact same manner it is just a matter of which web service you make a reference to.  SharePoint search can be queried at a URL similar to the one below.

    http://moss-server/_vti_bin/spsearch.asmx

    To query Enterprise Search, the URL will look similar to this.  Both web services have the same methods.  They just query different indexes.

    http://moss-server/_vti_bin/search.asmx

    Please take a look at this article How to: Query Search using the Web Service


    Dmitry

    Lightning Tools LogoLightning Tools Check out our SharePoint tools and web parts | Lightning Tools Blog

    Wednesday, April 11, 2012 11:05 AM
  • Just to add to what Dmitry is saying, since your requirement is simple, you can just redirect to searchresults.aspx page by appending a query to the URL. This is similar to how SharePoint does it, EX: http://sharepointportal/sites/searchcenter/pages/searchresults.aspx?k=[my query]


    SharePoint MVP, Microsoft VTSP, http://www.arcovis.com

    Wednesday, April 11, 2012 6:09 PM
  • if you put http://moss-server/_vti_bin/spsearch.asmx into your browse address bar, you can find the service description that it is SharePoint foundation 2010 search query web service.

    and for search.asmx, it is for SharePoint Search Server 2010 query web service.

    You should use search.asmx, not spsearch.asmx


    Thursday, April 12, 2012 8:56 AM
    Moderator
  • Hi,

    Simple code snippet for search.asmx

    public static DataSet GetSearchResults()
    {
    string xmlTemplate = “<querypacket><query><context><querytext type="\"MSSQLFT\"">“;
    xmlTemplate += “ your search text for searching related items
    xmlTemplate += “1</querytext></context><range><count>00</count></range></query></querypacket>“;
    DataSet ds = null;

    search.QueryService queryService = new search.QueryService();
    queryService.Url = “http://<SPSite>/_vti_bin/search.asmx”;
    queryService.UseDefaultCredentials = true;
    ds = queryService.QueryEx(xmlTemplate);

    return ds;
    }


    Thanks, S.Raja Singh.

    Thursday, April 12, 2012 9:51 AM