Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi,
You cannot use .Count() on individual searches in a multisearch request but you can do it on all searches using .Count() instead of .GetResult():
var results = service.MultiSearch<Article>()
.Search<Article>(x => x.For("Banana"))
.Search<Article>(x => x.For("Orange"))
.Count();
I guess however that you want to do a count on just a some of the searches and to do this with minimal overhead you can use .Take(0) on that query and look at .TotalMatching in the result:
var results = service.MultiSearch<Article>()
.Search<Article>(x => x.For("Banana"))
.Search<Article>(x => x.For("Orange").Take(0))
.GetResult();
results.ElementAt(1).TotalMatching
This will effectivly be a count query as it won't return any matching documents and only return the number of documents actually matching your query.
Hello.
How can I send request of count in multisearch?
where, request of count = EPiServer.Find.SearchExtensions.Count()
Multisearch = EPiServer.Find.IClient.MultiSearch
Any ideas?
Version EPiServer.Find = 8.9
Best Regards