atg.search.routing
Class RoutingSearchService

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.search.routing.RoutingSearchService
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class RoutingSearchService
extends GenericService

Processes all search requests.


Field Summary
static java.lang.String APP_SERVER_TYPE
           
static java.lang.String CLASS_VERSION
           
static java.lang.String ID_SPACE
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
RoutingSearchService()
           
 
Method Summary
 atg.search.client.SearchSession beginSession()
           
 java.lang.String beginSession(SessionConfig pSessionConfig)
          Start a search session.
 void doStartService()
          This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values.
 void endSession(java.lang.String pSessionXml)
          This method doesn't do anything.
protected  MergeRequest generateMergeRequest(ClientRequest request, java.util.List engineResponses)
          Generates merge request
protected  MergeRequest generateMergeRequest2(SearchRequest request, java.util.List engineResponses)
          Generates merge request
 java.lang.String getAppServerType()
          Return the app server type.
 atg.service.cache.persistent.CacheService getCacheService()
           
 int getDefaultMergeBufferSize()
           
 long getMaxUncachedRequestDurationMs()
          The maximum amount of time, in milliseconds, that a search request can take before it will be cached.
 atg.adapter.gsa.GSARepository getRepository()
           
 RoutingSystemService getRoutingSystemService()
           
 SearchEngine getRunningSearchEngineForPartition(SearchEnvironment env, PhysicalPartition part)
           
 java.util.Collection getSearchEnvironmentTargets()
           
 SearchStrategy getSearchStrategyService()
           
 SearchStrategy.StrategyType getStrategyType()
           
 boolean isKeepingResponseXml()
           
 Results search(ClientRequest request, java.lang.String envName)
          Submits the request to the specified search environment.
 QueryRequest.Response search(QueryRequest request)
          Entrypoint for query request.
 void setCacheService(atg.service.cache.persistent.CacheService pCacheService)
           
 void setDefaultMergeBufferSize(int defaultMergeBufferSize)
           
 void setKeepingResponseXml(boolean pKeepingResponseXml)
           
 void setMaxUncachedRequestDurationMs(long pDuration)
          The maximum amount of time, in milliseconds, that a search request can take before it will be cached.
 void setRepository(atg.adapter.gsa.GSARepository repository)
           
 void setRoutingSystemService(RoutingSystemService routingSystemService)
           
 void setSearchStrategyService(SearchStrategy pSearchStrategy)
           
 void setStrategyType(SearchStrategy.StrategyType pStrategyType)
           
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APP_SERVER_TYPE

public static final java.lang.String APP_SERVER_TYPE
See Also:
Constant Field Values

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
See Also:
Constant Field Values

ID_SPACE

public static final java.lang.String ID_SPACE
See Also:
Constant Field Values
Constructor Detail

RoutingSearchService

public RoutingSearchService()
Method Detail

getRepository

public atg.adapter.gsa.GSARepository getRepository()

setRepository

public void setRepository(atg.adapter.gsa.GSARepository repository)

getDefaultMergeBufferSize

public int getDefaultMergeBufferSize()

setDefaultMergeBufferSize

public void setDefaultMergeBufferSize(int defaultMergeBufferSize)

getSearchStrategyService

public SearchStrategy getSearchStrategyService()

setSearchStrategyService

public void setSearchStrategyService(SearchStrategy pSearchStrategy)

isKeepingResponseXml

public boolean isKeepingResponseXml()

setKeepingResponseXml

public void setKeepingResponseXml(boolean pKeepingResponseXml)

getStrategyType

public SearchStrategy.StrategyType getStrategyType()

setStrategyType

public void setStrategyType(SearchStrategy.StrategyType pStrategyType)

getRoutingSystemService

public RoutingSystemService getRoutingSystemService()

setRoutingSystemService

public void setRoutingSystemService(RoutingSystemService routingSystemService)

setCacheService

public void setCacheService(atg.service.cache.persistent.CacheService pCacheService)

getCacheService

public atg.service.cache.persistent.CacheService getCacheService()

setMaxUncachedRequestDurationMs

public void setMaxUncachedRequestDurationMs(long pDuration)
The maximum amount of time, in milliseconds, that a search request can take before it will be cached. Set this value to cache only queries that take over the specified amount of time. You might want to do this if normal caching is degrading performance.

The default value of zero (0) means cache all queries.

Parameters:
pDuration - the maximum request time for non-cached queries or zero to disable this feature.

getMaxUncachedRequestDurationMs

public long getMaxUncachedRequestDurationMs()
The maximum amount of time, in milliseconds, that a search request can take before it will be cached. Set this value to cache only queries that take over the specified amount of time. You might want to do this if normal caching is degrading performance.

The default value of zero (0) means cache all queries.

Returns:
the maximum request time for non-cached queries, or zero to disable this feature.

doStartService

public void doStartService()
                    throws ServiceException
Description copied from class: GenericService
This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values. The Service should override this method to start any processes it requires.

Overrides:
doStartService in class GenericService
Throws:
ServiceException - if the Service had a problem starting up

beginSession

public java.lang.String beginSession(SessionConfig pSessionConfig)
                              throws RoutingException
Start a search session. This method attempts to obtain the session ID from the current HTTP request. If there is no current request (this method has not been called as part of an HTTP request) then this method will return a null session ID.

Parameters:
pSessionConfig - the session configuration
Returns:
the session ID or null
Throws:
RoutingException

endSession

public void endSession(java.lang.String pSessionXml)
                throws RoutingException
This method doesn't do anything.

Parameters:
pSessionXml - ignored
Throws:
RoutingException

beginSession

public atg.search.client.SearchSession beginSession()
                                             throws SearchClientException
Throws:
SearchClientException

getAppServerType

public java.lang.String getAppServerType()
Return the app server type. In this case, it's "local"

Returns:
the app server type

getRunningSearchEngineForPartition

public SearchEngine getRunningSearchEngineForPartition(SearchEnvironment env,
                                                       PhysicalPartition part)
Parameters:
part - partition of interest
Returns:
a running SearchEngine for a given Index Partition, or null if no such SearchEngine exists

generateMergeRequest

protected MergeRequest generateMergeRequest(ClientRequest request,
                                            java.util.List engineResponses)
Generates merge request

Parameters:
request - the original request. merge settings come from the mergeSettings optional mergeSettings attribute in the request's attribute map
engineResponses - the SearchEngineResponses for the request
Returns:
xml-encoded merge request for the provided request and responses

generateMergeRequest2

protected MergeRequest generateMergeRequest2(SearchRequest request,
                                             java.util.List engineResponses)
Generates merge request

Parameters:
request - the original request. merge settings come from the mergeSettings optional mergeSettings attribute in the request's attribute map
engineResponses - the SearchEngineResponses for the request
Returns:
xml-encoded merge request for the provided request and responses

search

public Results search(ClientRequest request,
                      java.lang.String envName)
               throws RoutingException
Submits the request to the specified search environment.

Parameters:
request - a search request
envName - name of the search environment to search, in this format:

envName[:[logicalPartitionName]:[service-specific-identifier]:[physicalPartitionId]] Note that if the target includes more than just the envName, then all of the colons are required. For example, myEnvName:myLPName::, or myEnvName::mySvcId:, or myEnvName:myLPName::myPhysicalPartitionId.

Returns:
Results object built up from XML returned from the search engine(s)
Throws:
RoutingException - if anything is wrong with the search or the environment

search

public QueryRequest.Response search(QueryRequest request)
                             throws SearchClientException
Entrypoint for query request. The response will have the request ID and the search target names that were used

Parameters:
request - query request
Returns:
response
Throws:
SearchClientException

getSearchEnvironmentTargets

public java.util.Collection getSearchEnvironmentTargets()
                                                 throws SearchClientException
Returns:
Collection of SearchEnvironmentTarget
Throws:
SearchClientException