https://gitee.com/jly521/lucene-demo.gitjava
Lucene :開源的全文檢索引擎工具包git
檢索分4步::算法
Luck 是Lucene、Solr、ES 索引查看的 GUI 工具架構
IK 分詞器工具
Lucene 分詞詳解:性能
IK 分詞器ui
Lucene索引詳解::3d
IndexWriterConfig config = new IndexWriterConfig(analyzer); //每次會清空原有索引 config.setOpenMode(IndexWriterConfig.OpenMode.CREATE); //沒有則建立或有的就追加 //config.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND);
Luck 中查看索引code
Lucene 查詢詳解blog
QueryParser parser = new QueryParser(field, analyzer); parser.setDefaultOperator(Operator.AND); // 查詢語句 Query query = parser.parse("農村學生");
String[] fields = { "title", "content" }; ... MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, analyzer); Query multiFieldQuery = parser.parse("日本");
Term term = new Term("title", "美國"); Query termQuery = new TermQuery(term);
BooleanQuery boolQuery=new BooleanQuery.Builder().add(bc1).add(bc2).build();
IndexSearcher searcher = new IndexSearcher(reader); Query rangeQuery=IntPoint.newRangeQuery("reply",500,1000);
Term term = new Term("title", "學"); Query prefixQuery = new PrefixQuery(term);
PhraseQuery.Builder builder = new PhraseQuery.Builder(); builder.add(new Term("title", "美國"),2); builder.add(new Term("title", "總統"),3); PhraseQuery phraseQuery = builder.build();
Term term = new Term("title", "Trmp"); FuzzyQuery fuzzyQuery = new FuzzyQuery(term);
Term term = new Term("content", "學*"); Query wildcardQuery = new WildcardQuery(term);
Lucene 高亮
Lucene 新聞高頻詞提取