org.modeshape.search.lucene
Class LuceneSearchWorkspace

java.lang.Object
  extended by org.modeshape.search.lucene.LuceneSearchWorkspace
All Implemented Interfaces:
SearchEngineWorkspace

@Immutable
public class LuceneSearchWorkspace
extends Object
implements SearchEngineWorkspace

The SearchEngineWorkspace implementation for the LuceneSearchEngine.


Field Summary
protected  org.apache.lucene.analysis.Analyzer analyzer
           
protected static int CHANGES_BEFORE_OPTIMIZATION
          Apparently Lucene indexes must always be optimized prior to committing, so this value is set to '1'.
protected  org.apache.lucene.store.Directory contentDirectory
           
protected static String FULL_TEXT_PREFIX
          Given the name of a property field of the form "<namespace>:<local>" (where <namespace> can be zero-length), this provider also stores the value(s) for free-text searching in a field named ":ft:<namespace>:<local>".
static String INDEX_NAME
           
protected  IndexRules.Factory rulesFactory
           
 
Constructor Summary
protected LuceneSearchWorkspace(String workspaceName, LuceneConfiguration configuration, IndexRules.Factory rulesFactory, org.apache.lucene.analysis.Analyzer analyzer)
           
 
Method Summary
 void destroy(ExecutionContext context)
          Destroy the indexes for the workspace with the supplied name.
 IndexRules getRules()
           
 org.apache.lucene.util.Version getVersion()
          Get the version information for Lucene.
 String getWorkspaceName()
          Get the name of the workspace.
protected  boolean isOptimizationRequired(int changesInSession)
          Give the number of changes that have been made in a session, determine whether optimization is required on the workspace indexes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHANGES_BEFORE_OPTIMIZATION

protected static final int CHANGES_BEFORE_OPTIMIZATION
Apparently Lucene indexes must always be optimized prior to committing, so this value is set to '1'.

See Also:
Constant Field Values

INDEX_NAME

public static final String INDEX_NAME
See Also:
Constant Field Values

FULL_TEXT_PREFIX

protected static final String FULL_TEXT_PREFIX
Given the name of a property field of the form "<namespace>:<local>" (where <namespace> can be zero-length), this provider also stores the value(s) for free-text searching in a field named ":ft:<namespace>:<local>". Thus, even if the namespace is zero-length, the free-text search field will be named ":ft::<local>" and will not clash with any other property name.

See Also:
Constant Field Values

rulesFactory

protected final IndexRules.Factory rulesFactory

contentDirectory

protected final org.apache.lucene.store.Directory contentDirectory

analyzer

protected final org.apache.lucene.analysis.Analyzer analyzer
Constructor Detail

LuceneSearchWorkspace

protected LuceneSearchWorkspace(String workspaceName,
                                LuceneConfiguration configuration,
                                IndexRules.Factory rulesFactory,
                                org.apache.lucene.analysis.Analyzer analyzer)
Method Detail

getWorkspaceName

public String getWorkspaceName()
Get the name of the workspace.

Specified by:
getWorkspaceName in interface SearchEngineWorkspace
Returns:
the workspace name; never null
See Also:
SearchEngineWorkspace.getWorkspaceName()

destroy

public void destroy(ExecutionContext context)
Destroy the indexes for the workspace with the supplied name.

Specified by:
destroy in interface SearchEngineWorkspace
Parameters:
context - the execution context in which the destruction should be performed; may not be null
See Also:
SearchEngineWorkspace.destroy(org.modeshape.graph.ExecutionContext)

getRules

public IndexRules getRules()
Returns:
rules

isOptimizationRequired

protected boolean isOptimizationRequired(int changesInSession)
Give the number of changes that have been made in a session, determine whether optimization is required on the workspace indexes.

Parameters:
changesInSession - the number of changes made within a session using this workspace
Returns:
true if the workspace indexes should be optimized, or false otherwise

getVersion

public org.apache.lucene.util.Version getVersion()
Get the version information for Lucene.

Returns:
the version information; never null
See Also:
LuceneConfiguration.getVersion()


Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.