Try our conversational search powered by Generative AI!

Applying site specific best bets


Is there any magic that I'm missing to applying site specific best bets? 

Currently we are just using the .ApplyBestBets() function and it doesn't seem to take any sitedefinition info. But none of the site specific best bets show up just the global ones.

Dec 02, 2014 16:55

Hi Petter!

I tested in EPiServer Find 8.9 and it all works great for me. Maybe you have an older version?

I tested added one best bet for site1 and one for site2.

Testing the best bet for site1 in site1 succeeded. Testing the best bet for site2 in site1 failed.

Testing the best bet for site2 in site2 succeeded. Testing the best bet for site1 in site2 failed.

So at least it seems to work as intended for me...

Maybe you did not have UnifiedSearchFor? My query looks like this:

ITypeSearch<ISearchContent> query = SearchClient.Instance.UnifiedSearchFor(q).ApplyBestBets<ISearchContent>();

model.Results = query.GetResult();

Dec 04, 2014 14:51

Hi Samuel,

Thanks for helping out with the testing. 

No I'm not using the UnifiedSearchFor. I'm using the typed search. Query looks something like:

var query = searchInstance.Search<BasePageData>(Language.Swedish)
                                            .InField(x => x.SearchTitle())
                                            .AndInField(x => x.SearchText())
                                            .AndInField(x => x.SearchCategories(), 0.25)
Lots of filters added
Projection added
                                                query.Skip((currentPage.PagingPage - 1) * currentPage.HitsToShow)

Do you get the same result using typed search and searching in fields?

Dec 04, 2014 16:38

Hi Petter!

I did not get your code to work either. But I think GetContentResult() should be used when working with the EPiServer CMS. I think GetRetResult is more used for non EPiServer objects, but I might be wrong. Quite new to Find too ;)

I modified your code a bit and got it to work. The query I uses was:

var query = SearchClient.Instance.Search<SitePageData>(Language.English)
          .InField(x => x.SearchTitle())
          .AndInField(x => x.SearchText())
          .AndInField(x => x.SearchCategories(), 0.25)

          var result = query.Skip(skipNumber)

As you can see the most significant change is just using .GetGontentResult() instead of .GetResult(). 

Is that working for you?

Dec 05, 2014 10:12

He is using projections, so GetContentResult cannot be used. However, it should work with GetResult as well.

Petter, which language(s) has the best bet been added to? Also, is Swedish enabled as a stemming language on your index?

Dec 05, 2014 15:50

The best bet is added to "all languages". Not sure about the stemming part as we aren't the Licence partner for the customer. But can I check that somewhere?

Dec 05, 2014 16:03

Try client.Settings.Languages

Dec 08, 2014 12:14

Right. So we got English and Swedish as languages on the index.

Dec 09, 2014 11:02

Sounds strange. Could it be something wrong with the context of your search? If you debug, is the current site property correct if you invoke:

Dec 09, 2014 13:20

Hmm no getting the right CurrentSite. And well if that was Fubar wouldn't it just give me all the statistics on one of the sites? Currently I'm not getting any for a specific site but just on all.

Dec 09, 2014 14:21

Not sure how your usings look like but if you have added

using EPiServer.Find.Statistics;

then try 

using EPiServer.Find.Framework.Statistics;

instead. I had problems with this on another site where for example my searches were stored under "All websites" instead of the specific websites. 

Dec 09, 2014 14:29

Ha! Just did that for a nother issue I was having with the tracking and was thinking it could be related.

I'll give it a spin and see where we land but guessing it will solve the issue for me. 

Thanks for all the help guys

Dec 09, 2014 14:46
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.