private void closeSearcher() { try { if ( searcherManager != null ) { this.searcherManager.close(); } } catch ( IOException e ) { throw new RuntimeException( e ); } finally { this.searcherManager = null; } }
/** * After new configuration is put into place, the set of projects might * change so we go through the SearcherManager objects and close those where * the corresponding project is no longer present. */ public void refreshSearcherManagerMap() { ArrayList<String> toRemove = new ArrayList<>(); for (Map.Entry<String, SearcherManager> entry : searcherManagerMap.entrySet()) { // If a project is gone, close the corresponding SearcherManager // so that it cannot produce new IndexSearcher objects. if (!getProjectNames().contains(entry.getKey())) { try { LOGGER.log(Level.FINE, "closing SearcherManager for project" + entry.getKey()); entry.getValue().close(); } catch (IOException ex) { LOGGER.log(Level.SEVERE, "cannot close SearcherManager for project" + entry.getKey(), ex); } toRemove.add(entry.getKey()); } } for (String proj : toRemove) { searcherManagerMap.remove(proj); } }
private void closeSearchManager() throws IOException { if (searcherManager != null) { searcherManager.close(); } }
protected void closeIndexWriter() throws IOException { if (searcherManager != null) { searcherManager.close(); searcherManager = null; } if (indexWriter != null) { indexWriter.commit(); indexWriter.close(); indexWriter = null; } }
public void close() { if (sharedSearcherManager != null) { try { sharedSearcherManager.close(); } catch (IOException e) { LOGGER.error(e.getMessage(), e); } } if (customSearcherMananger != null) { try { customSearcherMananger.close(); } catch (IOException e) { LOGGER.error(e.getMessage(), e); } } } }
public void close() { Log.d(TAG, "close"); endIndexing(); if (mSearcherManager != null) { try { mSearcherManager.close(); } catch (IOException e) { Log.e(TAG, "close - " + e.getClass() + ": " + e.getLocalizedMessage()); } mSearcherManager = null; } }
public void close() throws IOException { searcherManager.close(); indexWriter.close(); directory.close(); open = false; }
@Override public void close() throws IOException { if (searcherMgr != null) { searcherMgr.close(); searcherMgr = null; } if (writer != null) { writer.close(); dir.close(); writer = null; } }
private void closeReaders() throws CorruptIndexException, IOException { if ( searcherManager != null ) { searcherManager.close(); searcherManager = null; } if ( indexWriter != null ) { indexWriter.close(); indexWriter = null; } }
public void close() throws IOException { mgr.close(); dir.close(); }
private void closeReaders() throws CorruptIndexException, IOException { if ( searcherManager != null ) { searcherManager.close(); searcherManager = null; } if ( indexWriter != null ) { indexWriter.close(); indexWriter = null; } }
public void close() throws IOException { mgr.close(); dir.close(); }
private void closeReaders() throws CorruptIndexException, IOException { if ( searcherManager != null ) { searcherManager.close(); searcherManager = null; } if ( indexWriter != null ) { indexWriter.close(); indexWriter = null; } }
private static void destory() { try { if (indexWriter!=null) { indexWriter.commit(); indexWriter.close(); } if (directory!=null) { directory.close(); } if (searcherManager!=null) { searcherManager.close(); } } catch (IOException e) { logger.error("", e); } }
private void updateSearcherManager() { Log.d(TAG, "updateSearcherManager"); try { if (mSearcherManager != null) { mSearcherManager.close(); } File indexDirFile = new File(mLucenePath); Directory dir = FSDirectory.open(indexDirFile); mSearcherManager = new SearcherManager(dir, new SearcherFactory()); } catch (IOException e) { Log.e(TAG, "updateSearcherManager - " + e.getClass() + ": " + e.getLocalizedMessage()); } }
@Listen public void on(SystemStopping event) { synchronized (searcherManagers) { for (SearcherManager searcherManager: searcherManagers.values()) { try { searcherManager.close(); } catch (IOException e) { throw ExceptionUtils.unchecked(e); } } searcherManagers.clear(); } }
private synchronized void ensureOpen() throws IOException { if (writer == null) { if (searcherMgr != null) { searcherMgr.close(); searcherMgr = null; } writer = new IndexWriter(dir, getIndexWriterConfig(getGramAnalyzer(), IndexWriterConfig.OpenMode.CREATE)); searcherMgr = new SearcherManager(writer, null); } }
@Override public void close() throws IOException { if (COLLECT_METRICS) { MetricUtils.removeAllMetricsThatStartWith(MetricRegistry.name(METRIC_PREFIX, name)); } committerThread.close(); // commit will fail if writer is closed if (writer.isOpen()) { // flush first writer.flush(); commit(); writer.close(); } searcherManager.close(); }
public void close() throws LuceneException { assertNotClosed(); try { log.info("Closing connection to {}", writer.getDirectory()); closeWriter(); searcherManager.close(); isClosed.set(true); } catch (IOException e) { throw new LuceneException(e); } shutdownScheduledExecutorService(); closeSearcherLifetimeManager(); }
protected void closeIndex() throws IOException { OLogManager.instance().debug(this, "Closing Lucene index '" + this.indexName + "'..."); if (nrt != null) { nrt.interrupt(); nrt.close(); } if (searcherManager != null) searcherManager.close(); if (mgrWriter != null) { mgrWriter.getIndexWriter().commit(); mgrWriter.getIndexWriter().close(); } }