orionsmith.com

  • Increase font size
  • Default font size
  • Decrease font size
Home The News Google Search Appliance (AppDev)

Google Search Appliance (AppDev)

E-mail Print PDF

My current project has the requirement to return custom search results from a Google Search Appliance formatted just so sweetly.   Lots of fine work was done with the standard GSA XSLT,the one on the appliance and configured through the appliance Administration. When it came time for development,  I found an open source library that really helps with this task. You can get it from Source Forge.  One class and three methods later, voila - Custom solution...

GSA-JAPI: Java API for interacting with the Google Search Appliance™

GSA


 
 Sample Method from GsaSearchObj Class...  Used to retrieve  results.. 
Must of the values are set as members of the class.
            public String queryGsaResponse(String searchTerm){

GSAClient client = new GSAClient(getScheme(),
m_gsaServerUrl ,
this.getM_gsaServerPort() ,
"/search");
GSAQuery query = new GSAQuery();
GSAQueryTerm term = new GSAQuery.GSAQueryTerm(searchTerm);

query.setQueryTerm(term);
query.setSiteCollections(new String[]{m_gsaEnv});
query.setFrontend(m_gsaEnv);
GSAResponse gsaResp = null;
String gsaXml = null;
try {
gsaResp = client.getGSAResponse(query);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

java.util.List myList = gsaResp.getResults();
StringBuffer sb = new StringBuffer();
sb.append("<table border='1' width='100%'>");

Iterator it = myList.iterator();
while ( it.hasNext() ){
GSAResult myitem = ((GSAResult)it.next());
sb.append("<tr>");
sb.append("<td>" + myitem.getTitle() + "</td>");
sb.append("<td>" + myitem.getSummary() + "</td>");
sb.append("<td>" + myitem.getUrl() + "</td>");
sb.append("</tr>");

}
sb.append("</table>");

return sb.toString();

}

 

 

Last Updated on Wednesday, 17 June 2009 20:00  

RSS Feed

OTN Discussion Forums: Message List - WebCenter - Interaction
Most recent forum messages

Contact Orion Smith

For Information Contact:
Orion Smith
Tel:281-257-8907
info@orionsmith.com


Read more...

 

 

Newsflash 1

Orion Smith - 10 Years of Outstanding Service!!

Read more...

 

 

Newsflash 2

The one thing about a Web site, it always changes! A CMS makes it easy to add Articles, content, images, videos, and more. Site administrators can edit and manage content 'in-context' by clicking the 'Edit' link. Webmasters can also edit content through a graphical Control Panel that gives you complete control over your site.

Read more...

 

 


Newsflash

Orion Smith - 10 Years of Outstanding Service!!