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
If you need to get the 10 first (order by something?) for X amount of facets, I don't think there is a way to do it in a single query.
However, you could use multisearch to limit the number of queries. Here's an example:
var words = new List<string>() { "burger", "banjo", "water"}; var multiSearchQuery = SearchClient.Instance.MultiSearch<MyItem>(); foreach (var word in words) { multiSearchQuery = multiSearchQuery.Search(x => x.Filter(z => z.Category.Match(word))); } multiSearchQuery.GetResult();
Keep in mind that multisearch has a maximum of 10 queries, so if you go above that you'll have to modify your code to create more multisearch queries.
If that is the case, I suppose Henrik's answer is helpful, as that means that you'll need to get more than 10 facets, which is the default value :-)
TermsFacetFor(x => x.Something, facet => facet.Size = 50)
So I gave it a try and it works. Feels a bit dirty though.. :) A question though. If I add 10 searches to a multisearch, I get 403 forbidden, saying that 10 is the maximum allowed queries. If I only add 9 queries it works. Is this by design? Or just a misstake?
Hi, my Find skills are a bit limited, so I hope someone can push me in the right direction.
Lets say I have a query that gets all "Categories":
var searchResults = client.Search()
.TermsFacetFor(x => x.Category)
.Take(0)
.GetResult();
If I now want the 10 first hits in each Facet, can I extend my query to do that? Or do I need to write a subquery for each Facet?
Thanks,
Erik