Applying site specific best bets

Vote:
 

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.

#113999
Dec 02, 2014 16:55
Vote:
 

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();



#114106
Dec 04, 2014 14:51
Vote:
 

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)
                                            .For(args.Query)
                                            .InField(x => x.SearchTitle())
                                            .AndInField(x => x.SearchText())
                                            .AndInField(x => x.SearchCategories(), 0.25)
                                            .UsingSynonyms();
...
Lots of filters added
....
Projection added
..
                                                query.Skip((currentPage.PagingPage - 1) * currentPage.HitsToShow)
                                                .Take(currentPage.HitsToShow)
                                                .ApplyBestBets()
                                                .Track().StaticallyCacheFor(TimeSpan.FromMinutes(5))
                                                    .GetResult();

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

#114123
Dec 04, 2014 16:38
Vote:
 

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)
          .For(q)
          .InField(x => x.SearchTitle())
          .AndInField(x => x.SearchText())
          .AndInField(x => x.SearchCategories(), 0.25)
          .UsingSynonyms();

          var result = query.Skip(skipNumber)
                   .Take(pageSize)
                   .ApplyBestBets()                                                         
                .Track().StaticallyCacheFor(TimeSpan.FromMinutes(5))
                .GetContentResult();

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

Is that working for you?

#114152
Dec 05, 2014 10:12
Vote:
 

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?

#114201
Dec 05, 2014 15:50
Vote:
 

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?

#114202
Dec 05, 2014 16:03
Vote:
 

Try client.Settings.Languages

#114241
Dec 08, 2014 12:14
Vote:
 

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

#114288
Dec 09, 2014 11:02
Vote:
 

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:

ServiceLocator.Current.GetInstance<ISiteIdentityLoader>().CurrentSite;
#114296
Dec 09, 2014 13:20
Vote:
 

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.

#114300
Dec 09, 2014 14:21
Vote:
 

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. 

#114301
Dec 09, 2014 14:29
Vote:
 

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

#114302
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.