SPT Object Database API

com.sptci.prevayler.query
Class Search<P extends Collection<PrevalentObject>,S extends PrevalentSystem>

java.lang.Object
  extended by com.sptci.prevayler.query.AbstractQuery<P,S>
      extended by com.sptci.prevayler.query.Search<P,S>
All Implemented Interfaces:
Query

public class Search<P extends Collection<PrevalentObject>,S extends PrevalentSystem>
extends AbstractQuery<P,S>

The query for retrieving a collection of prevalent objects that match the specified query and optional filter. This query uses the full-text indices to retrieve the matching prevalent objects.

Version:
$Id: Search.java 22 2008-11-24 19:04:25Z sptrakesh $
Author:
Rakesh Vidyadharan 2008-05-27
See Also:

© Copyright 2008 Sans Pareil Technologies, Inc.


Field Summary
private  int count
          The maximum number of search results to return.
private  org.apache.lucene.search.Filter filter
          The optional filter clause to apply for the search results.
private  org.apache.lucene.search.Query query
          The query that is to be executed.
private  org.apache.lucene.search.Sort sort
          The sort criteria to apply to the search results.
 
Constructor Summary
Search(org.apache.lucene.search.Query query, org.apache.lucene.search.Filter filter, int count)
          Create a new instance of the query with the specified parameters.
Search(org.apache.lucene.search.Query query, org.apache.lucene.search.Filter filter, int count, org.apache.lucene.search.Sort sort)
          Create a new instance of the query with the specified parameters.
Search(org.apache.lucene.search.Query query, int count)
          Create a new instance of the query with the specified parameters.
 
Method Summary
protected  P query(S system, Date timestamp)
          Execute the query on the prevalent system and return the prevalent object instances that match the specified query.
 
Methods inherited from class com.sptci.prevayler.query.AbstractQuery
query
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

query

private final org.apache.lucene.search.Query query
The query that is to be executed.


filter

private final org.apache.lucene.search.Filter filter
The optional filter clause to apply for the search results.


count

private final int count
The maximum number of search results to return.


sort

private final org.apache.lucene.search.Sort sort
The sort criteria to apply to the search results.

Constructor Detail

Search

public Search(org.apache.lucene.search.Query query,
              int count)
Create a new instance of the query with the specified parameters.

Parameters:
query - The lucene query to execute.
count - The maximum number of results.

Search

public Search(org.apache.lucene.search.Query query,
              org.apache.lucene.search.Filter filter,
              int count)
Create a new instance of the query with the specified parameters.

Parameters:
query - The lucene query to execute.
filter - The filter to apply to the results.
count - The maximum number of results.

Search

public Search(org.apache.lucene.search.Query query,
              org.apache.lucene.search.Filter filter,
              int count,
              org.apache.lucene.search.Sort sort)
Create a new instance of the query with the specified parameters. This is the designated initialiser.

Parameters:
query - The lucene query to execute.
filter - The filter to apply to the results.
count - The maximum number of results.
sort - The sort criteria for the results.
Method Detail

query

protected P query(S system,
                  Date timestamp)
                                               throws PrevalentException
Execute the query on the prevalent system and return the prevalent object instances that match the specified query.

Specified by:
query in class AbstractQuery<P extends Collection<PrevalentObject>,S extends PrevalentSystem>
Parameters:
system - The prevalent system that is to be acted upon.
timestamp - The timestamp for the query.
Returns:
The collection of prevalent objects or an empty collection.
Throws:
PrevalentException - If errors are encountered while fetching the required prevalent object.

SPT Object Database API