@Override protected void doClose() throws IOException { in.close(); }
void setIndexReaderSearcher() throws IOException { FSDirectory index = FSDirectory.open(indexDir.toPath()); if(reader == null){ reader = DirectoryReader.open(index); searcher = new IndexSearcher(reader); }else{ DirectoryReader newreader = DirectoryReader.openIfChanged(reader); if(newreader != null) { reader.close(); reader = newreader; searcher = new IndexSearcher(reader); } } }
static synchronized void setIndexReaderSearcher() { try{ FSDirectory index = NIOFSDirectory.open(indexDir.toPath()); if(reader == null){ reader = DirectoryReader.open(index); searcher = new IndexSearcher(reader); }else{ DirectoryReader newreader = DirectoryReader.openIfChanged(reader); if(newreader != null) { reader.close(); reader = newreader; searcher = new IndexSearcher(reader); } } }catch(IOException e){ throw new RuntimeException(e); } }
ireader.close(); dir.close();
private synchronized void close() throws IOException { if (reader != null) reader.close(); if (writer != null) writer.rollback(); }
@Override protected void doClose() throws IOException { indexReader.close(); taxoArrays = null; // do not clear() the caches, as they may be used by other DTR instances. ordinalCache = null; categoryCache = null; }
@Override protected void doClose() throws IOException { indexReader.close(); taxoArrays = null; // do not clear() the caches, as they may be used by other DTR instances. ordinalCache = null; categoryCache = null; }
DirectoryReader oldReader = directoryReader; DirectoryReader newReader = DirectoryReader.openIfChanged(directoryReader); if ((newReader != null) & (oldReader != newReader)) { directoryReader = newReader; oldReader.close(); // need to close the old one } else { // nothing to do }
@Override protected void doClose() throws IOException { in.close(); }
@Override protected void cleanup() throws IOException { if (indexReader != null) indexReader.close(); }
synchronized private DirectoryReader upToDateDirectoryReader() throws IOException { long changeToken = changeCounter.get(); DirectoryReader oldDirReader = directoryReader; directoryReader = createDirectoryReader(oldDirReader, indexWriter); if (oldDirReader != null && oldDirReader != directoryReader) { oldDirReader.close(); } changeCounter.compareAndSet(changeToken, 0); return directoryReader; }
public void start() throws IOException { DirectoryReader reader = DirectoryReader.open(FSDirectory.open(_idxDir)); try { _boboReader = BoboMultiReader.getInstance(reader); } catch (IOException ioe) { if (reader != null) { reader.close(); } } }
public void close() throws IOException { if (ireader != null) { ireader.close(); } if (directory != null) { directory.close(); } }
public void close() { try { ireader.close(); directory.close(); } catch (IOException e) { log.error(e.getLocalizedMessage(), e); } }
@Override public void close() { try { ireader.close(); directory.close(); } catch (IOException e) { log.error(e.getLocalizedMessage(), e); } }
@Override public void close() { try { ireader.close(); directory.close(); } catch (IOException e) { log.error(e.getLocalizedMessage(), e); } }
public void close() throws IOException { if (iwriter != null) { iwriter.close(); } if (ireader != null) { ireader.close(); } if (directory != null) { directory.close(); } } }
/** * 停止服务 */ public void stopService() { try { reader.close(); directory.close(); logger.info("gankhub stop service"); } catch (IOException e) { e.printStackTrace(); } }
DirectoryReader ireader=DirectoryReader.open(mDir); IndexSearcher isearcher=new IndexSearcher(ireader); QueryParser parser = new QueryParser(Version.LUCENE_46,myfieldname,analyzer); parser.setDefaultOperator(QueryParser.Operator.AND); parser.setPhraseSlop(0); Query query=parser.createPhraseQuery(myfieldname,keyword); ScoreDoc[] hits=isearcher.search(query, null, 1000).scoreDocs; nret=hits.length; ireader.close();
private static void closeIndexReader(DirectoryReader ireader) { try { if (ireader != null) { ireader.close(); if (ireader.directory() != null) { ireader.directory().close(); } } } catch (Exception e) { logger.error(null, e); } }