com.raritantechnologies.federated
Class FederatedSearch

java.lang.Object
  extended bycom.raritantechnologies.federated.FederatedSearch
All Implemented Interfaces:
IFederatedResultSet

public class FederatedSearch
extends java.lang.Object
implements IFederatedResultSet

This is the API layer for federated searches. Uses FederatedQueryProcessor to execute the search on each source, collects and organizes the responses.


Developed by Raritan Technologies Inc..

Author:
Kepler Gelotte

Field Summary
static int FULL_RESULTS
           
static int NO_RESULTS
           
static int PARTIAL_RESULTS
           
 
Constructor Summary
FederatedSearch()
          Constructor
FederatedSearch(int pQueryNum)
           
 
Method Summary
 void closeIndex(IResultSet res)
           
 void executeQuery()
          Starts the query running with a default page size of 10 starting at row 1.
 void executeQuery(int start)
          Starts the query running with a default page size of 10 starting at row start.
 void executeQuery(int start, int pageSize)
          Starts the query running with a default page size of pageSize starting at row start.
 void executeQuery(int start, int pageSize, OrderedMap queryParams)
           
 IResultSet getCurrentResults()
           
 int getErrorCount()
          Get the count of error messages that occurred.
 java.util.Iterator getErrorMessages()
          Returns an iterator over all error messages or null if there are none.
 int getMessageCount()
          Get the count of warning messages that occurred.
 java.util.Iterator getMessages()
          Returns an iterator over all warning messages or null if there are none.
 java.util.Iterator getResults()
          Returns an iterator over the result set accumulated so far.
 Hits getResults(java.lang.String luceneQuery)
          Returns a result set from the indexed collection.
 int getResultState()
          Return the state of progress of a source in the current query.
 java.util.Iterator getSourceNames()
           
 int getTotalDocs()
           
 int getTotalDocs(java.lang.String sourceName)
           
 void indexResult(IResult res)
          this is a callback method invoked for every row returned from FederatedQueryProcessor()
 void setPageSize(int pageSize)
          Set a pagesize
 void setQuery(java.lang.String query)
          Set a query.
 void setQueryNum(int queryNum)
           
 void setSearchWithinResults(boolean saveResults)
          Save results in an internally indexed collection for subsequent querying.
 void setSortSpec(java.lang.String field)
          Define field to order results returned.
 void setSortSpec(java.lang.String field, boolean ascending)
           
 void setSource(java.lang.String sourceName)
          Set a source by name defined in the XML config file.
 void setSource(java.lang.String sourceName, int timeout)
          Set a source by name defined in the config file with a timeout parameter (in seconds).
 void setSource(java.lang.String sourceName, int timeout, OrderedMap sourceParams)
           
 void setSource(java.lang.String sourceName, int timeout, OrderedMap sourceParams, ILoginInfo userInfo)
           
 void setSourceCallBack(java.lang.Object obj, java.lang.String methodName)
          This sets up a callback method triggered after every source returns.
 void setTotalDocs(java.lang.String sourceName, int totalDocs)
           
 void setUserName(java.lang.String userName)
          Set a userName for secure sites
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_RESULTS

public static final int NO_RESULTS
See Also:
Constant Field Values

PARTIAL_RESULTS

public static final int PARTIAL_RESULTS
See Also:
Constant Field Values

FULL_RESULTS

public static final int FULL_RESULTS
See Also:
Constant Field Values
Constructor Detail

FederatedSearch

public FederatedSearch()
Constructor


FederatedSearch

public FederatedSearch(int pQueryNum)
Method Detail

setSearchWithinResults

public void setSearchWithinResults(boolean saveResults)
Save results in an internally indexed collection for subsequent querying.


setQueryNum

public void setQueryNum(int queryNum)

setQuery

public void setQuery(java.lang.String query)
Set a query. Syntax: [+|-][field:]term ... The + means required, while - means prohibited. The field to search in. Default is content. The term is the word you are searching for


setUserName

public void setUserName(java.lang.String userName)
Set a userName for secure sites


setPageSize

public void setPageSize(int pageSize)
Set a pagesize


setSource

public void setSource(java.lang.String sourceName)
               throws SearchSourceException
Set a source by name defined in the XML config file.

Throws:
SearchSourceException

setSource

public void setSource(java.lang.String sourceName,
                      int timeout)
               throws SearchSourceException
Set a source by name defined in the config file with a timeout parameter (in seconds). A timeout of 0 means no timeout.

Throws:
SearchSourceException

setSource

public void setSource(java.lang.String sourceName,
                      int timeout,
                      OrderedMap sourceParams)
               throws SearchSourceException
Throws:
SearchSourceException

setSource

public void setSource(java.lang.String sourceName,
                      int timeout,
                      OrderedMap sourceParams,
                      ILoginInfo userInfo)
               throws SearchSourceException
Throws:
SearchSourceException

setSortSpec

public void setSortSpec(java.lang.String field)
Define field to order results returned.


setSortSpec

public void setSortSpec(java.lang.String field,
                        boolean ascending)

getResultState

public int getResultState()
Return the state of progress of a source in the current query. The values are: STARTED, PARTIAL, COMPLETE.


getCurrentResults

public IResultSet getCurrentResults()

getResults

public java.util.Iterator getResults()
Returns an iterator over the result set accumulated so far.


getResults

public Hits getResults(java.lang.String luceneQuery)
                throws ParseException
Returns a result set from the indexed collection. This allows "search within results" functionality.

Throws:
ParseException

getTotalDocs

public int getTotalDocs()

executeQuery

public void executeQuery()
Starts the query running with a default page size of 10 starting at row 1.


executeQuery

public void executeQuery(int start)
Starts the query running with a default page size of 10 starting at row start.


executeQuery

public void executeQuery(int start,
                         int pageSize)
Starts the query running with a default page size of pageSize starting at row start.


executeQuery

public void executeQuery(int start,
                         int pageSize,
                         OrderedMap queryParams)

getMessageCount

public int getMessageCount()
Get the count of warning messages that occurred.


getMessages

public java.util.Iterator getMessages()
Returns an iterator over all warning messages or null if there are none.


getErrorCount

public int getErrorCount()
Get the count of error messages that occurred.


getErrorMessages

public java.util.Iterator getErrorMessages()
Returns an iterator over all error messages or null if there are none.


setSourceCallBack

public void setSourceCallBack(java.lang.Object obj,
                              java.lang.String methodName)
This sets up a callback method triggered after every source returns.


indexResult

public void indexResult(IResult res)
this is a callback method invoked for every row returned from FederatedQueryProcessor()


closeIndex

public void closeIndex(IResultSet res)

setTotalDocs

public void setTotalDocs(java.lang.String sourceName,
                         int totalDocs)
Specified by:
setTotalDocs in interface IFederatedResultSet

getTotalDocs

public int getTotalDocs(java.lang.String sourceName)
Specified by:
getTotalDocs in interface IFederatedResultSet

getSourceNames

public java.util.Iterator getSourceNames()
Specified by:
getSourceNames in interface IFederatedResultSet