org.apache.cocoon.components.search.components
Interface Searcher

All Known Implementing Classes:
DefaultSearcherImpl, ParallelSearcherImpl

public interface Searcher

this Searcher Component allows:
- searching in several indexes
- sorting hits by a specified field and order

Author:
Nicolas Maisonneuve

Field Summary
static java.lang.String ROLE
          The ROLE name of this avalon component.
 
Method Summary
 void addDirectory(org.apache.lucene.store.Directory directory)
          Add a lucene directory -- you can add several directories The directory specifies the directory used for looking up the index.
 org.apache.lucene.search.Hits search(org.apache.lucene.search.Query query)
          Search using a Lucene Query object, returning zero, or more hits.
 void setSortField(java.lang.String field, boolean reverse)
          Set the field by which the search results are to be sorted
 

Field Detail

ROLE

static final java.lang.String ROLE
The ROLE name of this avalon component.

Its value if the FQN of this interface, ie. org.apache.cocoon.components.search.Searcher.

Since:
Method Detail

addDirectory

void addDirectory(org.apache.lucene.store.Directory directory)
Add a lucene directory -- you can add several directories

The directory specifies the directory used for looking up the index. It defines the physical place of the index

Parameters:
directory - The new directory value

setSortField

void setSortField(java.lang.String field,
                  boolean reverse)
Set the field by which the search results are to be sorted

Parameters:
field - the index field
reverse - reverse order or not

search

org.apache.lucene.search.Hits search(org.apache.lucene.search.Query query)
                                     throws org.apache.cocoon.ProcessingException
Search using a Lucene Query object, returning zero, or more hits.

Parameters:
query - A lucene query
Returns:
Hits zero or more hits matching the query string
Throws:
org.apache.cocoon.ProcessingException - throwing due to processing errors while looking up the index directory, parsing the query string, generating the hits.


Copyright $ Apache Software Foundation. All Rights Reserved.