Package org.apache.jackrabbit.core
Class SearchManager
- java.lang.Object
-
- org.apache.jackrabbit.core.SearchManager
-
- All Implemented Interfaces:
EventListener
,SynchronousEventListener
public class SearchManager extends Object implements SynchronousEventListener
Acts as a global entry point to execute queries and index nodes.
-
-
Constructor Summary
Constructors Constructor Description SearchManager(String workspace, RepositoryContext repositoryContext, QueryHandlerFactory qhf, SharedItemStateManager itemMgr, PersistenceManager pm, NodeId rootNodeId, SearchManager parentMgr, NodeId excludedNodeId)
Creates a newSearchManager
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Query
createQuery(SessionContext sessionContext, String statement, String language, Node node)
Creates a query object that can be executed on the workspace.protected AbstractQueryImpl
createQueryInstance()
Creates a new instance of anAbstractQueryImpl
which is not initialized.QueryObjectModel
createQueryObjectModel(SessionContext sessionContext, QueryObjectModelTree qomTree, String langugage, Node node)
Creates a query object model that can be executed on the workspace.QueryHandler
getQueryHandler()
Iterable<NodeId>
getWeaklyReferringNodes(NodeId id)
Returns the ids of the nodes that refer to the node withid
by weak references.void
onEvent(EventIterator events)
-
-
-
Field Detail
-
NS_FN_URI
public static final String NS_FN_URI
- See Also:
- Constant Field Values
-
NS_FN_OLD_URI
public static final String NS_FN_OLD_URI
- See Also:
- Constant Field Values
-
NS_XS_URI
public static final String NS_XS_URI
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SearchManager
public SearchManager(String workspace, RepositoryContext repositoryContext, QueryHandlerFactory qhf, SharedItemStateManager itemMgr, PersistenceManager pm, NodeId rootNodeId, SearchManager parentMgr, NodeId excludedNodeId) throws RepositoryException
Creates a newSearchManager
.- Parameters:
workspace
- the workspace namerepositoryContext
- the repository contextqhf
- the query handler factoryitemMgr
- the shared item state manager.pm
- the underlying persistence manager.rootNodeId
- the id of the root node.parentMgr
- the parent search manager ornull
if there is no parent search manager.excludedNodeId
- id of the node that should be excluded from indexing. Any descendant of that node will also be excluded from indexing.- Throws:
RepositoryException
- if the search manager cannot be initialized
-
-
Method Detail
-
close
public void close()
-
createQuery
public Query createQuery(SessionContext sessionContext, String statement, String language, Node node) throws InvalidQueryException, RepositoryException
Creates a query object that can be executed on the workspace.- Parameters:
sessionContext
- component context of the current sessionstatement
- the actual query statement.language
- the syntax of the query statement.node
- a nt:query node where the query was read from ornull
if it is not a stored query.- Returns:
- a
Query
instance to execute. - Throws:
InvalidQueryException
- if the query is malformed or thelanguage
is unknown.RepositoryException
- if any other error occurs.
-
createQueryObjectModel
public QueryObjectModel createQueryObjectModel(SessionContext sessionContext, QueryObjectModelTree qomTree, String langugage, Node node) throws InvalidQueryException, RepositoryException
Creates a query object model that can be executed on the workspace.- Parameters:
sessionContext
- component context of the current sessionqomTree
- the query object model tree, representing the query.langugage
- the original language of the query statement.node
- a nt:query node where the query was read from ornull
if it is not a stored query.- Returns:
- the query object model for the query.
- Throws:
InvalidQueryException
- the the query object model tree is considered invalid by the query handler implementation.RepositoryException
- if any other error occurs.
-
getWeaklyReferringNodes
public Iterable<NodeId> getWeaklyReferringNodes(NodeId id) throws RepositoryException, IOException
Returns the ids of the nodes that refer to the node withid
by weak references.- Parameters:
id
- the id of the target node.- Returns:
- the ids of the referring nodes.
- Throws:
RepositoryException
- if an error occurs.IOException
- if an error occurs while reading from the index.
-
getQueryHandler
public QueryHandler getQueryHandler()
- Returns:
- the query handler implementation.
-
onEvent
public void onEvent(EventIterator events)
- Specified by:
onEvent
in interfaceEventListener
-
createQueryInstance
protected AbstractQueryImpl createQueryInstance() throws RepositoryException
Creates a new instance of anAbstractQueryImpl
which is not initialized.- Returns:
- an new query instance.
- Throws:
RepositoryException
- if an error occurs while creating a new query instance.
-
-