public void run() { // do it ... try { IndexWriter indexWriter = LuceneUtils.createIndexWriter(indexPath, false, LuceneUtils.AnalyzerType.WhitespaceAnalyzer); // IndexWriterConfig config = new IndexWriterConfig(LuceneUtils.LUCENE_VERSION, new WhitespaceAnalyzer(LuceneUtils.LUCENE_VERSION)); // config.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND); // config.setCodec(new LireCustomCodec()); // IndexWriter indexWriter = new IndexWriter(FSDirectory.open(new File(indexPath)), config); for (Iterator<File> iterator = inputFiles.iterator(); iterator.hasNext(); ) { File inputFile = iterator.next(); if (verbose) System.out.println("Processing " + inputFile.getPath() + "."); readFile(indexWriter, inputFile); if (verbose) System.out.println("Indexing finished."); } LuceneUtils.commitWriter(indexWriter); // LuceneUtils.optimizeWriter(indexWriter); LuceneUtils.closeWriter(indexWriter); // indexWriter.commit(); // indexWriter.close(); } catch (Exception e) { e.printStackTrace(); } }
public static IndexReader openIndexReader(FSDirectory directory) throws IOException { return openIndexReader(directory, false); }
try { long start = System.currentTimeMillis(); writer = LuceneUtils.createIndexWriter(indexPath, overWrite, LuceneUtils.AnalyzerType.WhitespaceAnalyzer); if (imageList == null) { LuceneUtils.commitWriter(writer); LuceneUtils.optimizeWriter(writer); LuceneUtils.closeWriter(writer);
/** * Creates an IndexWriter for given index path, with a SimpleAnalyzer. * * @param indexPath the path to the index directory * @param create set to true if you want to create a new index * @return the IndexWriter * @throws IOException */ public static IndexWriter createIndexWriter(String indexPath, boolean create) throws IOException { return createIndexWriter(indexPath, create, AnalyzerType.SimpleAnalyzer); //TODO: Simple or Standard ?? }
private void flushDocuments() { System.out.println("Flushing documents...."); long start = System.currentTimeMillis(); try { for (Map.Entry<String, Document> documentEntry : allDocuments.entrySet()) { writer.addDocument(documentEntry.getValue()); } LuceneUtils.commitWriter(writer); } catch (IOException e) { e.printStackTrace(); } System.out.printf("Time of flushing: %s.\n", convertTime(System.currentTimeMillis() - start)); }
try { long start = System.currentTimeMillis(); writer = LuceneUtils.createIndexWriter(indexPath, overWrite, LuceneUtils.AnalyzerType.WhitespaceAnalyzer); if (imageList == null) { LuceneUtils.commitWriter(writer); LuceneUtils.optimizeWriter(writer); LuceneUtils.closeWriter(writer);
/** * Creates an IndexWriter for given index path, with a SimpleAnalyzer. * * @param indexPath the path to the index directory * @param create set to true if you want to create a new index * @return the IndexWriter * @throws IOException */ public static IndexWriter createIndexWriter(String indexPath, boolean create) throws IOException { return createIndexWriter(indexPath, create, AnalyzerType.SimpleAnalyzer); //TODO: Simple or Standard ?? }
private void flushDocuments() { System.out.println("Flushing documents...."); long start = System.currentTimeMillis(); try { for (Map.Entry<String, Document> documentEntry : allDocuments.entrySet()) { writer.addDocument(documentEntry.getValue()); } LuceneUtils.commitWriter(writer); } catch (IOException e) { e.printStackTrace(); } System.out.printf("Time of flushing: %s.\n", convertTime(System.currentTimeMillis() - start)); }
public void run() { // do it ... try { IndexWriter indexWriter = LuceneUtils.createIndexWriter(indexPath, false, LuceneUtils.AnalyzerType.WhitespaceAnalyzer); // IndexWriterConfig config = new IndexWriterConfig(LuceneUtils.LUCENE_VERSION, new WhitespaceAnalyzer(LuceneUtils.LUCENE_VERSION)); // config.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND); // config.setCodec(new LireCustomCodec()); // IndexWriter indexWriter = new IndexWriter(FSDirectory.open(new File(indexPath)), config); for (Iterator<File> iterator = inputFiles.iterator(); iterator.hasNext(); ) { File inputFile = iterator.next(); if (verbose) System.out.println("Processing " + inputFile.getPath() + "."); readFile(indexWriter, inputFile); if (verbose) System.out.println("Indexing finished."); } LuceneUtils.commitWriter(indexWriter); // LuceneUtils.optimizeWriter(indexWriter); LuceneUtils.closeWriter(indexWriter); // indexWriter.commit(); // indexWriter.close(); } catch (Exception e) { e.printStackTrace(); } }
public LuceneIndexWriter(File infile, File indexDirectory, boolean doHashingBitSampling, boolean doMetricSpaceIndexing, boolean useDocValues) throws IOException { super(infile, useDocValues, doHashingBitSampling, doMetricSpaceIndexing); this.iw = LuceneUtils.createIndexWriter(indexDirectory.getPath(), true, LuceneUtils.AnalyzerType.WhitespaceAnalyzer); }
public static IndexReader openIndexReader(FSDirectory directory) throws IOException { return openIndexReader(directory, false); }
public void run() { IndexWriter indexWriter = LuceneUtils.createIndexWriter(indexPath, overwriteIndex, LuceneUtils.AnalyzerType.WhitespaceAnalyzer); for (Iterator<File> iterator = inputFiles.iterator(); iterator.hasNext(); ) { File inputFile = iterator.next(); if (verbose) System.out.println("Indexing finished."); LuceneUtils.commitWriter(indexWriter); LuceneUtils.closeWriter(indexWriter);
public LuceneIndexWriter(File infile, File indexDirectory, boolean doHashingBitSampling, boolean doMetricSpaceIndexing, boolean useDocValues) throws IOException { super(infile, useDocValues, doHashingBitSampling, doMetricSpaceIndexing); this.iw = LuceneUtils.createIndexWriter(indexDirectory.getPath(), true, LuceneUtils.AnalyzerType.WhitespaceAnalyzer); }
public static IndexReader openIndexReader(String indexPath, boolean RAMDirectory) throws IOException { return openIndexReader(FSDirectory.open(Paths.get(indexPath)), RAMDirectory); }
public void run() { IndexWriter indexWriter = LuceneUtils.createIndexWriter(indexPath, overwriteIndex, LuceneUtils.AnalyzerType.WhitespaceAnalyzer); for (Iterator<File> iterator = inputFiles.iterator(); iterator.hasNext(); ) { File inputFile = iterator.next(); if (verbose) System.out.println("Indexing finished."); LuceneUtils.commitWriter(indexWriter); LuceneUtils.closeWriter(indexWriter);
/** * Creates an IndexWriter for given index path, with given analyzer. * * @param indexPath the path to the index directory * @param create set to true if you want to create a new index * @param analyzer gives the analyzer used for the Indexwriter. * @return an IndexWriter * @throws IOException */ public static IndexWriter createIndexWriter(String indexPath, boolean create, AnalyzerType analyzer) throws IOException { return createIndexWriter(FSDirectory.open(Paths.get(indexPath)), create, analyzer); }
public static IndexReader openIndexReader(String indexPath) throws IOException { return openIndexReader(FSDirectory.open(Paths.get(indexPath)), false); }
/** * Creates an IndexWriter for given index path, with given analyzer. * * @param indexPath the path to the index directory * @param create set to true if you want to create a new index * @param analyzer gives the analyzer used for the Indexwriter. * @return an IndexWriter * @throws IOException */ public static IndexWriter createIndexWriter(String indexPath, boolean create, AnalyzerType analyzer) throws IOException { return createIndexWriter(FSDirectory.open(Paths.get(indexPath)), create, analyzer); }
public static IndexReader openIndexReader(String indexPath) throws IOException { return openIndexReader(FSDirectory.open(Paths.get(indexPath)), false); }
/** * Creates an IndexWriter for given index path, with a SimpleAnalyzer. * * @param indexPath the path to the index directory * @param create set to true if you want to create a new index * @return the IndexWriter * @throws IOException */ public static IndexWriter createIndexWriter(String indexPath, boolean create) throws IOException { return createIndexWriter(indexPath, create, AnalyzerType.SimpleAnalyzer); }