Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Get Started with Google OneBox for Enterprise : Page 4

Google OneBox for Enterprise is an API from the Google Search Appliance suite that uses well-tested aspects of Google's search technologies to serve intelligent, real-time information from enterprise systems.


advertisement
Defining Custom OneBox Modules
Creating a OneBox module is a three-step process: creating a trigger, selecting a provider, and formatting the results for output.

Creating a Trigger
A OneBox module trigger determines when the OneBox provider will be invoked. When a query is executed matching the rules specified by the trigger, the trigger is invoked. A trigger can be configured as one of the following:

  • Always On—The module will be invoked by every query
  • Keyword(s)—The module will be invoked by the keywords specified in the trigger definition
  • Regular Expression—The module will be invoked when the query matches a regular expression defined by the trigger
Selecting a Provider
The OneBox module provider is the entity that handles requests transmitted by the Google Search Appliance. The provider builds results based on the query and the query parameters.

There are two types of providers:

  • Internal—Internal providers gather information, referred to as "collections," directly from the Google Search Appliance
  • External—External providers gather information from external sources, specified by a provider URL
Formatting the Results
Each provider returns results as XML. The search appliance uses XSL templates embedded in the module definition file to transform the returned XML into the final output display format.

Creating a OneBox Provider
You can implement OneBox providers using any technology that can handle HTTP Get requests and return XML results. In Java, servlets fit these requirements. For example, the servlet shown in Listing 3 handles requests from a search appliance and returns OneBox results.

You can download the sample code for this article and test it yourself. You deploy the servlet in Listing 3 to your application server in the same manner as any standard Java servlet. Note that you should replace the body of the findModuleResults method to reflect your actual search results. The servlet adds each match to the array of ModuleResult objects returned from findModuleResults.

To deploy the servlet to your Google Search Appliance or appliance simulator, you must provide to the appliance or simulator a OneBox module configuration file that defines the necessary information required to find the servlet. In this case, assuming that the servlet is deployed to the URL http://localhost:8080/onebox/SampleDirectory, the OneBox module configuration file could be as simple as the following:

<?xml version="1.0" encoding="UTF-8"?> <GoogleEnterpriseSources xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <onebox type="external"> <name> directory_onebox </name> <description> This OneBox module queries for sample directory information. </description> <security userAuth="none"/> <trigger triggerType="keyword"> directory|dir|phone </trigger> <providerURL> http://localhost:8080/onebox/SampleDirectory </providerURL> <resultsTemplate> <!-- contents removed for the sake of brevity --> ... </resultsTemplate> </onebox> </GoogleEnterpriseSources>

After deploying the preceding OneBox module configuration file to your Google Search Appliance or appliance simulator, the appliance or simulator can redirect requests matching the trigger supplied in the configuration file to your OneBox provider servlet. In this case, because the trigger keywords are defined as directory|dir|phone, any search containing a combination of these keywords would trigger a call to the OneBox provider deployed to the URL http://localhost:8080/onebox/SampleDirectory.

 
Figure 3. Sample Search Results: Using a simple XSL result template, here's how the results of a search from a Web browser processed by the sample OneBox module servlet might look.
For example, the following query would trigger this provider servlet:

directory Doe

HTML results for the query depend on the resultTemplate element contents defined in the OneBox module configuration file. A simple example in a Web browser might look like Figure 3.

Using Google Search Appliance, a company can expose vital information using the same search technologies that Google uses to process global information on the web.

Google OneBox for Enterprise is an application programming interface (API) and framework that complements Google Search Appliance by facilitating access to real-time information in enterprise content repositories using a single search box that drives queries to provider modules.



Jeff Hanson has more than 18 years of experience in the software industry. He has worked as senior engineer for the Windows OpenDoc port and as lead architect for the Route 66 framework at Novell. He is currently Chief Architect for eReinsure, which specializes in providing frameworks and platforms for J2EE-based reinsurance systems. Jeff has also authored numerous articles and books.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap