org.carrot2.source.google
Class GoogleDesktopDocumentSource

java.lang.Object
  extended by org.carrot2.core.ProcessingComponentBase
      extended by org.carrot2.source.SearchEngineBase
          extended by org.carrot2.source.SimpleSearchEngine
              extended by org.carrot2.source.xml.RemoteXmlSimpleSearchEngineBase
                  extended by org.carrot2.source.google.GoogleDesktopDocumentSource
All Implemented Interfaces:
IDocumentSource, IProcessingComponent

public class GoogleDesktopDocumentSource
extends RemoteXmlSimpleSearchEngineBase

Fetches documents from an instance of Google Desktop search engine.


Field Summary
 boolean keepHighlights
          Keep query word highlighting.
 String queryUrl
          Query URL.
 
Fields inherited from class org.carrot2.source.SearchEngineBase
compressed, documents, query, results, resultsTotal, start, statistics
 
Constructor Summary
GoogleDesktopDocumentSource()
           
 
Method Summary
protected  void afterFetch(SearchEngineResponse response)
          Called after a single search engine response has been fetched.
protected  String buildServiceUrl()
          Builds the URL from which XML stream will be fetched.
protected  SearchEngineResponse fetchSearchResponse()
          Requests and returns results from the underlying search engine.
protected  IResource getXsltResource()
          Returns the XSLT stylesheet that transforms the custom XML into Carrot2 compliant XML.
 
Methods inherited from class org.carrot2.source.xml.RemoteXmlSimpleSearchEngineBase
beforeProcessing, getPassword, getUser, getXsltParameters, init
 
Methods inherited from class org.carrot2.source.SimpleSearchEngine
process
 
Methods inherited from class org.carrot2.source.SearchEngineBase
clean, urlEncode
 
Methods inherited from class org.carrot2.core.ProcessingComponentBase
afterProcessing, dispose, getContext, getSharedExecutor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.carrot2.core.IProcessingComponent
afterProcessing, dispose
 

Field Detail

queryUrl

public String queryUrl
Query URL. Installation-specific URL at which Google Desktop search service is available. On Windows machines, the URL is available at the HKEY_CURRENT_USER\Software\Google\Google Desktop\API\search_url system registry key and Carrot2 will attempt to automatically read the value from the registry when run with Administrator provileges. Please consult Google Desktop API documentation for further instructions on how to determine the query URL on other systems.

See Also:
Google API
Attribute label:
Query URL
Attribute level:
Advanced
Attribute group:
Service

keepHighlights

public boolean keepHighlights
Keep query word highlighting. Google by default highlights query words in snippets using the bold HTML tag. Set this attribute to true to keep these highlights.

Attribute label:
Keep highlights
Attribute level:
Advanced
Attribute group:
Postprocessing
Constructor Detail

GoogleDesktopDocumentSource

public GoogleDesktopDocumentSource()
Method Detail

fetchSearchResponse

protected SearchEngineResponse fetchSearchResponse()
                                            throws Exception
Description copied from class: SimpleSearchEngine
Requests and returns results from the underlying search engine.

Overrides:
fetchSearchResponse in class RemoteXmlSimpleSearchEngineBase
Throws:
Exception - in case of problems with the underlying search engine

buildServiceUrl

protected String buildServiceUrl()
Description copied from class: RemoteXmlSimpleSearchEngineBase
Builds the URL from which XML stream will be fetched. This method will be called once per request processing cycle. Processing-time attributes will have been bound before this method the call to this method.

Specified by:
buildServiceUrl in class RemoteXmlSimpleSearchEngineBase

getXsltResource

protected IResource getXsltResource()
Description copied from class: RemoteXmlSimpleSearchEngineBase
Returns the XSLT stylesheet that transforms the custom XML into Carrot2 compliant XML. This method will be called once during component initialization. Initialization time attributes will have been bound before the call to this method.

Specified by:
getXsltResource in class RemoteXmlSimpleSearchEngineBase

afterFetch

protected void afterFetch(SearchEngineResponse response)
Description copied from class: SearchEngineBase
Called after a single search engine response has been fetched. The concrete implementation may want to override this empty implementation to e.g., clean or otherwise postprocess the returned results.

Overrides:
afterFetch in class SearchEngineBase


Copyright (c) Dawid Weiss, Stanislaw Osinski