一、安装准备及各软件使用版本说明:

1.下载jdk,我下载的版本是jdk-8u121-windows-x64.exe,下载地址:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

2.下载tomcat,我下载的版本为apache-tomcat-9.0.0.M19.exe,下载地址:

http://tomcat.apache.org/download-90.cgi?Preferred=http%3A%2F%2Fmirror.bit.edu.cn%2Fapache%2F

3.下载solr6.5,下载地址:

http://mirrors.tuna.tsinghua.edu.cn/apache/lucene/solr/6.5.0/

二、Solr安装与配置:

1)解压下载的solr ,在tomcat\webapps\目录下新建solr文件夹;

2)将 solr 压缩包中 solr\server\solr-webapp\webapp文件夹下文件复制到Tomcat\webapps\solr目录下 ;

3)将 solr 压缩包中 solr\server\lib\ext 中的 jar 全部复制到 Tomcat\webapps\solr\WEB-INF\lib 目录中;

4)将solr压缩包中solr/server/lib/metrics* 开头的jar全部复制到 Tomcat\ webapps\solr\WEB-INF\lib 目录中;

5)将solr压缩包中solr/dist/solr-dataimporthandler-* 开头的jar全部复制到 Tomcat\ webapps\solr\WEB-INF\lib 目录中;

6)在Tomcat\webapps\solr\WEB-INF\下建立classes目录,并将solr/server/resources/log4j.properties文件复制其中;

7)在D盘根目录下建立solrhome文件夹(也可以放在其它目录中)

8)复制solr/server/solr/* 所有文件到D:/solrhome目录,用到创建solr的core时使用。

3、配置Solr:

 (1)修改\Tomcat 9.0\webapps\solr\WEB-INF的web.xml文件,去掉下面这段代码的注释 

<env-entry>

       <env-entry-name>solr/home</env-entry-name>
<env-entry-value>D:/solrhome</env-entry-value> //将路径指向我们创建的solrhome目录。
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>


(2)修改\Tomcat 9.0\webapps\solr\WEB-INF的web.xml文件,注释下面这段代码(权限相关的配置)
<!--
<security-constraint>
<web-resource-collection>
<web-resource-name>Disable TRACE</web-resource-name>
<url-pattern>/</url-pattern>
<http-method>TRACE</http-method>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Enable everything but TRACE</web-resource-name>
<url-pattern>/</url-pattern>
<http-method-omission>TRACE</http-method-omission>
</web-resource-collection>
</security-constraint>
-->

(3)完整的配置如下
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
metadata-complete="true"
> <!-- Uncomment if you are trying to use a Resin version before 3.0.19.
Their XML implementation isn't entirely compatible with Xerces.
Below are the implementations to use with Sun's JVM.
<system-property javax.xml.xpath.XPathFactory=
"com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl"/>
<system-property javax.xml.parsers.DocumentBuilderFactory=
"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
<system-property javax.xml.parsers.SAXParserFactory=
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"/>
--> <!-- People who want to hardcode their "Solr Home" directly into the
WAR File can set the JNDI property here...
-->
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>D:/solrhome</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry> <!-- Any path (name) registered in solrconfig.xml will be sent to that filter -->
<filter>
<filter-name>SolrRequestFilter</filter-name>
<filter-class>org.apache.solr.servlet.SolrDispatchFilter</filter-class>
<!--
Exclude patterns is a list of directories that would be short circuited by the
SolrDispatchFilter. It includes all Admin UI related static content.
NOTE: It is NOT a pattern but only matches the start of the HTTP ServletPath.
-->
<init-param>
<param-name>excludePatterns</param-name>
<param-value>/libs/.+,/css/.+,/js/.+,/img/.+,/tpl/.+</param-value>
</init-param>
</filter> <filter-mapping>
<!--
NOTE: When using multicore, /admin JSP URLs with a core specified
such as /solr/coreName/admin/stats.jsp get forwarded by a
RequestDispatcher to /solr/admin/stats.jsp with the specified core
put into request scope keyed as "org.apache.solr.SolrCore". It is unnecessary, and potentially problematic, to have the SolrDispatchFilter
configured to also filter on forwards. Do not configure
this dispatcher as <dispatcher>FORWARD</dispatcher>.
-->
<filter-name>SolrRequestFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <servlet>
<servlet-name>LoadAdminUI</servlet-name>
<servlet-class>org.apache.solr.servlet.LoadAdminUiServlet</servlet-class>
</servlet> <!-- Remove in Solr 5.0 -->
<!-- This sends SC_MOVED_PERMANENTLY (301) for resources that changed in 4.0 -->
<servlet>
<servlet-name>RedirectOldAdminUI</servlet-name>
<servlet-class>org.apache.solr.servlet.RedirectServlet</servlet-class>
<init-param>
<param-name>destination</param-name>
<param-value>${context}/#/</param-value>
</init-param>
</servlet> <servlet>
<servlet-name>RedirectOldZookeeper</servlet-name>
<servlet-class>org.apache.solr.servlet.RedirectServlet</servlet-class>
<init-param>
<param-name>destination</param-name>
<param-value>${context}/admin/zookeeper</param-value>
</init-param>
</servlet> <servlet>
<servlet-name>RedirectLogging</servlet-name>
<servlet-class>org.apache.solr.servlet.RedirectServlet</servlet-class>
<init-param>
<param-name>destination</param-name>
<param-value>${context}/#/~logging</param-value>
</init-param>
</servlet> <servlet>
<servlet-name>SolrRestApi</servlet-name>
<servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
<init-param>
<param-name>org.restlet.application</param-name>
<param-value>org.apache.solr.rest.SolrSchemaRestApi</param-value>
</init-param>
</servlet> <servlet-mapping>
<servlet-name>RedirectOldAdminUI</servlet-name>
<url-pattern>/admin/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RedirectOldAdminUI</servlet-name>
<url-pattern>/admin</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RedirectOldZookeeper</servlet-name>
<url-pattern>/zookeeper.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RedirectOldZookeeper</servlet-name>
<url-pattern>/zookeeper</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RedirectLogging</servlet-name>
<url-pattern>/logging</url-pattern>
</servlet-mapping> <servlet-mapping>
<servlet-name>LoadAdminUI</servlet-name>
<url-pattern>/old.html</url-pattern>
</servlet-mapping> <servlet-mapping>
<servlet-name>LoadAdminUI</servlet-name>
<url-pattern>/index.html</url-pattern>
</servlet-mapping> <servlet-mapping>
<servlet-name>SolrRestApi</servlet-name>
<url-pattern>/schema/*</url-pattern>
</servlet-mapping> <mime-mapping>
<extension>.xsl</extension>
<!-- per http://www.w3.org/TR/2006/PR-xslt20-20061121/ -->
<mime-type>application/xslt+xml</mime-type>
</mime-mapping> <welcome-file-list>
<welcome-file>/index.html</welcome-file>
</welcome-file-list> <!-- Get rid of error message -->
<!--
<security-constraint>
<web-resource-collection>
<web-resource-name>Disable TRACE</web-resource-name>
<url-pattern>/</url-pattern>
<http-method>TRACE</http-method>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Enable everything but TRACE</web-resource-name>
<url-pattern>/</url-pattern>
<http-method-omission>TRACE</http-method-omission>
</web-resource-collection>
</security-constraint>
--> </web-app>

在浏览器上运行 http://localhost:8080/solr/index.html#/

 

三、索引以及IK分词配置

1.创建索引区,在D:/solrhome文件夹下建一个名为core1的文件夹,将solr\server\solr\configsets\sample_techproducts_configs下的conf全部复制到core1,注意修改core.properties这个文件里的name一定要跟core1一致,如下图

2.打开浏览器http://localhost:8080/solr/index.html#/

点击Add Core,如图


 

3.下载IKAnalyzer,将jar文件复制到Tomcat\ webapps\solr\WEB-INF\lib中,同时将IKAnalyzer.cfg.xml、stopword.dic文件复制到D:/solrhome/core1/conf文件夹下

4. 在 solr_home\mycore1\conf\schema.xml 增加如下配置

<fieldType name="text_ik" class="solr.TextField">
<analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>
</fieldType>

最后就可以使用text_ik了

window下配置Solr6.5以及IK Analyzer分词配置的更多相关文章

  1. Elasticsearch 5 Ik+pinyin分词配置详解

    版权声明:本文为博主原创文章,地址:http://blog.csdn.net/napoay,转载请留言. 一.拼音分词的应用 拼音分词在日常生活中其实很常见,也许你每天都在用.打开淘宝看一看吧,输入拼 ...

  2. (转)Elasticsearch 5 Ik+pinyin分词配置详解

    今天以这篇文章结束同城旅游网的面试,正好面试官也问到站内检索,可以尝试一下这篇文章介绍的方法.Elasticsearch 5 Ik+pinyin分词配置详解

  3. Win7下Solr4.10.1和IK Analyzer中文分词

    1.下载IK中文分词压缩包IK Analyzer 2012FF_hf1,并解压到D:\IK Analyzer 2012FF_hf1: 2.将D:\IK Analyzer 2012FF_hf1\IKAn ...

  4. Solr5.5.1 IK中文分词配置与使用

    前言 用过Lucene.net的都知道,我们自己搭建索引服务器时和解决搜索匹配度的问题都用到过盘古分词.其中包含一个词典. 那么既然用到了这种国际化的框架,那么就避免不了中文分词.尤其是国内特殊行业比 ...

  5. window下eclipse4.5+hadoop2.6.1开发环境配置

    1.准备: eclipse4.5,hadoop2.6.1,hadoop-eclipse-plugin-2.6.0.jar. 2.eclipse配置 eclipse->windows->Pr ...

  6. Window下JDK、Tomcat、eclipse安装与配置

    今天项目组开会,由于.Net平台的限制无法满足现有业务需求,项目计划从.Net平台转Java平台,采用Java+Spark+Hadoop,之前关于Java和Hadoop的书也买的有只是平时看的少,最近 ...

  7. 转:solr6.0配置中文分词器IK Analyzer

    solr6.0中进行中文分词器IK Analyzer的配置和solr低版本中最大不同点在于IK Analyzer中jar包的引用.一般的IK分词jar包都是不能用的,因为IK分词中传统的jar不支持s ...

  8. 我与solr(六)--solr6.0配置中文分词器IK Analyzer

    转自:http://blog.csdn.net/linzhiqiang0316/article/details/51554217,表示感谢. 由于前面没有设置分词器,以至于查询的结果出入比较大,并且无 ...

  9. Solr学习总结(八)IK 中文分词的配置和使用

    最近,很多朋友问我solr 中文分词配置的问题,都不知道怎么配置,怎么使用,原以为很简单,没想到这么多朋友都有问题,所以今天就总结总结中文分词的配置吧. 有的时候,用户搜索的关键字,可能是一句话,不是 ...

随机推荐

  1. shell awk使用(转)

    #####awk  " 对每一行操作的代码块"  操作的文件  awk -F:   '{print $1,$2,$3,$4,$5}' helloworld.sh      打印字段 ...

  2. File工具类

    package cn.itcast.bos.utils; import java.io.IOException; import java.net.URLEncoder; import sun.misc ...

  3. spring boot配置德鲁伊

    1.引入相关依赖,全部依赖是上一篇spring boot+mybatis依赖的基础上,再加上下边的依赖,如下: <!-- Druid数据库连接池组件 --> <dependency& ...

  4. Lucene快速入门

    1. 什么是lucene lucene是Apache的一个全文检索工具,使用lucene能快速实现全文检索功能.Lucene是一个工具包,你可以调用它的函数, 但它不能独立运行,不单独对外提供服务. ...

  5. UI-了解ISO

    1. iOS学习路线: C语言:数据类型.流程控制.函数.指针.字符串.结构体.枚举.预处理: OC:面向对象.内存管理.分类.协议.Block.KVC/KVO.Foundation框架: iOS基础 ...

  6. Zookeeper集群是如何升级到新版本的

    方案1:复用老数据方案 这是经过实践的升级方案,该方案是复用旧版本的数据,zk集群拓扑,配置文件都不变,只是启动的程序为最新的版本. 参考文章: Zookeeper集群是如何升级到新版本的 方案2:重 ...

  7. php服务端setcookie()原理

    1.什么是 Cookie? cookie 常用于识别用户.cookie 是服务器留在用户计算机中的小文件.每当相同的计算机通过浏览器请求页面时,它同时会发送 cookie.通过 PHP,您能够创建并取 ...

  8. ESLint在vue中的使用

    ESLint的用途 1.审查代码是否符合编码规范和统一的代码风格: 2.审查代码是否存在语法错误:  中文网地址 http://eslint.cn/ 使用VSCode编译器在Vue项目中的使用 在初始 ...

  9. SQLServer清空数据库中所有表的数据

    今早同事跟进客户反馈的问题时,提了个要求,要求清空数据库中所有表的数据. 记得之前用游标遍历所有的表名 + exec 动态语句 truncate table 表名 实现过这个功能. 网上搜了下,有更简 ...

  10. 【英语】Bingo口语笔记(81) - wear系列