org.apache.cocoon.components.search
Class SimpleLuceneCocoonIndexerImpl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.search.SimpleLuceneCocoonIndexerImpl
All Implemented Interfaces:
Disposable, Component, Configurable, LogEnabled, Serviceable, LuceneCocoonIndexer

public class SimpleLuceneCocoonIndexerImpl
extends AbstractLogEnabled
implements LuceneCocoonIndexer, Configurable, Serviceable, Disposable

A lucene indexer.

XML documents are indexed using lucene. Links to XML documents are supplied by a crawler, requesting links of documents by specifying a cocoon-view, and HTTP protocol.

Version:
CVS $Id: SimpleLuceneCocoonIndexerImpl.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Bernhard Huber

Field Summary
protected  org.apache.lucene.analysis.Analyzer analyzer
          The used lucene analyzer
static String ANALYZER_CLASSNAME_CONFIG
          configuration tagname for specifying the analyzer class
static String ANALYZER_CLASSNAME_DEFAULT
          configuration default analyzer class
static String DIRECTORY_CONFIG
          configuration tagname for specifying lucene's index directory
static String DIRECTORY_DEFAULT
          configuration default directory, ie. no default.
protected  ServiceManager manager
          The service manager for looking up components used.
static String MERGE_FACTOR_CONFIG
          configuration tagname for specifying lucene's merge factor.
static int MERGE_FACTOR_DEFAULT
          configuration default value for lucene's merge factor.
 
Fields inherited from interface org.apache.cocoon.components.search.LuceneCocoonIndexer
ROLE
 
Constructor Summary
SimpleLuceneCocoonIndexerImpl()
           
 
Method Summary
 void configure(Configuration conf)
          Configure this component.
 void dispose()
          Dispose this component.
 void index(org.apache.lucene.store.Directory index, boolean create, URL base_url)
          index content of base_url, index content of links from base_url.
 void service(ServiceManager manager)
          Set the current ServiceManager instance used by this Serviceable.
 void setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
          Sets the analyzer attribute of the SimpleLuceneCocoonIndexerImpl object
 
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

ANALYZER_CLASSNAME_CONFIG

public static final String ANALYZER_CLASSNAME_CONFIG
configuration tagname for specifying the analyzer class

See Also:
Constant Field Values

ANALYZER_CLASSNAME_DEFAULT

public static final String ANALYZER_CLASSNAME_DEFAULT
configuration default analyzer class

See Also:
Constant Field Values

DIRECTORY_CONFIG

public static final String DIRECTORY_CONFIG
configuration tagname for specifying lucene's index directory

See Also:
Constant Field Values

DIRECTORY_DEFAULT

public static final String DIRECTORY_DEFAULT
configuration default directory, ie. no default.


MERGE_FACTOR_CONFIG

public static final String MERGE_FACTOR_CONFIG
configuration tagname for specifying lucene's merge factor.

See Also:
Constant Field Values

MERGE_FACTOR_DEFAULT

public static final int MERGE_FACTOR_DEFAULT
configuration default value for lucene's merge factor.

See Also:
Constant Field Values

manager

protected ServiceManager manager
The service manager for looking up components used.


analyzer

protected org.apache.lucene.analysis.Analyzer analyzer
The used lucene analyzer

Constructor Detail

SimpleLuceneCocoonIndexerImpl

public SimpleLuceneCocoonIndexerImpl()
Method Detail

setAnalyzer

public void setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
Sets the analyzer attribute of the SimpleLuceneCocoonIndexerImpl object

Specified by:
setAnalyzer in interface LuceneCocoonIndexer
Parameters:
analyzer - The new analyzer value

configure

public void configure(Configuration conf)
               throws ConfigurationException
Configure this component.

Specified by:
configure in interface Configurable
Parameters:
conf - is the configuration
Throws:
ConfigurationException - is thrown if configuring fails

service

public void service(ServiceManager manager)
             throws ServiceException
Set the current ServiceManager instance used by this Serviceable.

Specified by:
service in interface Serviceable
Parameters:
manager - used by this component
Throws:
ServiceException - is never thrown

dispose

public void dispose()
Dispose this component.

Specified by:
dispose in interface Disposable

index

public void index(org.apache.lucene.store.Directory index,
                  boolean create,
                  URL base_url)
           throws ProcessingException
index content of base_url, index content of links from base_url.

Specified by:
index in interface LuceneCocoonIndexer
Parameters:
index - the lucene store to write the index to
create - if true create, or overwrite existing index, else update existing index.
base_url - index content of base_url, and crawl through all its links recursivly.
Throws:
ProcessingException - is thrown if indexing fails


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.