public IndexWriter createWriter(File directory, boolean doUpgrade) throws Exception { Directory luceneDirectory = directory != null ? MMapDirectory.open(directory.toPath()) : new RAMDirectory(); return createWriterWithLuceneDirectory(luceneDirectory, doUpgrade); }
public SearchCollection(SearchArgs args) throws IOException { this.args = args; Path indexPath = Paths.get(args.index); if (!Files.exists(indexPath) || !Files.isDirectory(indexPath) || !Files.isReadable(indexPath)) { throw new IllegalArgumentException(args.index + " does not exist or is not a directory."); } LOG.info("Reading index at " + indexPath); if (args.inmem) { this.reader = DirectoryReader.open(MMapDirectory.open(indexPath)); } else { this.reader = DirectoryReader.open(FSDirectory.open(indexPath)); } // Are we searching tweets? if (args.searchtweets) { LOG.info("Search Tweets"); analyzer = new TweetAnalyzer(); } else { analyzer = args.keepstop ? new EnglishStemmingAnalyzer(args.stemmer, CharArraySet.EMPTY_SET) : new EnglishStemmingAnalyzer(args.stemmer); } if (args.sdm) { LOG.info("Use Sequential Dependence Model query"); qc = QueryConstructor.SequentialDependenceModel; } else { LOG.info("Use Bag of Terms query"); qc = QueryConstructor.BagOfTerms; } isRerank = args.rm3 || args.axiom; }
public IndexWriter createWriter(File directory) throws IOException { Directory dir = MMapDirectory.open(directory.toPath()); Analyzer analyzer = new SimpleAnalyzer(); IndexWriterConfig iwc = new IndexWriterConfig(analyzer); if (this.indexOptions.contains(BlobIndexOption.CREATE)) { iwc.setOpenMode(OpenMode.CREATE); } else { iwc.setOpenMode(OpenMode.CREATE_OR_APPEND); } Long totalMBs = getHost().getServiceMemoryLimitMB(getSelfLink(), MemoryLimitType.EXACT); if (totalMBs != null) { totalMBs = Math.max(1, totalMBs); iwc.setRAMBufferSizeMB(totalMBs); } IndexWriter w = new IndexWriter(dir, iwc); w.commit(); return w; }
dir = FSDirectory.open(idxDir); } else if ("mmap".equals(modeConf)) { dir = MMapDirectory.open(idxDir); } else if ("nio".equals(modeConf)) { dir = NIOFSDirectory.open(idxDir);
IndexReader ir = DirectoryReader.open(MMapDirectory.open(new File(indexPath)));
directory = MMapDirectory.open(new File(rootDir, "core").toPath()); }else{ directory = new RAMDirectory();
index = MMapDirectory.open(directoryRunning, NoLockFactory.getNoLockFactory()); } else { index = new RAMDirectory(diskDir); if(diskIndexRunning) { IOUtils.deleteDirectory(directoryRunning); index = MMapDirectory.open(directoryRunning, NoLockFactory.getNoLockFactory()); } else { index = new RAMDirectory();
public IndexWriter createWriter(File directory, boolean doUpgrade) throws Exception { Directory dir = MMapDirectory.open(directory.toPath()); Analyzer analyzer = new SimpleAnalyzer(); // Upgrade the index in place if necessary. if (doUpgrade && DirectoryReader.indexExists(dir)) { upgradeIndex(dir); } IndexWriterConfig iwc = new IndexWriterConfig(analyzer); iwc.setOpenMode(OpenMode.CREATE_OR_APPEND); iwc.setIndexDeletionPolicy(new SnapshotDeletionPolicy( new KeepOnlyLastCommitDeletionPolicy())); Long totalMBs = getHost().getServiceMemoryLimitMB(getSelfLink(), MemoryLimitType.EXACT); if (totalMBs != null) { // give half to the index, the other half we keep for service caching context totalMBs = Math.max(1, totalMBs / 2); iwc.setRAMBufferSizeMB(totalMBs); } this.writer = new IndexWriter(dir, iwc); this.writer.commit(); this.indexUpdateTimeMicros = Utils.getNowMicrosUtc(); this.indexWriterCreationTimeMicros = this.indexUpdateTimeMicros; return this.writer; }
index = MMapDirectory.open(directoryRunning, NoLockFactory.getNoLockFactory()); } else { index = new RAMDirectory();
Directory from = MMapDirectory.open(restoreFrom); Directory to = new RAMDirectory(); for (String filename : from.listAll()) {
public DirectoryTaxonomyWriter getTaxoWriter(int segmentNumber) throws IOException { Directory d; if (indexConfig.getIndexSettings().getStoreIndexOnDisk()) { d = MMapDirectory.open(getPathForFacetsIndex(segmentNumber)); } else { String indexSegmentDbName = getIndexSegmentDbName(segmentNumber); String indexSegmentCollectionName = getIndexSegmentCollectionName(segmentNumber) + "_facets"; MongoDirectory mongoDirectory = new MongoDirectory(mongo, indexSegmentDbName, indexSegmentCollectionName, clusterConfig.isSharded(), clusterConfig.getIndexBlockSize()); d = new DistributedDirectory(mongoDirectory); } NRTCachingDirectory nrtCachingDirectory = new NRTCachingDirectory(d, 2, 10); return new DirectoryTaxonomyWriter(nrtCachingDirectory); }
d = MMapDirectory.open(getPathForIndex(segmentNumber));