com.raritantechnologies.searchApp
Class QueryProcessorFilter

java.lang.Object
  extended bycom.raritantechnologies.searchApp.QueryProcessorFilter
All Implemented Interfaces:
IQueryProcessor
Direct Known Subclasses:
AddNavigatorQueryProcessorFilter, CachingQueryProcessorFilter, ClusteringQueryProcessorFilter, DateFormatQueryProcessorFilter, DeduplicatingQueryProcessorFilter, DynamicQueryProcessorFilter, FederatedQueryProcessorFilter, FormattingQueryProcessorFilter, LoggingQueryProcessorFilter, ParameterAppender, ParameterRepackager, PassInputToOutputFilter, ProfilerQueryProcessorFilter, QueryCookerFilterSource, QueryMapFilter, QueryParserFilter, QueryProcessorResultSetFilter, RecommendQueryProcessorFilter, RegExprQueryProcessorFilter, ResultFieldQueryProcessorFilter, ResultSelector, ResultSetProcessorQueryFilter, RQLQueryProcessorFilter, SearchHistoryQueryProcessorFilter, SelectionFilter, SortingQueryProcessorFilter, SQLQueryProcessorFilter, TaxonomyRankQueryFilter, TermProximityQueryProcessorFilter, TimeStampQueryFilter, UserERoomsQueryProcessorFilter, VerboseQueryProcessorFilter, XMLQueryProcessorFilter

public class QueryProcessorFilter
extends java.lang.Object
implements IQueryProcessor

Base class for QueryProcessor filters which are used to construct query / result processing pipelines. A QueryProcessorFilter both extends and contains an IQueryProcessor which are used to execute searches against some data source. The QueryProcessor filters can modify the query parameter set before executing it, can modify the result set or both. Examples - query logging, result categorizing, result tagging, secondary search or lookup operations.

XML Configuration Template:
   <SourceType name="[filtered Source Name ]" 
                  inputSource  = "[ maps to the input source - use [Session:sourceKey] for session cached source name ]"
                  type="[ the real Type ]"
                  sourceFactoryClass="com.raritantechnologies.searchApp.QueryProcessorFilterFactory"
                  filterClass  = "[ subclass of com.raritantechnologies.searchApp.QueryProcessorFilter ]" >

    <!-- Any initialization information needed by the filterClass -->

  </SourceType>

   <!-- Alternatively, the QueryProcessorFilter can include a nested InputSource tag: -->
   <SourceType name="filteredSource Name" 
                    type="realType"
                  sourceFactoryClass="com.raritantechnologies.searchApp.QueryProcessorFilterFactory"
                  filterClass  = "[ subclass of com.raritantechnologies.searchApp.QueryProcessorFilter ]" >

    <!-- Any initialization information needed by the filterClass -->
    <InputSource name="name of input source"
                    sourceFactoryClass="[ class of SearchSourceFactory ]"
                    queryProcessorClass="[ class of IQueryProcessor ]" >

    </InputSource>

  </SourceType>
  

QueryProcessorFilter implements the IQueryProcessor interface using the Proxy-pattern. This means that QueryProcessorFilters can be nested.

This figure shows some of the QueryProcessorFilters that have been implemented:


Developed by Raritan Technologies .

Author:
Ted Sullivan

Field Summary
protected  IQueryProcessor theQueryProcessor
           
 
Constructor Summary
QueryProcessorFilter()
           
QueryProcessorFilter(IQueryProcessor theQueryProcessor)
           
QueryProcessorFilter(IQueryProcessor theQueryProcessor, QueryProcessorFilter nextFilter)
           
 
Method Summary
protected  IResultSet doExecuteQuery(java.lang.Integer queryID, ISearchFieldMap searchMap, SourceLoginInfo[] sources, OrderedMap inputParameters, java.lang.Integer pageSize, java.lang.Integer startRec)
          Execution of the query - finds the "real" or proxy IQueryProcessor.
 IResultSet executeQuery(java.lang.Integer queryID, ISearchFieldMap searchMap, SourceLoginInfo[] sources, OrderedMap inputParameters, java.lang.Integer pageSize, java.lang.Integer startRec)
          Base implementation executes the query then starts filter chain.
 void filterResultSet(ILoginInfo sourceLogin, IResultSet resultSet)
          Subclasses should override this to do meaningful work.
 IQueryProcessor getQueryProcessor()
           
static IQueryProcessor getQueryProcessor(IQueryProcessor qp, java.lang.String className)
           
protected  SourceLoginInfo[] getRealSources(SourceLoginInfo[] sources)
           
 void initialize(org.w3c.dom.Element initElem)
          subclasses should override this to initialize themselves.
 void setNextFilter(QueryProcessorFilter nextFilter)
           
 void setQueryProcessor(IQueryProcessor queryProcessor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theQueryProcessor

protected IQueryProcessor theQueryProcessor
Constructor Detail

QueryProcessorFilter

public QueryProcessorFilter()

QueryProcessorFilter

public QueryProcessorFilter(IQueryProcessor theQueryProcessor)

QueryProcessorFilter

public QueryProcessorFilter(IQueryProcessor theQueryProcessor,
                            QueryProcessorFilter nextFilter)
Method Detail

executeQuery

public IResultSet executeQuery(java.lang.Integer queryID,
                               ISearchFieldMap searchMap,
                               SourceLoginInfo[] sources,
                               OrderedMap inputParameters,
                               java.lang.Integer pageSize,
                               java.lang.Integer startRec)
                        throws QueryProcessorException
Base implementation executes the query then starts filter chain.

Specified by:
executeQuery in interface IQueryProcessor
Parameters:
queryID - Unique ID for this query. Used by front end to manage queries and query pages. QueryProcessor may use this parameter to organize its search results, and to organize any state information it needs to process future page requests (future executeQuery( ) calls with the same queryID.
searchMap - Provides mapping information needed to translate the inputParameters into a search string appropriate for this type of QueryProcessor. Mapping information is obtained by the application framework from local configuration data.
sources - The LoginInfo and SearchSource(s) to be used for this query. The SearchSource(s) must be of the appropriate type for the QueryProcessor.
inputParameters - Form inputs. Use ISearchFieldMap to translate these into implementation and source-specific fields.
pageSize - Integer specifying the number of results to include in the returned Document. if null - use the default page size.
startRec - Integer specifying the starting record in the result set to be returned. if null - start with the first record.
Returns:
IResultSet containing result set.
Throws:
QueryProcessorException

doExecuteQuery

protected IResultSet doExecuteQuery(java.lang.Integer queryID,
                                    ISearchFieldMap searchMap,
                                    SourceLoginInfo[] sources,
                                    OrderedMap inputParameters,
                                    java.lang.Integer pageSize,
                                    java.lang.Integer startRec)
                             throws QueryProcessorException
Execution of the query - finds the "real" or proxy IQueryProcessor.

Throws:
QueryProcessorException

getRealSources

protected SourceLoginInfo[] getRealSources(SourceLoginInfo[] sources)

filterResultSet

public void filterResultSet(ILoginInfo sourceLogin,
                            IResultSet resultSet)
Subclasses should override this to do meaningful work. call super.filterResultSet( ) to do chaining.


setQueryProcessor

public void setQueryProcessor(IQueryProcessor queryProcessor)

getQueryProcessor

public IQueryProcessor getQueryProcessor()

setNextFilter

public void setNextFilter(QueryProcessorFilter nextFilter)

initialize

public void initialize(org.w3c.dom.Element initElem)
subclasses should override this to initialize themselves.


getQueryProcessor

public static IQueryProcessor getQueryProcessor(IQueryProcessor qp,
                                                java.lang.String className)