简体   繁体   中英

Commerce Server Catalog Manager SearchOptions setPaging

I am using this method:

http://msdn.microsoft.com/en-US/library/microsoft.commerceserver.catalog.commonsearchoptions.setpaging.aspx

as such:

        CatalogSearch p = catalogContext.GetCatalogSearch();
        p.CatalogNames = "**";
        p.SearchOptions = new CatalogSearchOptions();
        p.SearchOptions.SetPaging(1, 400);
        p.SearchOptions.ClassTypes = CatalogClassTypes.ProductClass;

Typically, I would then do p.Search() and get a CatalogItemsDataSet . This is fine. What I can't figure out, is how do I go to the next page of results? My query will return around 7,500 results with a maximum of 500 per search call which isn't enough. Do I have to do this manually?

You have to loop or recurse your Search call, incrementing the pageNumber by your page size each time. Your page size is 400, so the paging code in the loop might look like this p.SearchOptions.SetPaging(lastPageNumber + 400); You stop when the Search method out totalRecords is less than the page size.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM