Same result if I do this:
if (mainCategories.Any())
{
var multiSearchQuery = SearchClient.Instance.MultiSearch<EntryContentBase>();
foreach (var mainCategory in mainCategories)
{
var mainCategoryName = mainCategory.Term;
multiSearchQuery.Search<EntryContentBase>(
m => m.CommonProductFilter(currentStore)
.AddPromotionPrefixAndStoreFilter(prefix, currentStore)
.Filter(p => p.MainCategory().Match(mainCategoryName))
.Take(count));
}
var contentResults = multiSearchQuery.GetContentResult();
}
Preferably you should use the second approach (simply since you then can avoid having to type the .Search request and just use .Search()). In our test setup we use a similar test setup to verify that it only makes 1 request, so atm I'm not able to reproduce the issue.
As for the fiddler requests you see, are you seeing multiple _msearch requests?
I am running Commerce 13.16.0.
In Fiddler I see one _msearch request and x number of _search requests (x = nr of categories).
Some suggestions you can test: The custom filters you are adding does not trigger a search request (what if yoy remove them)? Are the _search requests before or after the _msearch request? If you not execute the msearch-request, do you still see the _search requests?
I want to use Episerver Find MultiSearch to limit nr of requests to Find, as specified here.
How can I dynamically add Searches, typically inside a foreach statement?
The code below works, but I can see through Fiddler that nr of request matches 'mainCategories' count.