Class SearchManager

    • 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 new SearchManager.
        Parameters:
        workspace - the workspace name
        repositoryContext - the repository context
        qhf - the query handler factory
        itemMgr - the shared item state manager.
        pm - the underlying persistence manager.
        rootNodeId - the id of the root node.
        parentMgr - the parent search manager or null 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()
        Closes this SearchManager and also closes the FileSystem configured in SearchConfig.
      • 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 session
        statement - the actual query statement.
        language - the syntax of the query statement.
        node - a nt:query node where the query was read from or null if it is not a stored query.
        Returns:
        a Query instance to execute.
        Throws:
        InvalidQueryException - if the query is malformed or the language 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 session
        qomTree - 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 or null 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 with id 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.