Try our conversational search powered by Generative AI!

UnifiedSearchFor() vs UnifiedSearch().For()

Vote:
 

I am working on a EPiServer CMS 7.14 website using EPiServer Find 8.7 for searches.

I have discovered that the two methods UnifiedSearchFor("query") and UnifiedSearch().For("query") differs in returned search hits.

What is the cause for this? I have not found anything in the documentation to explain why these two similiar method returns so different results.

var result = SearchClient.Instance.UnifiedSearchFor(searchQuery)
					.Skip((pageNumber - 1) * pageSize)
					.Take(pageSize)
					.ApplyBestBets()
					.Track()
					.StaticallyCacheFor(TimeSpan.FromMinutes(5))
					.GetResult();
var result = SearchClient.Instance.UnifiedSearch().For(searchQuery)
					.Skip((pageNumber - 1) * pageSize)
					.Take(pageSize)
					.ApplyBestBets()
					.Track()
					.StaticallyCacheFor(TimeSpan.FromMinutes(5))
					.GetResult();

Which method is the correct one to use?

#120920
Apr 28, 2015 9:41
Vote:
 

Haven't investigated but I've always used .UnifiedSearchFor().

#120967
Apr 29, 2015 9:31
Vote:
 

There are two UnifiedSearchFor extensions. UnifiedSearchFor from EPiServer.Find namespace calls UsingUnifiedWeights extension, which might affect search results if you have customized property weights in Boosting view in Find admin UI. There is also UnifiedSearchFor extension in EPiServer.Find.Cms namespace that tries to resolve stemming language from content language preferred culture and then delegates call to the same method from EPiServer.Find namespace. When UnifiedSearch().For() is used stemming language is not resolved unless explicitly specified. Here is more detailed explanation.

#121045
Apr 30, 2015 11:42
Vote:
 

Thanks for the fast reply.

I tried the UsingUnifiedWeights which did explain a few things.

However, the situation I am facing is that when using the method UsingUnifiedWeights the search does not include non-code meta properties for document files, such as author.

Why are the meta properties not included in search when using UsingUnifiedWeights? How do I include them?

#121135
May 04, 2015 10:05
* 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.