|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.modeshape.graph.request.processor.RequestProcessor org.modeshape.graph.search.SearchEngineProcessor org.modeshape.search.lucene.AbstractLuceneSearchEngine.AbstractLuceneProcessor<WorkspaceType,SessionType>
SessionType
- the type of sessionWorkspaceType
- the type of workspaceprotected abstract static class AbstractLuceneSearchEngine.AbstractLuceneProcessor<WorkspaceType extends SearchEngineWorkspace,SessionType extends AbstractLuceneSearchEngine.WorkspaceSession>
Abstract SearchEngineProcessor
implementation for the AbstractLuceneSearchEngine
.
Nested Class Summary | |
---|---|
protected class |
AbstractLuceneSearchEngine.AbstractLuceneProcessor.QueryFactory
|
Nested classes/interfaces inherited from class org.modeshape.graph.request.processor.RequestProcessor |
---|
RequestProcessor.LocationWithDepth |
Field Summary | |
---|---|
protected DateTimeFactory |
dateFactory
|
protected Logger |
logger
|
protected NameFactory |
nameFactory
|
protected PathFactory |
pathFactory
|
protected PropertyFactory |
propertyFactory
|
protected boolean |
readOnly
|
protected ValueFactory<String> |
stringFactory
|
protected TypeSystem |
typeSystem
|
protected UuidFactory |
uuidFactory
|
protected ValueFactories |
valueFactories
|
protected AbstractSearchEngine.Workspaces<WorkspaceType> |
workspaces
|
Fields inherited from class org.modeshape.graph.search.SearchEngineProcessor |
---|
rollback |
Constructor Summary | |
---|---|
protected |
AbstractLuceneSearchEngine.AbstractLuceneProcessor(String sourceName,
ExecutionContext context,
AbstractSearchEngine.Workspaces<WorkspaceType> workspaces,
Observer observer,
DateTime now,
boolean readOnly)
|
Method Summary | |
---|---|
protected org.apache.lucene.search.Query |
andQueries(org.apache.lucene.search.Query first,
org.apache.lucene.search.Query second)
|
protected void |
commit()
Subclasses should implement this method to commit and save any work that has been done with this processor. |
protected abstract SessionType |
createSessionFor(WorkspaceType workspace)
|
protected Property |
deserializeProperty(String propertyString)
|
protected abstract String |
fullTextFieldName(String propertyName)
Create the field name that will be used to store the full-text searchable property values. |
protected SessionType |
getSessionFor(Request request,
String workspaceName)
|
protected SessionType |
getSessionFor(Request request,
String workspaceName,
boolean createIfMissing)
|
protected Collection<SessionType> |
getSessions()
|
protected WorkspaceType |
getWorkspace(Request request,
String workspaceName,
boolean createIfMissing)
|
protected WorkspaceType |
getWorkspace(String workspaceName,
boolean createIfMissing)
|
boolean |
hasChanges()
Return whether this session made changes to the indexed state. |
String |
pathAsString(Path path)
|
void |
process(AccessQueryRequest request)
Process a request to query a workspace with an access query, which is is a low-level atomic query that is part of a larger, planned query. |
protected AbstractLuceneSearchEngine.AbstractLuceneProcessor.QueryFactory |
queryFactory(AbstractLuceneSearchEngine.WorkspaceSession session,
Map<String,Object> variables)
|
protected void |
rollback()
Subclasses should implement this method to throw away any work that has been done with this processor. |
protected String |
serializeProperty(Property property)
|
Methods inherited from class org.modeshape.graph.search.SearchEngineProcessor |
---|
close, markForRollback |
Methods inherited from class org.modeshape.graph.request.processor.RequestProcessor |
---|
absoluteMaximumDepthForBranchReads, completeRequest, getChanges, getDefaultCachePolicy, getExecutionContext, getNowInUtc, getSourceName, includeChildrenInSubgraph, notifyObserverOfChanges, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, process, processUnknownRequest, recordChange, setCacheableInfo, setCacheableInfo |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final boolean readOnly
protected final ValueFactories valueFactories
protected final ValueFactory<String> stringFactory
protected final DateTimeFactory dateFactory
protected final PathFactory pathFactory
protected final UuidFactory uuidFactory
protected final NameFactory nameFactory
protected final TypeSystem typeSystem
protected final PropertyFactory propertyFactory
protected final AbstractSearchEngine.Workspaces<WorkspaceType extends SearchEngineWorkspace> workspaces
protected final Logger logger
Constructor Detail |
---|
protected AbstractLuceneSearchEngine.AbstractLuceneProcessor(String sourceName, ExecutionContext context, AbstractSearchEngine.Workspaces<WorkspaceType> workspaces, Observer observer, DateTime now, boolean readOnly)
Method Detail |
---|
protected abstract SessionType createSessionFor(WorkspaceType workspace)
protected void commit()
commit
in class SearchEngineProcessor
SearchEngineProcessor.commit()
protected void rollback()
rollback
in class SearchEngineProcessor
SearchEngineProcessor.rollback()
protected WorkspaceType getWorkspace(String workspaceName, boolean createIfMissing)
protected WorkspaceType getWorkspace(Request request, String workspaceName, boolean createIfMissing)
protected SessionType getSessionFor(Request request, String workspaceName)
protected SessionType getSessionFor(Request request, String workspaceName, boolean createIfMissing)
protected Collection<SessionType> getSessions()
protected final String serializeProperty(Property property)
protected final Property deserializeProperty(String propertyString)
protected abstract String fullTextFieldName(String propertyName)
propertyName
- the name of the property; may not null
public boolean hasChanges()
public String pathAsString(Path path)
public void process(AccessQueryRequest request)
The default implementation of this method behaves as though the implementation does not support queries by setting an error on the request
Some kinds of constraints are not easily pushed down to Lucene as are of a Lucene Query, and instead are applied by filtering the results. For example, a FullTextSearchScore applies to the score of the tuple, which cannot be (easily?) applied as a Query.
Therefore, each of the AND-ed constraints of the query are evaluated separately. After all, each of the tuples returned by the planned query must satisfy all of the AND-ed constraints. Or, to put it another way, if a tuple does not satisfy one of the AND-ed constraints, the tuple should not be included in the query results.
Logically, any AND-ed criteria that cannot be pushed down to Lucene can of course be applied as a filter on the results. Thus, each AND-ed constraint is processed to first determine if it can be represented as a Lucene query; all other AND-ed constraints must be handled as a results filter. Since most queries will likely use one or more simple constraints AND-ed together, this approach will likely work very well.
The only hairy case is when any AND-ed constraint is actually an OR-ed combination of multiple constraints of which at least one cannot be pushed down to Lucene. In this case, the entire AND-ed constraint must be treated as a results filter (even if many of those constraints that make up the OR-ed constraint can be pushed down). Hopefully, this will not be a common case in actual queries.
process
in class RequestProcessor
request
- the requestRequestProcessor.process(org.modeshape.graph.request.AccessQueryRequest)
protected org.apache.lucene.search.Query andQueries(org.apache.lucene.search.Query first, org.apache.lucene.search.Query second)
protected AbstractLuceneSearchEngine.AbstractLuceneProcessor.QueryFactory queryFactory(AbstractLuceneSearchEngine.WorkspaceSession session, Map<String,Object> variables)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |