91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2KB
    文件類型: .java
    金幣: 1
    下載: 1 次
    發布日期: 2021-07-11
  • 語言: Java
  • 標簽: lucene??

資源簡介

創建索引 一、創建詞法分析器 二、創建索引存儲目錄 三、創建索引寫入器 四、將內容存儲到索引 關鍵字查詢 一、創建索引存儲目錄讀取器 二、創建索引搜索器 三、解析查詢 四、獲取結果

資源截圖

代碼片段和文件信息

package?lucene;

import?org.apache.lucene.analysis.Analyzer;
import?org.apache.lucene.analysis.standard.StandardAnalyzer;
import?org.apache.lucene.document.Document;
import?org.apache.lucene.index.IndexWriter;
import?org.apache.lucene.queryParser.QueryParser;
import?org.apache.lucene.search.IndexSearcher;
import?org.apache.lucene.search.Query;
import?org.apache.lucene.search.ScoreDoc;
import?org.apache.lucene.store.Directory;
import?org.apache.lucene.store.RAMDirectory;

public?class?LuceneDemo?{

//?============?創建索引?=============
//?一、創建詞法分析器
Analyzer?analyzer?=?new?StandardAnalyzer();

//?二、創建索引存儲目錄
//?Store?the?index?in?memory:
Directory?directory?=?new?RAMDirectory();
//?To?store?an?index?on?disk?use?this?instead:
//Directory?directory?=?FSDirectory.open(“/tmp/testindex“);

//?三、創建索引寫入器
IndexWriterConfig?config?=?new?IndexWriterConfig(analyzer);
IndexWriter?iwriter?=?new?IndexWriter(directory?config);


評論

共有 條評論