close ad
 
Important WebAssist Announcement
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 6:56 am by nibo | Last modified 8/19/2011 11:04 am by nibo | 4237 views | 3 replies

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:
dd250895.aspx


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 = 'http://api.bing.net/json.aspx?AppId='+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:
&Sources=Web

sets the source type to Web only. you can set it to use multiple source types by adding a plus sign between them:
&Sources=Web+News+Images


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


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 = 'http://api.bing.net/json.aspx?AppId='+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>");

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

Content

rating

Layout

rating

Ease of use

rating

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