November Happy Hour will be moved to Thursday December 5th.

Different number of search results

Vote:
 

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

 ITypeSearch 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;

#179396
Jun 09, 2017 15:06
Vote:
 

.WildCardQuery("*" + query + "*", x => x.SearchText) is probably what's causing the difference.

Also I would look into changing the unifiedsearch registry so you don't need to add all those types at query time.

#182024
Sep 07, 2017 22:11
* 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.