Rails site search with Bing API example? - ruby-on-rails

Previously these folks promised a release of their implementation of Bing search for their site at the following article: http://www.globalnerdy.com/2009/06/29/learnhub-powered-by-rails-searches-with-bing/
Is anyone familiar with a Ruby or Rails lib that would facilitate site search with Bing? Google just hasn't been a good match so far with their site search and a search with MS Bing, surprisingly, seems to be a much better solution.
Otherwise, an example of how to accomplish this, even without a lib and directly using the API, would be much appreciated.

While not a custom site search per se, you should be able to use RBing for accessing Bings search API. There's an introductory tutorial over at http://9astronauts.com/code/ruby/rbing/
To make it work like a site search, simply append a site:example.com to your queries and it will only return results from that domain. For example:
bing = RBing.new("YOURAPPID")
query = "something interesting"
results = bing.web("#{query} site:stackoverflow.com")
puts results.web.results[0].title
=> "javascript - How to illuminate a browser window/tab when something ..."

Related

Code to check whether site has been listed on search engines and directories

I am currently developing an application in Rails, which requires to check whether a website has been listed in Google, Bing, Yahoo, Yelp and Yellow Pages. From my research the best is to check site: domain.com on Google and Bing and look for results and check in Yahoo directory for the domain.
Is there any other way to do it? I mean some code snippet to check on domain's home page or using their API or something like that. Also how to check on Yelp and Yellow pages.
You can use mechanize and write web-style drivers
Google: do a search on your domain with this on the search term
site:checkmeout360.com
https://www.google.com/search?q=site%3A<SITE_NAME>.com
Try to see how yelp, yahoo, bing and yellow pages do indexing. Then you can use mechanize to automate the searching process for you, you can use mechanize to do the search like above with google, then write asserts (check if stuff you are looking for is on the search result)
Search engines don't appreciate automated queries that are sent their way.
Here is what Google has to say about it:
Google's Terms of Service do not allow the sending of automated queries of any sort to our system without express permission in advance from Google. Sending automated queries consumes resources and includes using any software (such as WebPosition Gold) to send automated queries to Google to determine how a website or webpage ranks in Google search results for various queries. In addition to rank checking, other types of automated access to Google without permission are also a violation of our Webmaster Guidelines and Terms of Service.

Is there a web search service/site either with an API or which works with YQL?

I'd like to make a tool which accesses a search engine programatically.
I've been enjoying using YQL recently and thought it might be useful since it can dig data out of HTML pages.
But I tried it with Google, Bing, and Yahoo search and they all seem to block YQL.
I wonder if there are some lesser-known web search sites that might work with YQL.
Or actually if there's still any search engine which offers an API that would be even better.
(In fact I'm only searching linguistics.stackexchange.com because the Stack Exchange APIs don't provide a way to search by text that I can find.)
Most search engine sites will block access from screen scrapers and other agents. YQL is designed to respect the robots.txt file, so on many sites like this it won't work.
Instead, I suggest moving a step above HTML screen scraping and using a published search API.
In YQL for example, there is a table which provides access to the Bing search results:
select * from microsoft.bing where query="soccer" and source in ("web","image")
You could also look at the Yahoo! BOSS API or using the Bing Search API directly.

Searching tweets published from Delicious with Twitter API

I am a new user in StackOverflow. I am developing a tool.
My problem is that I am trying get tweets published from Delicious ("X minutes ago via Delicious").
In Twitter API Documentation (https://dev.twitter.com/doc/get/search), I can see:
Originating from an application:
http://search.twitter.com/search.atom?q=landing+source:tweetie
I am copy & paste "http://search.twitter.com/search.atom?q=landing+source:tweetie" in web navigator. The example from Twitter API don't work!!! :S
However, I am trying others search applications, and WORK:
http://search.twitter.com/search.atom?q=landing+source:TweetDeck
http://search.twitter.com/search.atom?q=landing+source:twitterfeed
http://search.twitter.com/search.atom?q=landing+source:ping.fm
http://search.twitter.com/search.atom?q=landing+source:web
http://search.twitter.com/search.atom?q=landing+source:SocialOomph
http://search.twitter.com/search.atom?q=landing+source:tumblr
But when I try to search for Delicious, don't work:
http://search.twitter.com/search.atom?q=landing+source:Delicious
Why? I am try next, and don't work:
http://search.twitter.com/search.atom?q=landing+source:del.icio.us
http://search.twitter.com/search.atom?q=landing+source:icio.us
Exists solution to http://search.twitter.com/search.atom?q=landing+source:Delicious?
I am try to access to Twitter API IRC, but don't work... :S
Thank you very much, and I sorry my bad English. Regards! :)
With landing+source:Delicious there are no search results because there frankly aren't any recent tweets containing "landing" that were tweeted using Delicious.
The other source applications contain results because people have been tweeting "landing" using other apps, as you've noted.
But source:Delicious does work; try searching for other terms, like food+source:Delicious or happy+source:Delicious and you should see results.

Fuzzy match in sharepoint search engine?

In sharepoint 2007 sites, we can search for people or other contents. Is the search engine able to do fuzzy match so that "Micheal" can be corrected to "Michael"? If it's possible, does it need extra configuration?
I am also writing a custom webpart that uses sharepoint search service, a web service that has url like "http://site/_vti_bin/search.asm". Is it possible to use this service to do fuzzy search as well?
Thanks.
The Search Summary Web Part provides that capability: try searching SharePoint for "Microsfot" and you'll get a "Did you mean Microsoft?" prompt. However, I only seem to see it when I get no results at all, and it looks like it has some other limitations:
Threewill Wiki (posted by Kirk Liemohn)
I haven't seen that kind of matching used specifically, but you might get some ideas from the wildcard search web part on codeplex.

Highlight search terms in forum when coming from websearch

in the recent past i’ve noticed quite often that, when searching something with google and looking at one of the search results, that the search terms are bold on the site.
how can this be done? is it a feature of google which is messing around with other sites (i hope not!) or are some sites parsing the referrer and check for search engine links and try to hilight the search terms?
i’m curious for the answers
That feature works by looking at the http referer header sent by browser. This post should explain how it work: http://weblogtoolscollection.com/archives/2009/04/10/how-to-highlight-search-terms-with-jquery/
You have to look into http referrer http server variable, there You will find URL where user comes from.
I believe you can look in the HTTP headers for the referrer (i.e. the previous URL visited). If your visitor arrived from Google, that will be the URL of the search page. Sending this header is a feature of most web browsers and it's useful for things like this. As Google search results are GET queries, a standard referrer url looks like:
http://www.google.com/search?q=stack+overflow
You can parse these out to get the query terms and format appropriately using server side script. I'm sure there's a library to do this, but it wouldn't be hard to write one.
after googling around for a while i found a plugin for phpBB.
it can be found in their forums: http://www.phpbb.com/community/viewtopic.php?f=69&t=784615
it will take all popular search engines into account and hilight the search terms in the forum. reading the plugin is a great source of information

Resources