Integrating Google's Web API services into a Domino application

Source: Internet
Author: User
Tags zip

In the face of Google's current and expanding index of 30多亿个 Web pages, it is easy to understand that it is one of the best tools for performing industry-intensive searches on the internet. In addition to the number of WEB pages, the high quality of search results is due to its proprietary search algorithm, which is based on relevance and popularity. Recent reports suggest that Google responds to 200 million search requests in 88 different languages per day (averaging 2,300 requests per second!). )。 According to Searchenginewatch.com's survey, Google processed 75% of all web-based queries.

Obviously, many Web users are familiar with Google and its search features. The less-known fact is that you can use Google's Web API service to integrate Google's search functionality into your Domino application (as we'll see in the next section, you can download the API for free). This article describes how to add Google's search capabilities to your Domino application. We will briefly describe the Google API and how they work. Then we'll look at a sample application that integrates the Google search feature with the Domino application. Finally, we will provide some ideas on how to expand and customize this simple example to end the discussion in this article. (All of the examples that appear in this article are contained in a Domino database that you can download from sandbox.) )

This article assumes that you are an experienced Notes application developer who is familiar with writing Domino agents. While the advanced Java experience is not necessary to understand our example, it is highly recommended that you understand some of the basics of Java.

Google API

To use Google's API, download the Google Web API Developer Toolbox (Googleapi.zip) from Google's Web API download page and create a free Google account to obtain a license key. This key allows you to perform up to 1,000 searches per day (you must include this key in your query when you issue a search request). This is done programmatically, so the user does not have to type the key every time the query is executed. The developer toolkit comes with documentation and examples that give you a basic understanding of how Google's automated search works.

After you download the Googleapi.zip, unzip it to the C:\Googleapi directory. You can then quickly call the Web api:java-cp googleapi.jar com by typing the following command at an MS-dos command prompt. Google.soap.search.GoogleAPIDemo <key> search Lotus Domino > result.html, where < key > is your registration key, "Lotus Domino" Is the item you want to search for, result.html is the name of the file you want to write the search results to. For example, the following example:

Listing 1. Search results

...
Start Index = 1
End Index = 10
Estimated Total Results Number = 663000
...

Shows the top 10 results in the estimated 663,000 query results.

However, if you experiment with the same query on Google Web site, you may get different results. For example, the same query on "Lotus Domino" on Google will produce an estimated 596,000 results. (Google API support team has confirmed that the Web API and Google site itself use the same search engine and index page, the results of the nuances may be the Google maintenance of many data centers caused by.) )

Quick glance at the Googleapidemo.java in the Googleapi directory:

Listing 2. Snippets of code excerpted from Googleapidemo.java

...
GoogleSearch s = new GoogleSearch();
...
GoogleSearchResult r = s.doSearch();
...

You can see that the Dosearch () method invokes the Google search after setting the license key and the search string properties.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.