Class CachingMultiIndexReader

    • Constructor Detail

      • CachingMultiIndexReader

        public CachingMultiIndexReader​(org.apache.jackrabbit.core.query.lucene.ReadOnlyIndexReader[] subReaders,
                                       org.apache.jackrabbit.core.query.lucene.DocNumberCache cache)
        Creates a new CachingMultiIndexReader based on sub readers.
        Parameters:
        subReaders - the sub readers.
        cache - the document number cache.
    • Method Detail

      • getParents

        public int[] getParents​(int n,
                                int[] docNumbers)
                         throws IOException
        Returns the document number of the parent of n or an empty array if n does not have a parent (n is the root node).
        Specified by:
        getParents in interface HierarchyResolver
        Parameters:
        n - the document number.
        docNumbers - an array for reuse. An implementation should use the passed array as a container for the return value, unless the length of the returned array is different from docNumbers. In which case an implementation will create a new array with an appropriate size.
        Returns:
        the document number of n's parent.
        Throws:
        IOException - if an error occurs while reading from the index.
      • getParentDocId

        public org.apache.jackrabbit.core.query.lucene.DocId getParentDocId​(int n)
                                                                     throws IOException
        Returns the DocId of the parent of n or DocId.NULL if n does not have a parent (n is the root node).
        Parameters:
        n - the document number.
        Returns:
        the DocId of n's parent.
        Throws:
        IOException - if an error occurs while reading from the index.
      • release

        public final void release()
                           throws IOException
        Releases this index reader and potentially frees resources. In contrast to IndexReader.close() this method does not necessarily close the index reader, but gives the implementation the opportunity to do reference counting.
        Specified by:
        release in interface ReleaseableIndexReader
        Throws:
        IOException - if an error occurs while releasing the index reader.
      • createDocId

        public org.apache.jackrabbit.core.query.lucene.ForeignSegmentDocId createDocId​(NodeId id)
                                                                                throws IOException
        Creates a document id for the given node identifier.
        Specified by:
        createDocId in interface MultiIndexReader
        Parameters:
        id - the id of the node.
        Returns:
        a foreign segment doc id or null if there is no node with the given id.
        Throws:
        IOException - if an error occurs while reading from the index.
      • getDocumentNumber

        public int getDocumentNumber​(org.apache.jackrabbit.core.query.lucene.ForeignSegmentDocId docId)
        Returns the document number for the passed docId. If the id is invalid -1 is returned.
        Specified by:
        getDocumentNumber in interface MultiIndexReader
        Parameters:
        docId - the document id to resolve.
        Returns:
        the document number or -1 if it is invalid (e.g. does not exist).