public static <R extends IndexReader> ZoieIndexReader<R> open(IndexReader r,IndexReaderDecorator<R> decorator) throws IOException{ return new ZoieMultiReader<R>(r,decorator); }
protected ZoieMultiReader<R> newInstance(IndexReader inner,IndexReader[] subReaders) throws IOException{ return new ZoieMultiReader<R>(inner, subReaders ,_decorator); }
public ZoieMultiReader<R> reopen() throws IOException { long t0 = System.currentTimeMillis(); DirectoryReader inner = DirectoryReader.openIfChanged(in); if (inner == null) { t0 = System.currentTimeMillis() - t0; if (t0 > 1000) { log.info("reopen returns in " + t0 + "ms without change"); } else { if (log.isDebugEnabled()) { log.debug("reopen returns in " + t0 + "ms without change"); } } return this; } ZoieMultiReader<R> ret = new ZoieMultiReader<R>(inner, _decorator, new ZoieSubReaderWrapper<R>( _decorator, _readerMap)); t0 = System.currentTimeMillis() - t0; if (t0 > 1000) { log.info("reopen returns in " + t0 + "ms with change"); } else { if (log.isDebugEnabled()) { log.debug("reopen returns in " + t0 + "ms with change"); } } return ret; }
public ZoieMultiReader<R> reopen() throws IOException { long t0 = System.currentTimeMillis(); DirectoryReader inner = DirectoryReader.openIfChanged(in); if (inner == null) { t0 = System.currentTimeMillis() - t0; if (t0 > 1000) { log.info("reopen returns in " + t0 + "ms without change"); } else { if (log.isDebugEnabled()) { log.debug("reopen returns in " + t0 + "ms without change"); } } return this; } ZoieMultiReader<R> ret = new ZoieMultiReader<R>(inner, _decorator, new ZoieSubReaderWrapper<R>( _decorator, _readerMap)); t0 = System.currentTimeMillis() - t0; if (t0 > 1000) { log.info("reopen returns in " + t0 + "ms with change"); } else { if (log.isDebugEnabled()) { log.debug("reopen returns in " + t0 + "ms with change"); } } return ret; }
protected List<ZoieMultiReader<R>> loadArchives() { List<ZoieMultiReader<R>> archives = new ArrayList<ZoieMultiReader<R>>(); long t0 = System.currentTimeMillis(); List<Directory> dirs = _dirMgrFactory.getAllArchivedDirectories(); for (Directory dir : dirs) { DirectoryReader reader; try { reader = DirectoryReader.open(dir); ZoieMultiReader<R> zoiereader = new ZoieMultiReader<R>(reader, _decorator); // Initialize docIdMapper DocIDMapper mapper = _zConfig.getDocidMapperFactory().getDocIDMapper(zoiereader); zoiereader.setDocIDMapper(mapper); archives.add(zoiereader); } catch (CorruptIndexException e) { log.error("corruptedIndex", e); } catch (IOException e) { log.error("IOException", e); } } log.info("load " + dirs.size() + " archived indices of " + getSizeBytes() + " bytes in " + (System.currentTimeMillis() - t0) + "ms"); return archives; }
protected List<ZoieMultiReader<R>> loadArchives() { List<ZoieMultiReader<R>> archives = new ArrayList<ZoieMultiReader<R>>(); long t0 = System.currentTimeMillis(); List<Directory> dirs = _dirMgrFactory.getAllArchivedDirectories(); for (Directory dir : dirs) { DirectoryReader reader; try { reader = DirectoryReader.open(dir); ZoieMultiReader<R> zoiereader = new ZoieMultiReader<R>(reader, _decorator); // Initialize docIdMapper DocIDMapper mapper = _zConfig.getDocidMapperFactory().getDocIDMapper(zoiereader); zoiereader.setDocIDMapper(mapper); archives.add(zoiereader); } catch (CorruptIndexException e) { log.error("corruptedIndex", e); } catch (IOException e) { log.error("IOException", e); } } log.info("load " + dirs.size() + " archived indices of " + getSizeBytes() + " bytes in " + (System.currentTimeMillis() - t0) + "ms"); return archives; }
/** * makes exact shallow copy of a given ZoieMultiReader * @throws IOException */ public ZoieMultiReader<R> copy() throws IOException { // increase DirectoryReader reference counter this.in.incRef(); ZoieMultiReader<R> ret = new ZoieMultiReader<R>(this.in, this._decorator, new ZoieSubReaderWrapper<R>(this._decorator, this._readerMap)); ret._docIDMapper = this._docIDMapper; return ret; }
/** * makes exact shallow copy of a given ZoieMultiReader * @throws IOException */ public ZoieMultiReader<R> copy() throws IOException { // increase DirectoryReader reference counter this.in.incRef(); ZoieMultiReader<R> ret = new ZoieMultiReader<R>(this.in, this._decorator, new ZoieSubReaderWrapper<R>(this._decorator, this._readerMap)); ret._docIDMapper = this._docIDMapper; return ret; }
protected List<ZoieIndexReader<R>> loadArchives() { List<ZoieIndexReader<R>> archives = new ArrayList<ZoieIndexReader<R>>(); long t0 = System.currentTimeMillis(); List<Directory> dirs = _dirMgrFactory.getAllArchivedDirectories(); for(Directory dir : dirs) { IndexReader reader; try { reader = IndexReader.open(dir,true); ZoieMultiReader<R> zoiereader = new ZoieMultiReader<R>(reader, _decorator); // Initialize docIdMapper DocIDMapper<?> mapper = _zConfig.getDocidMapperFactory().getDocIDMapper(zoiereader); zoiereader.setDocIDMapper(mapper); archives.add(zoiereader); } catch (CorruptIndexException e) { log.error("corruptedIndex", e); } catch (IOException e) { log.error("IOException", e); } } log.info("load "+dirs.size()+" archived indices of " + getSizeBytes() +" bytes in " + (System.currentTimeMillis() - t0) + "ms"); return archives; } ZoieSystem<R, D> createZoie(DirectoryManager dirmgr)
reader = new ZoieMultiReader<R>(srcReader, decorator); _currentSignature = signature; } catch (IOException ioe) {
reader = new ZoieMultiReader<R>(srcReader, decorator); _currentSignature = signature; } catch (IOException ioe) {
new StandardAnalyzer(Version.LUCENE_43))); addDocuments(directory, writer, documents); ZoieMultiReader<BoboSegmentReader> zoieMultiReader = new ZoieMultiReader<BoboSegmentReader>( DirectoryReader.open(directory), new SenseiIndexReaderDecorator(facets, runtimeFacets)); MockIndexReaderFactory mockIndexReaderFactory = new MockIndexReaderFactory(
private ZoieMultiReader<R> openIndexReaderInternal() throws IOException { if (DirectoryReader.indexExists(_directory)) { DirectoryReader srcReader = null; ZoieMultiReader<R> finalReader = null; try { // for RAM indexes, just get a new index reader srcReader = DirectoryReader.open(_directory); finalReader = new ZoieMultiReader<R>(srcReader, _decorator); DocIDMapper mapper = _idxMgr._docIDMapperFactory.getDocIDMapper(finalReader); finalReader.setDocIDMapper(mapper); return finalReader; } catch (IOException ioe) { // if reader decoration fails, still need to close the source reader if (srcReader != null) { srcReader.close(); } throw ioe; } } else { return null; // null indicates no index exist, following the contract } }
private ZoieMultiReader<R> openIndexReaderInternal() throws IOException { if (DirectoryReader.indexExists(_directory)) { DirectoryReader srcReader = null; ZoieMultiReader<R> finalReader = null; try { // for RAM indexes, just get a new index reader srcReader = DirectoryReader.open(_directory); finalReader = new ZoieMultiReader<R>(srcReader, _decorator); DocIDMapper mapper = _idxMgr._docIDMapperFactory.getDocIDMapper(finalReader); finalReader.setDocIDMapper(mapper); return finalReader; } catch (IOException ioe) { // if reader decoration fails, still need to close the source reader if (srcReader != null) { srcReader.close(); } throw ioe; } } else { return null; // null indicates no index exist, following the contract } }
zoiereader = new ZoieMultiReader<R>(reader, _decorator);
zoiereader = new ZoieMultiReader<R>(reader, _decorator);
zoiereader = new ZoieMultiReader<R>(reader, _decorator);