solr

window下部署Solr

痞子三分冷 提交于 2020-01-27 05:37:46
主要步骤如下: 1、下载solr-4.7.2.zip;下载地址: http://archive.apache.org/dist/lucene/java/ 2、解压缩solr-4.7.2.zip,解压后目录结构如下: 3、将example/webapps目录下的solr.war复制到tomcat的webapps目录中; 4、启动tomcat服务器,这时候会报错,暂时不用管,只是为了解压war包,启动完成后关闭Tomcat; 5、新建一个solr文件夹(名称与位置随意),我建在~下。 6、继续到solr-4.7.2目录,将example/solr目录下的所有文件和目录拷贝到新建的~/solr目录下: ( 注意solr.xml文件只需要一份即可,这个在配置多份索引时 无须多拷贝) 7、将example/lib/ext/下的所有jar包复制到tomcat/webapps/solr/WEB-INF的lib目录中,一共5个,是solr的独立日志处理模块; 8、在tomcat/webapps/solr/WEB-INF/下新建一个classes目录,将example/resources下的 log4j.properties 文件复制到该classes目录中,否则日志模块无法正常工作; 9、找到web.xml文件中用于配置环境变量的标签,去掉注释,并修改环境变量为 或者 在tomcat的conf

Solr4.8.0源码分析(7)之Solr SPI

a 夏天 提交于 2020-01-26 13:35:07
Solr4.8.0源码分析(7)之Solr SPI 查看Solr源码时候会发现,每一个package都会由对应的resources. 如下图所示: 一时对这玩意好奇了,看了文档以后才发现,这个services就是java SPI机制。首先介绍下java SPI机制,然后再结合Solr谈一下SPI。 1. JAVA SPI 当服务的提供者,提供了服务接口的一种实现之后,在jar包的META-INF/services/目录里同时创建一个以服务接口命名的文件。该文件里就是实现该服务接口的具体实现类。而当外部程序装配这个模块的时候,就能通过该jar包META-INF/services/里的配置文件找到具体的实现类名,并装载实例化,完成模块的注入。 基于这样一个约定就能很好的找到服务接口的实现类,而不需要再代码里制定。 jdk提供服务实现查找的一个工具类:java.util.ServiceLoader 假设有一个内容搜索系统,分为展示和搜索两个模块。展示和搜索基于接口编程。搜索的实现可能是基于文件系统的搜索,也可能是基于数据库的搜索。实例代码如下: Search.java: 搜索接口 1 package search; 2 3 import java.util.List; 4 5 import definition.Doc; 6 7 public interface Search { 8

在Windows的Tomcat环境下部署Solr 4.7.0

时光毁灭记忆、已成空白 提交于 2020-01-26 11:08:18
主要步骤如下: 1、下载solr-4.7.0.tgz; 2、解压缩solr-4.7.0.tgz,解压后目录结构如下: 3、将example/webapps目录下的solr.war复制到tomcat的webapps目录中; 4、启动tomcat服务器,这时候会报错,暂时不用管,只是为了解压war包,启动完成后关闭Tomcat; 5、新建一个tomcat-solr文件夹(名称与位置随意),我建在了D盘下。 6、继续到solr-4.7.0目录,将example/solr目录下的所有文件和目录拷贝到新建的solr-tomcat目录下: ( 注意solr.xml文件只需要一份即可,这个在配置多份索引时 无须多拷贝) 7、将example/lib/ext/下的所有jar包复制到tomcat/webapps/solr/WEB-INF的lib目录中,一共5个,是solr的独立日志处理模块; 8、在tomcat/webapps/solr/WEB-INF/下新建一个classes目录,将example/resources下的 log4j.properties 文件复制到该classes目录中,否则日志模块无法正常工作; 9、找到web.xml文件中用于配置环境变量的标签,去掉注释,并修改环境变量为 1 <env-entry> 2 <env-entry-name>solr/home</env-entry

Solr: Does the PatternReplaceFilterFactory able to replace the field value for copyField and then index it?

此生再无相见时 提交于 2020-01-26 01:47:57
问题 I have indexed the data from solr.xml and monitor.xml that came with the solr package, and I added the below configuration in the schema.xml file <field name="my_field" type="my_field_type" indexed="true" stored="true" required="false"/> <copyField source="name" dest="my_field" /> <fieldType name="my_field_type" class="solr.TextField"> <analyzer type="index"> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.PatternReplaceFilterFactory" pattern=".*" replacement=

Solr和ES对比

我是研究僧i 提交于 2020-01-25 23:16:48
搜索引擎选择: Elasticsearch与Solr 搜索引擎选型调研文档 Elasticsearch简介 * Elasticsearch是一个 实时 的 分布式 搜索和分析引擎。它可以帮助你用前所未有的速度去处理大规模数据。 它可以用于 全文搜索 , 结构化搜索 以及 分析 ,当然你也可以将这三者进行组合。 Elasticsearch是一个 建立在全文搜索引擎 Apache Lucene™ 基础上 的搜索引擎,可以说Lucene是当今最先进,最高效的全功能开源搜索引擎框架。 但是Lucene只是一个框架,要充分利用它的功能,需要使用JAVA,并且在程序中集成Lucene。需要很多的学习了解,才能明白它是如何运行的,Lucene确实非常复杂。 Elasticsearch使用Lucene作为内部引擎,但是在使用它做全文搜索时,只需要使用统一开发好的API即可,而不需要了解其背后复杂的Lucene的运行原理。 当然Elasticsearch并不仅仅是Lucene这么简单,它不但包括了全文搜索功能,还可以进行以下工作: 分布式实时文件存储,并将每一个字段都编入索引,使其可以被搜索。 实时分析的分布式搜索引擎。 可以扩展到上百台服务器,处理PB级别的结构化或非结构化数据。 这么多的功能被集成到一台服务器上,你可以轻松地通过客户端或者任何你喜欢的程序语言与ES的RESTful API进行交流

React Rerender dynamic Components (Solr)

梦想的初衷 提交于 2020-01-25 21:38:47
问题 I am somewhat new to ReactJS I have a react class that is rendering a number of items: (Sample) var app = app || {}; app.Results = React.createClass({ componentDidMount: function () { }, handleUpdateEvent: function(id){ var _self = this; var handler = function() { var query = _self.props.results.query; _self.props.onSearch(query); // re-does the search to re-render items ... // obviously this is wrong since I have to click the button twice to see the results // } var optionsURL = {dataType:

creating shard in SOLR

一个人想着一个人 提交于 2020-01-25 21:37:27
问题 I am new to Apache Solr. I have created a new Collection, named testCollection. This collection has been created through solr admin console and its router type is implicit. I am using the below code to create a new shard to the above collection SolrServer solr = new HttpSolrServer("http://localhost:8983/solr/testCollection"); UpdateRequest request = new UpdateRequest(); request.setPath("http://localhost:8983/solr/testCollection"); request.setMethod(METHOD.GET); request.setParam("action",

How does one protect a webapp to be accessed only by localhost?

混江龙づ霸主 提交于 2020-01-25 21:09:08
问题 I am planning to run a java web application and solr in the same java container. I want the web application to be publicly accessible but solr to be accessible only to the other web applications in the same container. Solr should be accessible only as localhost and not from outside. Can we write some rules in the web-xml to achieve this? 回答1: This is actually a question for serverfault. Anyway, you can deal with this the same way you deal with any internal server, like a database server: don

Custom Solr analyzers not being used during indexing

本小妞迷上赌 提交于 2020-01-25 20:50:12
问题 I have a bunch of PDF files on my machine which I want to index in Solr. For this purpose, I have created a schema file with custom field types and user-defined fields. Given below are the fields and copyFields in my schema.xml : <field name="id" type="custom01" indexed="true" stored="true" required="true" multiValued="false" /> <field name="_version_" type="long" indexed="true" stored="false"/> <field name="_root_" type="string" indexed="true" stored="false" docValues="false" /> <field name=

Update SOLR document without adding deleted documents

别说谁变了你拦得住时间么 提交于 2020-01-25 12:13:26
问题 I'm running a lot of SOLR document updates which results in 100s of thousands of deleted documents and a significant increase in disk usage (100s of Gb). I'm able to remove all deleted document by doing an optimize curl http://localhost:8983/solr/core_name/update?optimize=true But this takes hours to run and requires a lot of RAM and disk space. Is there a better way to remove deleted documents from the SOLR index or to update a document without creating a deleted one? Thanks for your help!