org.apache.cocoon.components.search.components.impl
Class DefaultSearcherImpl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.search.components.impl.DefaultSearcherImpl
All Implemented Interfaces:
org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.logger.LogEnabled, Searcher

public class DefaultSearcherImpl
extends org.apache.avalon.framework.logger.AbstractLogEnabled

use lucene MultiSearcher

Author:
Nicolas Maisonneuve

Field Summary
protected  java.util.List directories
          Lucene Directory
protected  org.apache.lucene.search.Searcher luceneSearcher
          Lucene Searcher
protected  org.apache.lucene.search.SortField sortfield
          Lucene SortField
 
Fields inherited from interface org.apache.cocoon.components.search.components.Searcher
ROLE
 
Constructor Summary
DefaultSearcherImpl()
           
 
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.
 void dispose()
           
protected  void getLuceneSearcher()
           
 void recycle()
           
 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
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

directories

protected java.util.List directories
Lucene Directory


sortfield

protected org.apache.lucene.search.SortField sortfield
Lucene SortField


luceneSearcher

protected org.apache.lucene.search.Searcher luceneSearcher
Lucene Searcher

Constructor Detail

DefaultSearcherImpl

public DefaultSearcherImpl()
Method Detail

getLuceneSearcher

protected void getLuceneSearcher()
                          throws java.io.IOException
Throws:
java.io.IOException

addDirectory

public void addDirectory(org.apache.lucene.store.Directory directory)
Description copied from interface: Searcher
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

Specified by:
addDirectory in interface Searcher
Parameters:
directory - The new directory value

search

public org.apache.lucene.search.Hits search(org.apache.lucene.search.Query query)
                                     throws org.apache.cocoon.ProcessingException
Description copied from interface: Searcher
Search using a Lucene Query object, returning zero, or more hits.

Specified by:
search in interface Searcher
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.

setSortField

public void setSortField(java.lang.String field,
                         boolean reverse)
Description copied from interface: Searcher
Set the field by which the search results are to be sorted

Specified by:
setSortField in interface Searcher
Parameters:
field - the index field
reverse - reverse order or not

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable

recycle

public void recycle()
Specified by:
recycle in interface org.apache.avalon.excalibur.pool.Recyclable


Copyright © $ Apache Software Foundation. All Rights Reserved.