org.openanzo.indexer
Interface ISearch

All Known Implementing Classes:
LuceneSearch

public interface ISearch

Used for searching, can be used to iterate over search results. WWW: Add something to get a result iterator.

Author:
Wing Yung (wingyung@us.ibm.com)

Method Summary
 int executeQuery(IQuery query)
          Executes the given query, returning the number of hits.
 java.util.List<IResult> getAllResults()
          Gets all results.
 java.util.List<IResult> getNextResults()
          Gets the next results, at most pageSize results.
 int getNumHits()
          Returns the number of hits for the current search after it has been executed.
 int getPageSize()
          Gets the pageSize for getNextResults().
 java.util.List<IResult> getSpecifiedResults(int startIndex, int numResults)
          Gets the specified range of results.
 boolean hasMoreResults()
          Determine if there are more results.
 void initialize(java.util.Properties properties)
           
 void postQuery()
          Should be called when all results have been obtained.
 void preQuery()
          Should be called before a query is executed.
 void setPageSize(int pageSize)
          Sets the pageSize for getNextResults().
 

Method Detail

initialize

void initialize(java.util.Properties properties)
                throws IndexerException
Parameters:
properties - configuration properties for this search object
Throws:
IndexerException

setPageSize

void setPageSize(int pageSize)
Sets the pageSize for getNextResults().

Parameters:
pageSize - maximum number of results returned when getNextResults() is called

getPageSize

int getPageSize()
Gets the pageSize for getNextResults().

Returns:
the pageSize for getNextResults().

getNumHits

int getNumHits()
               throws IndexerException
Returns the number of hits for the current search after it has been executed.

Returns:
the number of hits for the current search
Throws:
IndexerException

executeQuery

int executeQuery(IQuery query)
                 throws IndexerException
Executes the given query, returning the number of hits. Extract the results with getNextResults() or getAllResults().

Parameters:
query - text of query to run
Returns:
the number of hits in the results
Throws:
IndexerException

preQuery

void preQuery()
              throws IndexerException
Should be called before a query is executed.

Throws:
IndexerException

postQuery

void postQuery()
               throws IndexerException
Should be called when all results have been obtained.

Throws:
IndexerException

hasMoreResults

boolean hasMoreResults()
                       throws IndexerException
Determine if there are more results.

Returns:
true if there are more results, false otherwise. Fetch additional results with getMoreResults().
Throws:
IndexerException

getNextResults

java.util.List<IResult> getNextResults()
                                       throws IndexerException
Gets the next results, at most pageSize results.

Returns:
the next results
Throws:
IndexerException

getAllResults

java.util.List<IResult> getAllResults()
                                      throws IndexerException
Gets all results.

Returns:
list of all results.
Throws:
IndexerException

getSpecifiedResults

java.util.List<IResult> getSpecifiedResults(int startIndex,
                                            int numResults)
                                            throws IndexerException
Gets the specified range of results.

Parameters:
startIndex - Index of the first result to fetch
numResults - Number of results to return
Returns:
the specified range of results
Throws:
IndexerException


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.