org.jboss.dna.search.lucene
Class LuceneSearchEngine
java.lang.Object
org.jboss.dna.graph.search.AbstractSearchEngine<WorkspaceType,ProcessorType>
org.jboss.dna.search.lucene.AbstractLuceneSearchEngine<LuceneSearchWorkspace,LuceneSearchProcessor>
org.jboss.dna.search.lucene.LuceneSearchEngine
- All Implemented Interfaces:
- SearchEngine
public class LuceneSearchEngine
- extends AbstractLuceneSearchEngine<LuceneSearchWorkspace,LuceneSearchProcessor>
A SearchEngine
implementation that relies upon two separate indexes to manage the node properties and the node
structure (path and children). Using two indexes is more efficient when the node content and structure are updated
independently. For example, the structure of the nodes changes whenever same-name-sibling indexes are changed, when sibling
nodes are deleted, or when nodes are moved around; in all of these cases, the properties of the nodes do not change.
Constructor Summary |
LuceneSearchEngine(String sourceName,
RepositoryConnectionFactory connectionFactory,
boolean verifyWorkspaceInSource,
File indexStorageDirectory,
IndexRules rules,
org.apache.lucene.analysis.Analyzer analyzer)
Create a new instance of a SearchEngine that uses Lucene and a two-index design, and that stores the indexes in the
supplied directory. |
LuceneSearchEngine(String sourceName,
RepositoryConnectionFactory connectionFactory,
boolean verifyWorkspaceInSource,
IndexRules rules,
org.apache.lucene.analysis.Analyzer analyzer)
Create a new instance of a SearchEngine that uses Lucene and a two-index design, and that stores the Lucene indexes
in memory. |
LuceneSearchEngine(String sourceName,
RepositoryConnectionFactory connectionFactory,
boolean verifyWorkspaceInSource,
LuceneConfiguration configuration,
IndexRules rules,
org.apache.lucene.analysis.Analyzer analyzer)
Create a new instance of a SearchEngine that uses Lucene and a two-index design, and that stores the indexes using
the supplied LuceneConfiguration . |
DEFAULT_RULES
public static final IndexRules DEFAULT_RULES
- The default set of
IndexRules
used by LuceneSearchEngine
instances when no rules are provided. These rules
default to index and analyze all properties, and to index the dna:uuid
and jcr:uuid
properties to be indexed and stored only (not analyzed and not included in full-text search. The rules also treat
jcr:created
and jcr:lastModified
properties as dates.
LuceneSearchEngine
public LuceneSearchEngine(String sourceName,
RepositoryConnectionFactory connectionFactory,
boolean verifyWorkspaceInSource,
LuceneConfiguration configuration,
IndexRules rules,
org.apache.lucene.analysis.Analyzer analyzer)
- Create a new instance of a
SearchEngine
that uses Lucene and a two-index design, and that stores the indexes using
the supplied LuceneConfiguration
.
- Parameters:
sourceName
- the name of the source that this engine will search overconnectionFactory
- the factory for making connections to the sourceverifyWorkspaceInSource
- true if the workspaces are to be verified using the source, or false if this engine is used
in a way such that all workspaces are known to existconfiguration
- the configuration of the Lucene indexesrules
- the index rule, or null if the default index rules should be usedanalyzer
- the analyzer, or null if the default analyzer should be used
- Throws:
IllegalArgumentException
- if any of the source name, connection factory, or configuration are null
LuceneSearchEngine
public LuceneSearchEngine(String sourceName,
RepositoryConnectionFactory connectionFactory,
boolean verifyWorkspaceInSource,
File indexStorageDirectory,
IndexRules rules,
org.apache.lucene.analysis.Analyzer analyzer)
- Create a new instance of a
SearchEngine
that uses Lucene and a two-index design, and that stores the indexes in the
supplied directory.
This is identical to the following:
TextEncoder encoder = new UrlEncoder();
LuceneConfiguration config = LuceneConfigurations.using(indexStorageDirectory, null, encoder, encoder);
new LuceneSearchEngine(sourceName, connectionFactory, verifyWorkspaceInSource, config, rules, analyzer);
where the default encoder
is used to ensure that workspace names and index names can be turned
into file system directory names.
- Parameters:
sourceName
- the name of the source that this engine will search overconnectionFactory
- the factory for making connections to the sourceverifyWorkspaceInSource
- true if the workspaces are to be verified using the source, or false if this engine is used
in a way such that all workspaces are known to existindexStorageDirectory
- the file system directory in which the indexes are to be keptrules
- the index rule, or null if the default index rules should be usedanalyzer
- the analyzer, or null if the default analyzer should be used
- Throws:
IllegalArgumentException
- if any of the source name, connection factory, or directory are null
LuceneSearchEngine
public LuceneSearchEngine(String sourceName,
RepositoryConnectionFactory connectionFactory,
boolean verifyWorkspaceInSource,
IndexRules rules,
org.apache.lucene.analysis.Analyzer analyzer)
- Create a new instance of a
SearchEngine
that uses Lucene and a two-index design, and that stores the Lucene indexes
in memory.
This is identical to the following:
new LuceneSearchEngine(sourceName, connectionFactory, verifyWorkspaceInSource, LuceneConfigurations.inMemory(), rules, analyzer);
- Parameters:
sourceName
- the name of the source that this engine will search overconnectionFactory
- the factory for making connections to the sourceverifyWorkspaceInSource
- true if the workspaces are to be verified using the source, or false if this engine is used
in a way such that all workspaces are known to existrules
- the index rule, or null if the default index rules should be usedanalyzer
- the analyzer, or null if the default analyzer should be used
- Throws:
IllegalArgumentException
- if any of the source name or connection factory are null
index
public void index(ExecutionContext context,
Iterable<ChangeRequest> changes)
throws SearchEngineException
- Update the indexes with the supplied set of changes to the content.
- Parameters:
context
- the execution context for which this session is to be established; may not be nullchanges
- the set of changes to the content
- Throws:
SearchEngineException
- if there is a problem updating the indexes- See Also:
SearchEngine.index(org.jboss.dna.graph.ExecutionContext, java.lang.Iterable)
Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.