⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 verboseindexing.java

📁 Lucene in Action 中文版代码下载
💻 JAVA
字号:
package lia.indexing;import org.apache.lucene.store.Directory;import org.apache.lucene.store.FSDirectory;import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;import org.apache.lucene.index.IndexWriter;import org.apache.lucene.analysis.SimpleAnalyzer;import java.io.IOException;/** * */public class VerboseIndexing {  private void index() throws IOException {    String dirPath =      System.getProperty("java.io.tmpdir", "tmp") +      System.getProperty("file.separator") + "verbose-index";    Directory dir = FSDirectory.getDirectory(dirPath, true);    IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(),      true);    writer.infoStream = System.out;    for (int i = 0; i < 100; i++) {      Document doc = new Document();      doc.add(Field.Keyword("keyword", "goober"));      writer.addDocument(doc);    }    writer.optimize();    writer.close();  }  public static void main(String[] args) throws IOException {    VerboseIndexing vi = new VerboseIndexing();    vi.index();  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -