protected IndexReader getIndexReader ( boolean includeSystemIndex ) throws IOException { // deny query execution if index in offline mode and allowQuery is false if ( ! indexRegister . getDefaultIndex ( ) . isOnline ( ) && ! allowQuery . get ( ) ) { throw new IndexOfflineIOException ( "Index is offline" ) ; } QueryHandler parentHandler = getContext ( ) . getParentHandler ( ) ; CachingMultiIndexReader parentReader = null ; if ( parentHandler instanceof SearchIndex && includeSystemIndex ) { parentReader = ( ( SearchIndex ) parentHandler ) . indexRegister . getDefaultIndex ( ) . getIndexReader ( ) ; } IndexReader reader ; if ( parentReader != null ) { CachingMultiIndexReader [ ] readers = { indexRegister . getDefaultIndex ( ) . getIndexReader ( ) , parentReader } ; reader = new CombinedIndexReader ( readers ) ; } else { reader = indexRegister . getDefaultIndex ( ) . getIndexReader ( ) ; } return new JcrIndexReader ( reader ) ; }
Returns an index reader for this search index . The caller of this method is responsible for closing the index reader when he is finished using it .