IndexSearcher is = new IndexSearcher("C:\\luceneIndex");
//对path 进行分词,否则只有输入文章全名才能搜索到
QueryParser qp = new QueryParser("path", new StandardAnalyzer());
Query q = qp.parse("安徽");
Hits hits = is.search(q);
System.out.println(hits.length());
for(int i=0;i<hits.length();i++){
System.out.print(hits.doc(i)+"\t"+hits.score(i));
System.out.println();
}
分享到:
相关推荐
从HDFS导入Wikipedia XML转储到Lucene索引或Elasticsearch,并基于Lucene的MoreLikeThis查询检索类似的Wikipedia文章。 此应用程序是基于文本的文档相似性度量的实现,该度量被用作的研究中的基准度量。 将...
Luke 是查询LUCENE索引文件的工具,而且用 Luke 的Search可以做查询.
import org.apache.lucene.search.Hits; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; /** * 张超 * ago52030@163.com * @author Administrator * */ public ...
文档中包含Lucene4.0.0版本jar包,中文分词器jar包,Lucene实例代码 1:建立索引 2:各种搜索方式方法 3:删除索引 4:检查索引文件 5:恢复删除的索引 6:强制删除 7:更新索引 8:合并索引 9:高亮回显 供大家参考...
最新版本的工具!...一款可以查看Lucene分词后在索引的排名以及是否有无该词,很多时候用于查看有无需要屏蔽的词,能查到的话,delete,呵呵...查看词在overview中输入排名数字,show top term,搜索词在search中
lucene项目,首先要准备查询的数据放到相关路径下(在Constant类中是设置路径的地方)。 LuceneIndex是创建索引; LuceneSearch是查询; TokenTest是分词; MoreLikeTest是查找相似文章
together with classes integrating them with the Lucene search engine. A few changes has been made to the static Snowball code and compiled stemmers: * Class SnowballProgram is made abstract and ...
使用lucene对字符串数组在内存建立索引 并检索
luke lucene索引数据查看器.Luke 是查询LUCENE索引文件的工具, 而且用 Luke 的Search可以做查询。
import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.Term; import org.apache.lucene.queryParser.MultiFieldQueryParser; import org.apache.lucene.search.BooleanClause; import org....
在网上找了实例,但是发现不能使用,只能简历索引。不能查询。自己写了个。lucene3.6版本,能够建立索引,能...inderwriter,indexsearch. 其中包C下的helloword实例能用,其余的全是网上不能用的。直接下载 可以运行
全文检索(Full-text Search) 顺序扫描法:如果要找包含某⼀特定内容的⽂件,对于每⼀个文档,从头到尾扫描内容,如果此文档包含此字符串, 则此文档为我们要找的⽂件,接着看下⼀个⽂件,直到扫描完所有的⽂件,因此...
5) search模块:负责对索引的搜索。提供了索引搜索器IndexSearcher类和各种Query类,如TermQuery、BooleanQuery等。 6) queryParser模块:负责查询语句的语法分析。提供了解析查询语句的QueryParser类 7) util...
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT); //创建一个语法分析器 IndexWriter iwriter = null; Directory directory = null; try { directory = FSDirectory.open(destDir); //...
Lucene7.4检索和打分过程的源代码阅读思路,这里只针对用BooleanQuery作为Query,从IndexSearch说起,从检索到打分的过程,还加入了自己的无关的一些想法,忽略即可。
2. Building a search index 3. Adding search to your application 4. Lucene’s analysis process 5. Advanced search techniques 6. Extending search Part 2: Applied Lucene 7. Extracting text with ...
Elasticsearch是一个开源的分布式搜索和分析引擎,构建在Apache Lucene之上。它提供了一套强大的API和工具,可以实现分布式全文搜索、结构化和非结构化数据分析、日志存储和实时数据可视化等功能。 以下是一些...
import org.apache.lucene.search.highlight.TokenSources; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; public class Segment { public static void main...
Apache Lucene.NET.NET的全文本搜索Apache Lucene.NET是.NET全文搜索引擎框架,是流行的Apache Lucene项目的C#端口。 Apache Lucene.NET并不是一个完整的应用程序,而是可以轻松用于向应用程序添加搜索功能的代码库...