solr

Need searched text and a few lines around it in Solr search in java api

◇◆丶佛笑我妖孽 提交于 2020-02-16 10:42:37
问题 i'm using solr 7.7.2 and I wrote a Java program in Solr using solrj that searches for a word in a huge text file. I use following code to show the search results that represent the whole text. SolrQuery params = new SolrQuery(); params.setQuery("content:word for search"); How to display only one line of text where the word is in that line? All code is like this public static void main(String args[]) throws SolrServerException, IOException { String urlString = "http://localhost:8983/solr/test

Need searched text and a few lines around it in Solr search in java api

倾然丶 夕夏残阳落幕 提交于 2020-02-16 10:42:09
问题 i'm using solr 7.7.2 and I wrote a Java program in Solr using solrj that searches for a word in a huge text file. I use following code to show the search results that represent the whole text. SolrQuery params = new SolrQuery(); params.setQuery("content:word for search"); How to display only one line of text where the word is in that line? All code is like this public static void main(String args[]) throws SolrServerException, IOException { String urlString = "http://localhost:8983/solr/test

全文检索引擎及工具 Lucene Solr

[亡魂溺海] 提交于 2020-02-16 03:55:22
全文检索引擎及工具 lucence lucence是一个全文检索引擎。 lucence代码级别的使用步骤大致如下: 创建文档(org.apache.lucene.document.Document),并通过Document的add方法为其添加字段(lucence.document.Field) 创建lucence.index.IndexWriter,通过addDocument或addDocuments方法添加构建好的诸多Document 通过close方法关闭IndexWriter 创建索引搜索器lucence.search.IndexSearcher,需要传入索引仓库阅读器(lucenc.index.DirectoryReader)参数 通过search方法在搜索器上执行查询,参数是ucence.search.Query对象,通过查询解析器lucene.queryparser.classic.QueryParser的实例parse(String)方法来构建一个查询,QueryParser实例可以通过new标准解析器lucene.queryparser.flexible.standard.StandardQueryParser得到 中文文本索引构建及查询示例 (以下涉及的是6.4.2版本的lucene) 对中文文本构建索引时,不能使用 StandardAnalyzer

Lucene简单介绍

百般思念 提交于 2020-02-13 23:54:46
【2016.6.11】以前写的笔记,拿出来放到博客里面~ 相关软件: Solr, IK Analyzer, Luke, Nutch;Tomcat; 1.是什么: Lucene是apache软件基金会jakarta项目组的一个子项目,是一个开放源代码的全文检索引擎工具包; 为软件开发人员提供一个简单易用的工具包,以方便的在目标系统中实现全文检索的功能,或者是以此为基础建立起完整的全文 检索引擎; 2.主要应用: 对句子进行分词,从而实现自然语言分词后提取关键词并且进行拓展,再送入搜索引擎进行查询,提高精准度; 对数据库中的文档简历索引,实现快速的查找; 3.环境: 用java开发,很方便调用jar包; 4.具体类: org.apache.lucene.analysis;语言分析器,主要用于分词; 5.相关的开源类库: IK Analyzer 6.Lucene的开源企业搜索平台: Solr: Solr是用Java编写、运行在Servlet容器(如Apache Tomcat或Jetty)的一个独立的全文搜索服务器; Solr是高度可扩展的,并提供了分布式搜索和索引复制; 7.Nutch: 是一个开源的java实现的web 爬虫; 主要用于收集网页数据然后进行分析,建立索引等,底层使用Hadoop进行分布式计算与存储,索引使用Solr分布式索引框架; 依赖Hadoop的数据结构,适合批处理

Solr Multilingual Indexing with one field

回眸只為那壹抹淺笑 提交于 2020-02-08 09:46:40
问题 Our current production index size is 1.5 TB with 3 shards. Currently we have the following field type: <fieldType name="text_ngram" class="solr.TextField" positionIncrementGap="100"> <analyzer type="query"> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer> <analyzer type="index"> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.CustomNGramFilterFactory" minGramSize="3"

Solr Multilingual Indexing with one field

橙三吉。 提交于 2020-02-08 09:45:33
问题 Our current production index size is 1.5 TB with 3 shards. Currently we have the following field type: <fieldType name="text_ngram" class="solr.TextField" positionIncrementGap="100"> <analyzer type="query"> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer> <analyzer type="index"> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.CustomNGramFilterFactory" minGramSize="3"

Case insensitive Solr query for facets but preserve case for results

我与影子孤独终老i 提交于 2020-02-05 08:57:13
问题 I am using Solr to power faceting features for our e-commerce application. Its been implemented in standard way as described here https://wiki.apache.org/solr/SimpleFacetParameters#Tagging_and_excluding_Filters On application side, we have used facets returned by Solr to offer filtering experience on UI and the URLs are built using the facets as params. These parameters are then used to further pass on the faceting parameters for fq into Solr. This works great except that our URLs are case

SOLR exact match results not matching

安稳与你 提交于 2020-02-05 04:26:06
问题 Hi I have a text_exact fieldType (field is text_ex ) that has KeywordTokenizerFactory for matching against exact queries. For example, searching for sale gives results that contain the term sale , specifically. When I run the query like this text_ex:sale , the number of results were found to be 28, where as when I run the same query using a switch-query parser (defined in request handler), I get the number of results as 18, even though the parsed query is same as text_ex:sale in the switch

搜索引擎Solr从入门到实战

感情迁移 提交于 2020-02-03 19:27:21
1.Solr安装与配置 1.1Solr简介 大多数搜索引擎应用都必须具有某种搜索功能,问题是搜索功能往往是巨大的资源消耗并且它们由于沉重的数据库加载而拖垮你的应用的性能。 这就是为什么转移负载到一个外部的搜索服务器是一个不错的主意,Apache Solr是一个流行的开源搜索服务器,它通过使用类似REST的HTTP API,这就确保你能从几乎任何编程语言来使用solr。 Solr是一个开源搜索平台,用于构建搜索应用程序。 它建立在Lucene(全文搜索引擎)之上。 Solr是企业级的,快速的和高度可扩展的。 使用Solr构建的应用程序非常复杂,可提供高性能。 为了在CNET网络的公司网站上添加搜索功能,Yonik Seely于2004年创建了Solr。并在2006年1月,它成为Apache软件基金会下的一个开源项目。并于2016年发布最新版本Solr 6.0,支持并行SQL查询的执行。 Solr可以和Hadoop一起使用。由于Hadoop处理大量数据,Solr帮助我们从这么大的源中找到所需的信息。不仅限于搜索,Solr也可以用于存储目的。像其他NoSQL数据库一样,它是一种非关系数据存储和处理技术。 总之,Solr是一个可扩展的,可部署,搜索/存储引擎,优化搜索大量以文本为中心的数据。 1.2 Solr安装 1:下载 Tomcat,解压Tomcat压缩包即可。 2:解压 solr。

SolrCloud: Unable to Create Collection, Locking Issues

落爺英雄遲暮 提交于 2020-02-03 09:50:22
问题 I have been trying to implement a SolrCloud, and everything works fine until I try to create a collection with 6 shards. My setup is as follows: 5 virtual servers, all running Ubuntu 14.04, hosted by a single company across different data centers 3 servers running ZooKeeper 3.4.6 for the ensemble 2 servers, each running Solr 5.1.0 server (Jetty) The Solr instances each have a 2TB, ext4 secondary disk for the indexes, mounted at /solrData/Indexes. I set this value in solrconfig.xml via