November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
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
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);
}