| org.apache.cocoon.transformation.AbstractTransformer org.apache.cocoon.transformation.LuceneIndexTransformer
LuceneIndexTransformer | public class LuceneIndexTransformer extends AbstractTransformer implements CacheableProcessingComponent,Configurable,Contextualizable(Code) | | A lucene index creation transformer.
This transformer reads a document with elements in the namespace
http://apache.org/cocoon/lucene/1.0 , and creates a new Lucene Index,
or updates an existing one.
It has several parameters which can be set in the sitemap component configuration or as
parameters to the transformation step in the pipeline, or finally as attributes of the root element
in the source XML document. The source document over-rides the transformation parameters,
which in turn over-ride any configuration parameters.
-
- directory
Location of directory where index files are stored.
This path is relative to the Cocoon work directory
- create
This attribute controls whether the index is recreated.
If create = "false" and the index already exists then the index will be updated.
Any documents which had already been indexed will be removed from the index and reinserted.
If the index does not exist then it will be created even if create ="false".
If create ="true" then any existing index will be destroyed and a new index created.
If you are rebuilding your entire index then you should set create ="true" because the
indexer doesn't need to remove old documents from the index, so it will be faster.
- max-field-length
Maximum number of terms to index in a field (as far as the index is concerned,
the document will effectively be truncated at this point. The default value, 10k, may not be sufficient for large documents.
- analyzer
Class name of the Lucene text analyzer to use. Typically depends on the language of the text being indexed.
See the Lucene documentation for more information.
- merge-factor
- Determines how often segment indices are merged. See the Lucene documentation for more information.
- A simple example of the input:
-
<?xml version="1.0" encoding="UTF-8"?>
<lucene:index xmlns:lucene="http://apache.org/cocoon/lucene/1.0"
merge-factor="20"
create="false"
directory="index"
max-field-length="10000"
analyzer="org.apache.lucene.analysis.standard.StandardAnalyzer">
<lucene:document url="a.html">
<documentTitle lucene:store="true">Doggerel</documentTitle>
<body>The quick brown fox jumped over the lazy dog</body>
</lucene:document>
<lucene:document url="b.html">
<documentTitle lucene:store="true">Lorem Ipsum</documentTitle>
<body>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</body>
<body>Nunc a mauris blandit ligula scelerisque tristique.</body>
</lucene:document>
</lucene:index>
author: Vadim Gritsenko author: Conal Tuohy version: $Id: LuceneIndexTransformer.java 433543 2006-08-22 06:22:54Z crossley $ |
Inner Class :static class IndexHelperField | |
Inner Class :static class IndexerConfiguration | |
Method Summary | |
public void | characters(char[] ch, int start, int length) | public void | configure(Configuration conf) Configure the transformer. | public void | contextualize(Context context) | public void | endDocument() | public void | endElement(String namespaceURI, String localName, String qName) | public void | endPrefixMapping(String prefix) End the scope of a prefix-URI mapping. | public Serializable | getKey() Generate the unique key. | public SourceValidity | getValidity() Generate the validity object. | public void | recycle() | public void | setup(SourceResolver resolver, Map objectModel, String src, Parameters parameters) Setup the transformer. | public void | startDocument() | public void | startElement(String namespaceURI, String localName, String qName, Attributes atts) | public void | startPrefixMapping(String prefix, String uri) Begin the scope of a prefix-URI Namespace mapping. |
ANALYZER_CLASSNAME_CONFIG | final public static String ANALYZER_CLASSNAME_CONFIG(Code) | | |
ANALYZER_CLASSNAME_DEFAULT | final public static String ANALYZER_CLASSNAME_DEFAULT(Code) | | |
ANALYZER_CLASSNAME_PARAMETER | final public static String ANALYZER_CLASSNAME_PARAMETER(Code) | | |
DIRECTORY_CONFIG | final public static String DIRECTORY_CONFIG(Code) | | |
DIRECTORY_DEFAULT | final public static String DIRECTORY_DEFAULT(Code) | | |
DIRECTORY_PARAMETER | final public static String DIRECTORY_PARAMETER(Code) | | |
LUCENE_DOCUMENT_ELEMENT | final public static String LUCENE_DOCUMENT_ELEMENT(Code) | | |
LUCENE_DOCUMENT_URL_ATTRIBUTE | final public static String LUCENE_DOCUMENT_URL_ATTRIBUTE(Code) | | |
LUCENE_ELAPSED_TIME_ATTRIBUTE | final public static String LUCENE_ELAPSED_TIME_ATTRIBUTE(Code) | | |
LUCENE_ELEMENT_ATTR_STORE_VALUE | final public static String LUCENE_ELEMENT_ATTR_STORE_VALUE(Code) | | |
LUCENE_ELEMENT_ATTR_TO_TEXT_ATTRIBUTE | final public static String LUCENE_ELEMENT_ATTR_TO_TEXT_ATTRIBUTE(Code) | | |
LUCENE_QUERY_ANALYZER_ATTRIBUTE | final public static String LUCENE_QUERY_ANALYZER_ATTRIBUTE(Code) | | |
LUCENE_QUERY_CREATE_ATTRIBUTE | final public static String LUCENE_QUERY_CREATE_ATTRIBUTE(Code) | | |
LUCENE_QUERY_DIRECTORY_ATTRIBUTE | final public static String LUCENE_QUERY_DIRECTORY_ATTRIBUTE(Code) | | |
LUCENE_QUERY_ELEMENT | final public static String LUCENE_QUERY_ELEMENT(Code) | | |
LUCENE_QUERY_MAX_FIELD_LENGTH_ATTRIBUTE | final public static String LUCENE_QUERY_MAX_FIELD_LENGTH_ATTRIBUTE(Code) | | |
LUCENE_QUERY_MERGE_FACTOR_ATTRIBUTE | final public static String LUCENE_QUERY_MERGE_FACTOR_ATTRIBUTE(Code) | | |
MAX_FIELD_LENGTH_CONFIG | final public static String MAX_FIELD_LENGTH_CONFIG(Code) | | |
MAX_FIELD_LENGTH_DEFAULT | final public static int MAX_FIELD_LENGTH_DEFAULT(Code) | | |
MAX_FIELD_LENGTH_PARAMETER | final public static String MAX_FIELD_LENGTH_PARAMETER(Code) | | |
MERGE_FACTOR_CONFIG | final public static String MERGE_FACTOR_CONFIG(Code) | | |
MERGE_FACTOR_DEFAULT | final public static int MERGE_FACTOR_DEFAULT(Code) | | |
MERGE_FACTOR_PARAMETER | final public static String MERGE_FACTOR_PARAMETER(Code) | | |
characters | public void characters(char[] ch, int start, int length) throws SAXException(Code) | | |
configure | public void configure(Configuration conf) throws ConfigurationException(Code) | | Configure the transformer. The configuration parameters are stored as
general defaults, which may be over-ridden by parameters specified as
parameters in the sitemap pipeline, or by attributes of the query
element(s) in the XML input document.
|
contextualize | public void contextualize(Context context) throws ContextException(Code) | | Contextualize this class
|
endPrefixMapping | public void endPrefixMapping(String prefix) throws SAXException(Code) | | End the scope of a prefix-URI mapping.
Parameters: prefix - The prefix that was being mapping. |
getKey | public Serializable getKey()(Code) | | Generate the unique key.
This key must be unique inside the space of this component.
The generated key |
getValidity | public SourceValidity getValidity()(Code) | | Generate the validity object.
The generated validity object or null if thecomponent is currently not cacheable. |
recycle | public void recycle()(Code) | | |
setup | public void setup(SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws ProcessingException, SAXException, IOException(Code) | | Setup the transformer.
Called when the pipeline is assembled.
The parameters are those specified as child elements of the
<map:transform> element in the sitemap.
These parameters are optional:
If no parameters are specified here then the defaults are
supplied by the component configuration.
Any parameters specified here may be over-ridden by attributes
of the lucene:index element in the input document.
|
startPrefixMapping | public void startPrefixMapping(String prefix, String uri) throws SAXException(Code) | | Begin the scope of a prefix-URI Namespace mapping.
Parameters: prefix - The Namespace prefix being declared. Parameters: uri - The Namespace URI the prefix is mapped to. |
|
|