close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Results different to Bing web site

Thread began 8/19/2011 9:56 am by nibo | Last modified 8/19/2011 2:04 pm by Jason Byrnes | 3078 views | 3 replies |


Results different to Bing web site

I've been working some more with the Bing Search Toolkit and have noticed that when I do a search for the same keyword using I can get different results. i.e. search on my site returns 1 result, search on Bing returns 3 results. Why would this be?

I also see that the results returned on have the search keyword highlighted in bold within then result description text and the description text that is shown uses a section of text that is near my search term on the page. How do I get the same functionality with the Bing Search Toolkit?


I've been doing some more searches and comparing the WA Bing Search Toolkit results with that of the Bing web site and they are VERY different. The WA BST results are less relevant, which means that there seems to be very little point in using this extension.

Have I perhaps done something wrong when setting up the extension? Why would the results be so different? Has Bing set-up their API so that the results are worse than using their web site? I can't imagine they have.

Have Bing perhaps changed the API and the WA code needs to be updated?

Sign in to reply to this post

Jason ByrnesWebAssist

There are a few things that could provide different results, for one thing, the Bing search Toolkit is set to use the "Web" Source Type parameter:

to edit the source types used in search, you can edit the webassist/bing/bing_search_tk.js file.

in the following line:

var url = ''+Bing_appID+'&Version=2.2&Sources=Web&Query='+encodeURIComponent(query)+( (Bing_sites) ? '+site:'+encodeURIComponent(Bing_sites) : "" )+'&Web.Count='+Bing_page_size+'&Web.Offset='+start+'&JsonType=callback&JsonCallback=showBingResults';

this piece:

sets the source type to Web only. you can set it to use multiple source types by adding a plus sign between them:

there are other optional parameters that can added to the querystring like the Market parameter:

as for hit highlighting, that can be added by making the following changes in the webassist/bing/bing_search_tk.js file

1) add the &Options=EnableHighlighting querystring to the url variable:

var url = ''+Bing_appID+'&Version=2.2&Sources=Web+News&Query='+encodeURIComponent(query)+( (Bing_sites) ? '+site:'+encodeURIComponent(Bing_sites) : "" )+'&Web.Count='+Bing_page_size+'&Web.Offset='+start+'&JsonType=callback&JsonCallback=showBingResults&Options=EnableHighlighting';

2) add the following function at the very end:

function ReplaceHighlightingCharacters(text, beginStr, endStr)
// Replace all occurrences of U+E000 (begin highlighting) with
// beginStr. Replace all occurrences of U+E001 (end highlighting)
// with endStr.
var regexBegin = new RegExp("\uE000", "g");
var regexEnd = new RegExp("\uE001", "g");

return text.replace(regexBegin, beginStr).replace(regexEnd, endStr);

3) find the following line:

resultsTitle.innerHTML = '<a href="' + results[i].Url + '">' + results[i].Title + '</a>';

and change it to:

resultsTitle.innerHTML = '<a href="' + results[i].Url + '">' + ReplaceHighlightingCharacters(results[i].Title, "<strong>", "</strong>") + '</a>';

4) find this line:

resultsDesc.innerHTML = results[i].Description;

and change it to:

resultsDesc.innerHTML = ReplaceHighlightingCharacters(results[i].Description, "<strong>", "</strong>");
Sign in to reply to this post


Thanks for the reply Jason.

I had read about the Source Type parameter, however I was happy to have "Web" as the default. As a test I added both News and Images to the query and got the following results:

Sources=Web+News: Works as before.
Sources=Web+Images: Invalid API Key.
Sources=Web+News+Images: Invalid API Key.
Sources=News: An unknown error has occurred.
Sources=Images: Invalid API Key.

Sadly couldn't see any examples in that link to MSDN of how to add the parameter, however I guessed at "&Market=en-GB" which I placed at the end of the query string, however it did not change the results.

I've implemented those changes and all working great. In fact I changed the highlight from <strong> to a CSS style to change the background colour.

All those extra touches are great, however if I can't get the results that the API is returning to better match the results that I'd get from a search then sadly I can't see the Bing Search Toolkit being of any use to me on the site I am developing.

I've read many other people posting online that the API returns results that are significantly different from What is WebAssist's comment on this situation and what is the solution?

Thanks again.

Sign in to reply to this post

Jason ByrnesWebAssist

My apologies, to use the Image source type, use Image (singular) not Images:


I'm not 100% sure, but i think the Bing site uses InstantAnswer, RelatedSearch and Spell source types as well.

Bing does not have listed anywhere the exact parameters that the site uses for searches. getting the API search to mimic the search is a matter of configuring it to use the same parameters, since these are not documented, it's a guessing game.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...