protected SearcherManager createSearchManager() throws IOException { return new SearcherManager(writer, APPLY_ALL_DELETES, true, null); }
public WritableIndexPartition( File partitionFolder, Directory directory, IndexWriterConfig writerConfig ) throws IOException { super( partitionFolder, directory ); this.indexWriter = new IndexWriter( directory, writerConfig ); this.searcherManager = new SearcherManager( indexWriter, new SearcherFactory() ); }
private static SearcherManager instantiateSearcherManager( IndexWriter writer ) { try { return new SearcherManager( writer, true, new SearcherFactory() ); } catch ( IOException e ) { throw new RuntimeException( e ); } }
ReadOnlyIndexPartition( File partitionFolder, Directory directory ) throws IOException { super( partitionFolder, directory ); this.searcherManager = new SearcherManager( directory, new SearcherFactory() ); }
mgr = new SearcherManager(dir, new ThreadpoolSearcherFactory()); searcherManagerMap.put(proj, mgr); searcher = (SuperIndexSearcher) mgr.acquire();
public static List<Long> getAllNodes( Directory directory, Value propertyValue ) throws IOException { try ( SearcherManager manager = new SearcherManager( directory, new SearcherFactory() ) ) { IndexSearcher searcher = manager.acquire(); Query query = LuceneDocumentStructure.newSeekQuery( propertyValue ); AllNodesCollector collector = new AllNodesCollector(); searcher.search( query, collector ); return collector.nodeIds; } }
@BeforeEach void initLuceneResources() throws Exception { dirFactory = new DirectoryFactory.InMemoryDirectoryFactory(); Directory dir = dirFactory.open( testDir.directory( "test" ) ); writer = new IndexWriter( dir, IndexWriterConfigs.standard() ); searcherManager = new SearcherManager( writer, true, new SearcherFactory() ); }
private ExternalSearcherManager createSearcherManager(SearchFactory externalSearcherFactory) throws EngineException { boolean success = false; SearcherManager internalSearcherManager = null; try { try { final DirectoryReader directoryReader = ElasticsearchDirectoryReader.wrap(DirectoryReader.open(indexWriter), shardId); internalSearcherManager = new SearcherManager(directoryReader, new RamAccountingSearcherFactory(engineConfig.getCircuitBreakerService())); lastCommittedSegmentInfos = store.readLastCommittedSegmentsInfo(); ExternalSearcherManager externalSearcherManager = new ExternalSearcherManager(internalSearcherManager, externalSearcherFactory); success = true; return externalSearcherManager; } catch (IOException e) { maybeFailEngine("start", e); try { indexWriter.rollback(); } catch (IOException inner) { // iw is closed below e.addSuppressed(inner); } throw new EngineCreationFailureException(shardId, "failed to open reader on writer", e); } } finally { if (success == false) { // release everything we created on a failure IOUtils.closeWhileHandlingException(internalSearcherManager, indexWriter); } } }
public DictionarySearcher(Directory indexDir) { try { mgr = new SearcherManager(indexDir, null); } catch (IOException e) { LOGGER.error(UNABLE_TO_OPEN_INDEX, e); } }
public SimpleSearcher(final File path) throws IOException { dir = FSDirectory.open(path); mgr = new SearcherManager(dir, null); }
public SimpleSearcher(final File path) throws IOException { dir = FSDirectory.open(path); mgr = new SearcherManager(dir, null); }
reader = open(indexCommit); reader = wrapReader(reader, readerWrapperFunction); searcherManager = new SearcherManager(reader, searcherFactory); this.docsStats = docsStats(lastCommittedSegmentInfos); this.indexWriterLock = indexWriterLock;
private void initCustomDirectory() { try { Directory customDir = customDictionaryHolder.getDataDictDirectory(); if (customDir != null) { customSearcherMananger = new SearcherManager(customDir, null); } } catch (IOException e) { LOGGER.error("Failed to read local dictionary cache! ", e); } }
private void init() { try { boolean isLuceneDir = DirectoryReader.indexExists(directory); if (!isLuceneDir) { LOGGER.debug("Document index is not a lucene index, trying to initialize an empty lucene index "); commitChanges(); } mgr = new SearcherManager(directory, null); } catch (IOException e) { LOGGER.error(e.getMessage(), 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()); } }
private void init(Analyzer analyzer, String keyspaceName, String cfName, String indexName, String vNodeName) throws IOException { this.indexName = indexName; this.keyspaceName = keyspaceName; this.cfName = cfName; this.analyzer = analyzer; this.vNodeName = vNodeName; if (logger.isDebugEnabled()) { logger.debug(indexName + " Lucene analyzer -" + analyzer); logger.debug(indexName + " Lucene version -" + Properties.luceneVersion); } indexWriter = getIndexWriter(Properties.luceneVersion); searcherManager = new SearcherManager(indexWriter, true, new SearcherFactory()); }
QueryIndex(IndexWriter indexWriter) throws IOException { this.writer = indexWriter; this.manager = new SearcherManager(writer, true, true, new TermsHashBuilder()); }
public void open() throws IOException { if (fileSystemDirectory == null) { directory = new RAMDirectory(); } else { directory = FSDirectory.open(fileSystemDirectory); } IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_45, analyzer); config.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND); indexWriter = new IndexWriter(directory, config); searcherManager = new SearcherManager(indexWriter, true, new SearcherFactory()); open = true; }
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); } }
public IndexSearcher acquireSearcher() throws IOException { checkOpenState(); if (searcherManager == null) { synchronized (lock) { if (searcherManager == null) { searcherManager = new SearcherManager(acquireReader(), null); } } } return searcherManager.acquire(); }