@Test(expected = IllegalArgumentException.class) public void testIndexedButNotStoredField() throws IOException { SingleFieldDocument document = new SingleFieldDocument("id", "field") { @Override public Document asLuceneDocument() { Document document = super.asLuceneDocument(); document.add(new TextField("indexed", "This text is indexed", Field.Store.NO)); return document; } }; commitDocuments(getDirectory(getIndexPath1AsFile()), document); lucene2SeqConf = new LuceneStorageConfiguration(configuration, asList(getIndexPath1()), seqFilesOutputPath, SingleFieldDocument.ID_FIELD, asList(SingleFieldDocument.FIELD, "indexed")); lucene2Seq.run(lucene2SeqConf); }
public void run(final LuceneStorageConfiguration lucene2seqConf) throws IOException { List<Path> indexPaths = lucene2seqConf.getIndexPaths(); int processedDocs = 0; for (Path indexPath : indexPaths) { Directory directory = FSDirectory.open(new File(indexPath.toUri().getPath())); IndexReader reader = DirectoryReader.open(directory); IndexSearcher searcher = new IndexSearcher(reader); LuceneIndexHelper.fieldShouldExistInIndex(reader, lucene2seqConf.getIdField()); for (String field : lucene2seqConf.getFields()) { LuceneIndexHelper.fieldShouldExistInIndex(reader, field); } Configuration configuration = lucene2seqConf.getConfiguration(); FileSystem fileSystem = FileSystem.get(configuration); Path sequenceFilePath = new Path(lucene2seqConf.getSequenceFilesOutputPath(), indexPath.getName()); final SequenceFile.Writer sequenceFileWriter = new SequenceFile.Writer(fileSystem, configuration, sequenceFilePath, Text.class, Text.class); SeqFileWriterCollector writerCollector = new SeqFileWriterCollector(lucene2seqConf, sequenceFileWriter, processedDocs); searcher.search(lucene2seqConf.getQuery(), writerCollector); log.info("Wrote " + writerCollector.processedDocs + " documents in " + sequenceFilePath.toUri()); processedDocs = writerCollector.processedDocs; Closeables.close(sequenceFileWriter, false); directory.close(); reader.close(); } }
SequenceFilesFromLuceneStorage { public void run(final LuceneStorageConfiguration lucene2seqConf) throws IOException { List<Path> indexPaths = lucene2seqConf.getIndexPaths(); int processedDocs = 0; for (Path indexPath : indexPaths) { Directory directory = FSDirectory.open(new File(indexPath.toUri().getPath())); IndexReader reader = DirectoryReader.open(directory); IndexSearcher searcher = new IndexSearcher(reader); LuceneIndexHelper.fieldShouldExistInIndex(reader, lucene2seqConf.getIdField()); for (String field : lucene2seqConf.getFields()) { LuceneIndexHelper.fieldShouldExistInIndex(reader, field); } Configuration configuration = lucene2seqConf.getConfiguration(); FileSystem fileSystem = FileSystem.get(configuration); Path sequenceFilePath = new Path(lucene2seqConf.getSequenceFilesOutputPath(), indexPath.getName()); final SequenceFile.Writer sequenceFileWriter = new SequenceFile.Writer(fileSystem, configuration, sequenceFilePath, Text.class, Text.class); SeqFileWriterCollector writerCollector = new SeqFileWriterCollector(lucene2seqConf, sequenceFileWriter, processedDocs); searcher.search(lucene2seqConf.getQuery(), writerCollector); log.info("Wrote " + writerCollector.processedDocs + " documents in " + sequenceFilePath.toUri()); processedDocs = writerCollector.processedDocs; Closeables.close(sequenceFileWriter, false); directory.close(); reader.close(); } } }
SequenceFilesFromLuceneStorage { public void run(final LuceneStorageConfiguration lucene2seqConf) throws IOException { List<Path> indexPaths = lucene2seqConf.getIndexPaths(); int processedDocs = 0; for (Path indexPath : indexPaths) { Directory directory = FSDirectory.open(new File(indexPath.toUri().getPath())); IndexReader reader = DirectoryReader.open(directory); IndexSearcher searcher = new IndexSearcher(reader); LuceneIndexHelper.fieldShouldExistInIndex(reader, lucene2seqConf.getIdField()); for (String field : lucene2seqConf.getFields()) { LuceneIndexHelper.fieldShouldExistInIndex(reader, field); } Configuration configuration = lucene2seqConf.getConfiguration(); FileSystem fileSystem = FileSystem.get(configuration); Path sequenceFilePath = new Path(lucene2seqConf.getSequenceFilesOutputPath(), indexPath.getName()); final SequenceFile.Writer sequenceFileWriter = new SequenceFile.Writer(fileSystem, configuration, sequenceFilePath, Text.class, Text.class); SeqFileWriterCollector writerCollector = new SeqFileWriterCollector(lucene2seqConf, sequenceFileWriter, processedDocs); searcher.search(lucene2seqConf.getQuery(), writerCollector); log.info("Wrote " + writerCollector.processedDocs + " documents in " + sequenceFilePath.toUri()); processedDocs = writerCollector.processedDocs; Closeables.close(sequenceFileWriter, false); directory.close(); reader.close(); } }  }
SequenceFilesFromLuceneStorage { public void run(final LuceneStorageConfiguration lucene2seqConf) throws IOException { List<Path> indexPaths = lucene2seqConf.getIndexPaths(); int processedDocs = 0; for (Path indexPath : indexPaths) { Directory directory = FSDirectory.open(new File(indexPath.toUri().getPath())); IndexReader reader = DirectoryReader.open(directory); IndexSearcher searcher = new IndexSearcher(reader); LuceneIndexHelper.fieldShouldExistInIndex(reader, lucene2seqConf.getIdField()); for (String field : lucene2seqConf.getFields()) { LuceneIndexHelper.fieldShouldExistInIndex(reader, field); } Configuration configuration = lucene2seqConf.getConfiguration(); FileSystem fileSystem = FileSystem.get(configuration); Path sequenceFilePath = new Path(lucene2seqConf.getSequenceFilesOutputPath(), indexPath.getName()); final SequenceFile.Writer sequenceFileWriter = new SequenceFile.Writer(fileSystem, configuration, sequenceFilePath, Text.class, Text.class); SeqFileWriterCollector writerCollector = new SeqFileWriterCollector(lucene2seqConf, sequenceFileWriter, processedDocs); searcher.search(lucene2seqConf.getQuery(), writerCollector); log.info("Wrote " + writerCollector.processedDocs + " documents in " + sequenceFilePath.toUri()); processedDocs = writerCollector.processedDocs; Closeables.close(sequenceFileWriter, false); directory.close(); reader.close(); } }  void run(final LuceneStorageConfiguration lucene2seqConf); }
SequenceFilesFromLuceneStorage { public void run(final LuceneStorageConfiguration lucene2seqConf) throws IOException { List<Path> indexPaths = lucene2seqConf.getIndexPaths(); int processedDocs = 0; for (Path indexPath : indexPaths) { Directory directory = FSDirectory.open(new File(indexPath.toUri().getPath())); IndexReader reader = DirectoryReader.open(directory); IndexSearcher searcher = new IndexSearcher(reader); LuceneIndexHelper.fieldShouldExistInIndex(reader, lucene2seqConf.getIdField()); for (String field : lucene2seqConf.getFields()) { LuceneIndexHelper.fieldShouldExistInIndex(reader, field); } Configuration configuration = lucene2seqConf.getConfiguration(); FileSystem fileSystem = FileSystem.get(configuration); Path sequenceFilePath = new Path(lucene2seqConf.getSequenceFilesOutputPath(), indexPath.getName()); final SequenceFile.Writer sequenceFileWriter = new SequenceFile.Writer(fileSystem, configuration, sequenceFilePath, Text.class, Text.class); SeqFileWriterCollector writerCollector = new SeqFileWriterCollector(lucene2seqConf, sequenceFileWriter, processedDocs); searcher.search(lucene2seqConf.getQuery(), writerCollector); log.info("Wrote " + writerCollector.processedDocs + " documents in " + sequenceFilePath.toUri()); processedDocs = writerCollector.processedDocs; Closeables.close(sequenceFileWriter, false); directory.close(); reader.close(); } }  void run(final LuceneStorageConfiguration lucene2seqConf);  }