Quantcast
Channel: Optimizely Search & Navigation
Viewing all articles
Browse latest Browse all 6894

Different number of search results

$
0
0

When we search for multiple types in one call we get for example 500 results 

 ITypeSearch<ISearchContent> unifiedSearch = SearchClient.Instance.UnifiedSearchFor(query).UsingSynonyms();

unifiedSearchResults = unifiedSearch.Skip(((page - 1) * hitsPerPage) * (hitsPerPage)).Take(hitsPerPage).FilterByExactTypes(new[] {
typeof(DocumentOrderPage), typeof(DocumentPage), typeof(VirtualDocumentPage), typeof(SiteMediaData),
typeof(LinkPage), typeof(EServiceStartPage), typeof(OperationInfoPage), typeof(NewsPage),
typeof(TopicPage), typeof(ListPage), typeof(CaretypePage), typeof(AidPage), typeof(NeedStaircasePage), typeof(NeedStepPage)}).ApplyBestBets().WildCardQuery("*" + query + "*", x => x.SearchText).Track().GetResult();

and when we divide search in three calls then we get more results. Depending on search word difference can be between few hundred and few thousand results. We would like to use only one call since it is much easier to represent results in pages but it looks that it is not working well. What should we change in code to get the same number of results in first call?


unifiedSearchResults = unifiedSearch.Skip((page - 1) * hitsPerPage).Take(hitsPerPage).FilterByExactTypes(new[] { typeof(NewsPage) }).ApplyBestBets().Track().GetResult();
returnValue.TotalResults = unifiedSearchResults.TotalMatching;


unifiedSearchResults = unifiedSearch.Skip((page - 1) * hitsPerPage).Take(hitsPerPage).FilterByExactTypes(new[] { typeof(DocumentOrderPage), typeof(DocumentPage), typeof(VirtualDocumentPage), typeof(SiteMediaData) }).ApplyBestBets().Track().GetResult();
returnValue.TotalResults = unifiedSearchResults.TotalMatching;

unifiedSearchResults = unifiedSearch.Skip((page - 1) * hitsPerPage).Take(hitsPerPage).FilterByExactTypes(new[] { typeof(LinkPage), typeof(EServiceStartPage), typeof(OperationInfoPage),
typeof(TopicPage), typeof(ListPage), typeof(CaretypePage), typeof(AidPage), typeof(NeedStaircasePage), typeof(NeedStepPage) }).ApplyBestBets().Track().GetResult();
returnValue.TotalResults = unifiedSearchResults.TotalMatching;


Viewing all articles
Browse latest Browse all 6894

Trending Articles