volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Stacking searchClient getResult() result sets

Is there a way to have two searchClient result sets "stacked" or "concatenated" such that the first set preceeds ( in order ) the 2nd set?

For example we a result set of Dogs and one of Cats and we would like the Dogs (resultsDogs ) to appear infront of Cats (resultsCats) .

For example:

public ActionResult Index(SearchPage currentPage, string q = "", int p = 0)
{
            var model = new SearchPageViewModel(currentPage)
            {
                SearchQuery = q,
                PageIndex = p
            };
            if (q.HasValue())
            {
                var resultsDogs = this.searchClient
                    .UnifiedSearchFor(q, Language.English)
                    .Track()
                    .ApplyBestBets()
                    .Skip(p * model.PageWeight)
                    .Take(model.PageWeight)
                    .OrderBy(x => x.SearchSection.HasValue())
                    .Filter(x => x.SearchSection.Match("Dogs"))
                    .GetResult();

                var resultsCats = this.searchClient
                    .UnifiedSearchFor(q, Language.English)
                    .Track()
                    .ApplyBestBets()
                    .Skip(p * model.PageWeight)
                    .Take(model.PageWeight)
                    .OrderBy(x => x.SearchSection.HasValue())
                    .Filter(x => x.SearchSection.Match("Cats"))
                    .GetResult();
            }
            
            model.Results = [resultsDogs plus resultsCats];  // can this be accomplished?
            return View(model);
}

#192632
May 22, 2018 2:39

To take a step back, our requirement is to have the search results order like:

1)PageType=dogs

2)PageType=cats

3)rest of results

#192633
May 22, 2018 2:50
* 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.