Having problems with ApplyBestBets()

Vote:
 

I am having issues using ApplyBestBets() on a query.

I have creted a best bet in my find index to return a result for the term "red". 

The page I have set to be returned for "red" does not contain the word at all.

I have created a search in c# like this:

                    var query =
                        SearchClient.Instance.UnifiedSearchFor("red")
                        .Take(100)
                        .ApplyBestBets();

                    var results = query.GetResult();

When running the code, zero results are returned.

I have ensured the page that "red" is meant to return as per the best bet has been indexed and when using the same query to search for a term that is on that page, the page is returned correctly.

I am using the latest version of the EPiServer Find dll's (7.0.586.16)

Am I miss understand how best bets works or doing something wrong?

Thanks,

Adam

 

#72760
Jun 27, 2013 18:13
Vote:
 

A best bet needs to be in the resultset, if so it'll be moved up as the first hit.

#73015
Jul 04, 2013 10:35
Vote:
 

Actually, I _believe_ the page should be returned even if it isn't in the resultset as long as there isn't a filter applied that excludes it. Could you try to remove the best bet and add it again to eliminita any weird referencing errors?

#73018
Jul 04, 2013 11:34
Vote:
 

I've added and removed it a number of times now with no luck.

I have also setup another scenario as per Johans response where the page for the best bet is in the search result set. Even in this scenario, the result is not displayed to the top (it is actually the last result in a result set of 4 pages).

 

 

#73021
Jul 04, 2013 12:32
Vote:
 

Hmm, seems really strange. Do you specify language when you add the best bet?

#73023
Jul 04, 2013 12:38
Vote:
 

Nope - I'm not specifying a site identity either so both the language and site are set to 'All'.

#73025
Jul 04, 2013 12:42
Vote:
 

Hmm, I'm afraid I'm at a loss. Is the code you posted the _exact_ code you are using? If so, could you try and see if calling ApplyBestBets before Take makes any difference. It shouldn't, but...

#73027
Jul 04, 2013 12:44
Vote:
 

Thanks Joel - Have tried moving the ApplyBestBets but still no luck.

How does best bets actually work?

I have been watching the json requests sent to Find in fiddler and there are no differences between the queries when ApplyBestBets() is added to the query or not.

#73031
Edited, Jul 04, 2013 12:56
Vote:
 

The criteria (searched text, language etc) and best bet "target" (reference to the page) is stored in the database (in the DDS). ApplyBestBets retrieves all best bets from the database (or rather cache) and sees if there is any whos criteria matches the query in the search request. If a match is found the search request is modified to include the page explicitly + a major boost factor for it.

If you're not seeing any difference in Fiddler it seems the query isn't modified meaning most likely that the criteria doesn't match. As for why I can't really say.

Can you get it to work with a different page and search term?

Also, IF the code you posted above is abbreviated or somehow different than from what you're running I'd love to see the exact code you are using?

#73032
Jul 04, 2013 13:06
Vote:
 

The code is exact, except that I pass in the term as a parameter so its not hardcoded to "red".

I am still running the example described by Johan where the page I have applied the best bet to is in my search results. For clarity this is what I have setup.

 

Best Bet Setup

Term: 'cheese'

Best Bet: Yarg (page:23)

All Sites, All Languages

 

(This page Yarg contains the word cheese on it)

 

After running the following query:

var query =
    SearchClient.Instance.UnifiedSearchFor("cheese")
    .Take(100)
    .ApplyBestBets();

    

I get a resultset of 5 matches (lots of cheese on my website!) where the Yarg page is in the 5th position.

first result score = 2.3443196

fith result score = 0.36629993

#73037
Jul 04, 2013 14:44
Vote:
 

You selected "all languages, but do you have any supported languages installed on your index?
I took quick look in the OptimizationsSearchExtensions class, and it might look like there is a supported languages check that fails if you do not have any supported languages installed in your index - it will exit before trying to fetch any best bets.

#73043
Jul 04, 2013 15:15
Vote:
 

When I created the index, I selected English - I dont thinks it possible to create an index without selecting a lanauge.

My site is configured to use en-GB. I can see in the index explorer my pages contain a language ID of en-GB.

Could this be the problem - Does my site need to be using just EN?

Im not really in the position to change my site language to EN as its alreday full of en-GB content.

 

#73055
Jul 04, 2013 16:43
Vote:
 

Ah! With an on-premise installation you do not need to select a language. You should not need to change your site language. But you could try to change your query to this:

UnifiedSearchFor("red", Language.English)

    

I think that should work. 

#73084
Jul 05, 2013 11:10
Vote:
 

YES! Thanks Per - That has fixed it :)

Also to note - As Joel said, the best bet page does not need to be in the results set of the search to appear.

 

Many thanks for the help guys.

Adam

 

#73085
Jul 05, 2013 11:18
Vote:
 

Also to note - As Joel said, the best bet page does not need to be in the results set of the search to appear.

Great! I'm sure this was the case in earlier in the service though (not the client libs). Can't recall if I got feedback that it was fixed and it wasn't a big deal for us or client.

#73086
Jul 05, 2013 11:22
Vote:
 

Johan, either that or I misinformed you. I do recall having said at some point that it did have to be in the result :)

#73088
Jul 05, 2013 11:32
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.