lucene

Stemming English words with Lucene

自闭症网瘾萝莉.ら 提交于 2019-12-28 03:30:08
问题 I'm processing some English texts in a Java application, and I need to stem them. For example, from the text "amenities/amenity" I need to get "amenit". The function looks like: String stemTerm(String term){ ... } I've found the Lucene Analyzer, but it looks way too complicated for what I need. http://lucene.apache.org/java/2_2_0/api/org/apache/lucene/analysis/PorterStemFilter.html Is there a way to use it to stem words without building an Analyzer? I don't understand all the Analyzer

Hibernate Search: How to use wildcards correctly?

橙三吉。 提交于 2019-12-28 03:12:28
问题 I have the following query to search patients by full name, for an specific medical center: MustJunction mj = qb.bool().must(qb.keyword() .onField("medicalCenter.id") .matching(medicalCenter.getId()) .createQuery()); for(String term: terms) if(!term.equals("")) mj.must(qb.keyword() .onField("fullName") .matching(term+"*") .createQuery()); And it is working perfectly, but only if the user types the full firstname and/or lastname of the patient. However I would like to make if work even if the

Lucene 教程

允我心安 提交于 2019-12-27 03:34:53
Lucene是apache组织的一个用java实现全文搜索引擎的开源项目。 其功能非常的强大,api也很简单。总得来说用Lucene来进行建立 和搜索和操作数据库是差不多的(有点像),Document可以看作是 数据库的一行记录,Field可以看作是数据库的字段。用lucene实 现搜索引擎就像用JDBC实现连接数据库一样简单。 Lucene2.0,它与以前广泛应用和介绍的Lucene 1.4.3并不兼容。 Lucene2.0的下载地址是 http://apache.justdn.org/lucene/java/ 例子一 : 1、在windows系统下的的C盘,建一个名叫s的文件夹,在该文件夹里面随便建三个txt文件,随便起名啦,就叫"1.txt","2.txt"和"3.txt"啦 其中1.txt的内容如下: 中华人民共和国 全国人民 2006年 而"2.txt"和"3.txt"的内容也可以随便写几写,这里懒写,就复制一个和1.txt文件的内容一样吧 2、下载lucene包,放在classpath路径中 建立索引: package lighter.javaeye.com; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io

Lucene教程

。_饼干妹妹 提交于 2019-12-27 03:33:52
一:简单的示例 1.1:生成索引     1.1.1:Field.Store和Field.Index     1.1.2:为数字生成索引     1.1.3:为索引加权     1.1.4:为日期生成索引  1.2:查询    1.2.1:介绍IndexReader 1.3:删除    1.3.1:还原删除的文档    1.3.2:清空回收站时面的数据  1.4:更新 前言:本教程用于 Lucene3.5 ,Maven地址为 <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-core</artifactId> <version>3.5.0</version> </dependency> 一:简单的示例 我就不介绍Lucene了,想来看这篇博客的人,都知道Lucene是什么。直接给出生成索引,和查询的示例 1.1:生成索引 生成索引的代码如下: /** * 创建索引 */ public void index(){ IndexWriter writer = null; try { //1、创建Derictory // Directory directory = new RAMDirectory();//这个方法是建立在内存中的索引 Directory directory = FSDirectory

Lucene的学习

拟墨画扇 提交于 2019-12-26 20:18:32
一,什么是全文检索 1.数据的分类   1.结构化数据     格式固定,长度固定,数据类型固定。     例如:数据库中的数据;   2.非结构化数据     word文档,pdf文档,邮件,html,txt     格式不固定,长度不固定,数据类型也不固定 2.数据的查询   1,结构化数据的查询     Sql语句,查询结构化数据的方法。简单,速度快。   2.非结构化数据的查询     例如:从文本文件中找出包含spring的单词的文件     1.目测     2.使用程序代码来实现,把文件读取到内存中,匹配字符串,顺序扫描。     3.把结构化数据变成结构化数据       (先根据空格进行字符串拆分,得到一个单词列表,基于单词列表创建一个索引 )          索引:一个为了提高查询速度,创建某种数据结构的集合        然后 查询索引,根据单词和文档对应关系找到文档列表,这个过程就叫全文检索 3.全文检索   先创建索引,然后查询索引的过程,就叫做全文检索。(创建索引时间较长,但是一次创建可以多次使用,平均每次查询的速度就提高了速度) 二,全文搜索的应用场景 1,搜索引擎     百度,360搜索,谷歌,搜狗 2,站内搜索     论坛搜索,微博搜索,文章搜索 3,电商搜索     淘宝搜索,京东搜索 4,只要是有搜索的地方,就可以使用到全文检索技术 三

Elasticsearch初步使用(安装、Head配置、分词器配置)

喜欢而已 提交于 2019-12-26 18:57:08
目录   返回目录: http://www.cnblogs.com/hanyinglong/p/5464604.html 1.ElasticSearch简单说明   a.ElasticSearch是一个基于Lucene开发的搜索服务器,具有分布式多用户的能力,ElasticSearch是用Java开发的开源项目(Apache许可条款),基于Restful Web接口,能够达到实时搜索、稳定、可靠、快速、高性能、安装使用方便,同时它的横向扩展能力非常强,不需要重启服务。   b.ElasticSearch是一个非常好用的实时分布式搜索和分析引擎,可以帮助我们快速的处理大规模数据,也可以用于全文检索,结构化搜索以及分析等。   c.目前很多网站都在使用ElasticSearch进行全文检索,例如:GitHub、StackOverflow、Wiki等。   d.ElasticSearch式建立在全文检索引擎Lucene基础上的,而Lucene是最先进、高效的开元搜索引擎框架,但是Lucene只是一个框架,要充分利用它的功能,我们需要很高的学习成本,而ElasticSearch使用Lucene作为内部引擎,在其基础上封装了功能强大的Restful API,让开发人员可以在不需要了解背后复杂的逻辑,即可实现比较高效的搜索。   e.关于Lucene我在前面写过几篇博客

why some imports cannot be resolved?

僤鯓⒐⒋嵵緔 提交于 2019-12-26 07:19:47
问题 I'm new to java , i tried to use word net for senitment analysis . when i used class of wordnet , i got the following failure in importing import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Deactivate; import org.apache.felix.scr.annotations.Reference; import org.apache.lucene.analysis.en.EnglishMinimalStemmer; import org.apache.stanbol.commons.stanboltools.datafileprovider.DataFileListener; import org

why some imports cannot be resolved?

ぃ、小莉子 提交于 2019-12-26 07:19:09
问题 I'm new to java , i tried to use word net for senitment analysis . when i used class of wordnet , i got the following failure in importing import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Deactivate; import org.apache.felix.scr.annotations.Reference; import org.apache.lucene.analysis.en.EnglishMinimalStemmer; import org.apache.stanbol.commons.stanboltools.datafileprovider.DataFileListener; import org

Solr vs Lucene

倾然丶 夕夏残阳落幕 提交于 2019-12-25 22:28:51
Solr vs Lucene Solr与Lucene 并不是竞争对立关系,恰恰相反Solr 依存于Lucene,因为Solr底层的核心技术是使用Lucene 来实现的,Solr和Lucene的本质区别有以下三点:搜索服务器,企业级和管理。Lucene本质上是搜索库,不是独立的应用程序,而Solr是。Lucene专注于搜索底层的建设,而Solr专注于企业应用。Lucene不负责支撑搜索服务所必须的管理,而Solr负责。所以说,一句话概括 Solr: Solr是Lucene面向企业搜索应用的扩展。 Solr与Lucene架构图: Solr使用Lucene并且扩展了它! 一个真正的拥有 动态字段 (Dynamic Field) 和 唯一键 ( Unique Key) 的数据模式 (Data Schema) 对 Lucene 查询语言的强大扩展 ! 支持对结果进行动态的分组和过滤 高级的,可配置的文本分析 高度可配置和可扩展的缓存机制 性能优化 支持通过 XML 进行外部配置 拥有一个管理界面 可监控的日志 支持 高速增量式更新 (Fast incremental Updates) 和快照发布 (Snapshot Distribution) 更多精彩内容请关注:http://bbs.superwu.cn 关注超人学院微信二维码: 来源: https://www.cnblogs.com

2019年常见ElasticSearch 面试题解析(上)

核能气质少年 提交于 2019-12-25 20:43:25
前言 ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java语言开发的,并作为Apache许可条款下的开放源码发布,是一种流行的企业级搜索引擎。ElasticSearch用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。官方客户端在Java、.NET(C#)、PHP、Python、Apache Groovy、Ruby和许多其他语言中都是可用的。根据DB-Engines的排名显示,Elasticsearch是最受欢迎的企业搜索引擎,其次是Apache Solr,也是基于Lucene。 Elasticsearch 面试题 1、elasticsearch 了解多少,说说你们公司 es 的集群架构,索引数据大小,分片有多少,以及一些调优手段 。 2、elasticsearch 的倒排索引是什么 3、elasticsearch 索引数据多了怎么办,如何调优,部署 4、elasticsearch 是如何实现 master 选举的 5、详细描述一下 Elasticsearch 索引文档的过程 6、详细描述一下 Elasticsearch 搜索的过程? 7、Elasticsearch 在部署时,对 Linux 的设置有哪些优化方法 8、lucence