Try our conversational search powered by Generative AI!

Search and facets

Vote:
 

I have a product page where I list products and facets for filtering based on size and color.

Is there a way to get products and facets in one roundtrip to the Find server (using multisearch or other)?
The objects returned (List and Dictionary>) are quite different so using multi search with projection to same type is a bit hairy.

Note: Since I'm always displaying all facets (facets from original listing) including the facets as part of current query is not an option.

Is this possible to do without two queries/roundtrips to the server?

#132716
Aug 18, 2015 8:52
Vote:
 

Perhaps by combining MultiSearch with Tuple? Something like

client.Instance.MultiSearch<Tuple<List<Product>, Dictionary<string, List<string>>>>()

and then populate the List<Product> in the first search, and populating the Dictionary<string, List<string>> in the second search?

I've never tried this though :-)

#132886
Aug 20, 2015 11:47
Vote:
 

I like your thinking. I will try ;)

#132891
Aug 20, 2015 12:28
Vote:
 

How do you query for the facet?

Sorry if I misunderstand your question but I don't understand why your facet query would return Dictionary<string, List<string>> and not SearchResults<Product> (where you later fetch the facet using .XXXFacetFor()).

If you 'list' query and 'facet' query are both .Search<Product> with no later projections then they both return the same result type and you should be able to execute them in the same multisearch request.

/Henrik

#132926
Edited, Aug 20, 2015 21:43
Vote:
 

I was under the impression that the problem was to do a multisearch without having to use a common projection, but maybe I'm wrong? Anyway, I found that a bit interesting, so I wrote a little bit of code. Maybe it could be of use? https://github.com/BVNetwork/EPiCode.DynamicMultiSearch

#132991
Aug 23, 2015 23:01
Vote:
 

@Henrik and @Per Magne: I want to avoid common projection - the result sets are quite different (products, pages and articles). And I want to limit the number of round trips to the server.

At the moment I'm playing around with your code, @Per Magne. It looks very promising, I just need to make sure that all features I need are supported; such as facets and paging within each search result. Nice work, PM ;)

#132993
Aug 24, 2015 8:32
Vote:
 

Great! Keep me posted

#132994
Aug 24, 2015 8:44
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.