locked
live search just return max 10 results? RRS feed

  • Question

  • I use live search service in my application. It can return results, but the max results are 10 rows even I search "ASP" or ".net" these kind of hot keys. Is anyone knows why?

    Thanks in advance!

    Here is my source code:

    private LiveSearch.SearchRequest GetSearchRequest(string querystring)
            {
                LiveSearch.SearchRequest request = new LiveSearch.SearchRequest();
                LiveSearch.SourceRequest[] sourceRequest = new LiveSearch.SourceRequest[1];
                sourceRequest[0] = new LiveSearch.SourceRequest();

                //set the SourceRequest values

                // this should define the max results, right?
               
    sourceRequest[0].Count = 500;

                sourceRequest[0].Source = LiveSearch.SourceType.Web;
                sourceRequest[0].SortBy = LiveSearch.SortByType.Relevance;
                sourceRequest[0].ResultFields = LiveSearch.ResultFieldMask.All;

                //set the Request values
                request.AppID = "XXXXXXXXXXXXXXXXXX";     //the ID for this application
                request.Query = querystring;
                request.CultureInfo = "en-US";
                request.SafeSearch = LiveSearch.SafeSearchOptions.Moderate;
                request.Flags = LiveSearch.SearchFlags.DisableHostCollapsing
                    | LiveSearch.SearchFlags.DisableSpellCorrectForSpecialWords | LiveSearch.SearchFlags.MarkQueryWords;
                request.Requests = sourceRequest;

                return request;
            }

            public LiveSearch.SearchResponse Search(string querystring)
            {
                LiveSearch.MSNSearchService searchService = new LiveSearch.MSNSearchService();

                LiveSearch.SearchRequest request = this.GetSearchRequest(querystring);

                LiveSearch.SearchResponse response = searchService.Search(request);

                return response;
            }


    Wednesday, January 7, 2009 6:58 PM

Answers

  • Hi.

    You can specify the Count from 1 up to 50.

    See Also: Count property
    The default value for Count is 10 (ten), and the maximum count value is 50 (25 for the PhoneBook SourceType). If a value greater than 50 is specified (for all source types other than PhoneBook), the Live Search Web Service returns an array of Result objects with 10 (or fewer) array elements, based on the total number of results returned.
    (http://msdn.microsoft.com/en-us/library/bb251821.aspx)

    And do you have using Live Search API version 1.1b?  You can also use version 2.0(however, the Count limitation is same).

    • Marked as answer by CQLan Thursday, January 8, 2009 2:42 PM
    Thursday, January 8, 2009 3:39 AM

All replies

  • Hi.

    You can specify the Count from 1 up to 50.

    See Also: Count property
    The default value for Count is 10 (ten), and the maximum count value is 50 (25 for the PhoneBook SourceType). If a value greater than 50 is specified (for all source types other than PhoneBook), the Live Search Web Service returns an array of Result objects with 10 (or fewer) array elements, based on the total number of results returned.
    (http://msdn.microsoft.com/en-us/library/bb251821.aspx)

    And do you have using Live Search API version 1.1b?  You can also use version 2.0(however, the Count limitation is same).

    • Marked as answer by CQLan Thursday, January 8, 2009 2:42 PM
    Thursday, January 8, 2009 3:39 AM
  •  Thanks jz5. My application works fine now.
    Thursday, January 8, 2009 2:42 PM