apache solr简单搭建
首先,下载位置是:http://lucene.apache.org/solr/downloads.html
官网的学习资料:http://lucene.apache.org/solr/quickstart.html
点击download就好,各种版本基本都有三个文件,src的是源码,tgz的是linux下的,zip的是windows下的。
先说下源码的导入吧。
源码实际上是用ant导入的,我用的开发软件是eclipse,配置好ant后,在根目录执行ant eclipse就好了,坐等结束。
然后说一下基本部署,在这里强调一下,我操作的是5.5的版本。
实际上就是解压缩就好了,由于solr是采用jetty框架,因此,启动起来比较方便,到bin目录下执行
执行solr start -p 8983命令。就是在8983端口上执行开启项目。
好,已经可以在浏览器上访问了。http://localhost:8983/solr。
然后就是创建数据源,Core Admin选项的add core。
这里说明一下,要创建数据源,是需要3个配置文件的
solrconfig.xml,schema.xml和elevate.xml
这里面的schema.xml需要自己手动编写,网上貌似教程是不少的,下面贴出我配置的xml,没有复杂的东西,是给新手看的。
说下我的数据源名字是test。
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="test" version="1.5"> <field name="_version_" type="long" indexed="true" stored="true"/>
<field name="_root_" type="string" indexed="true" stored="false"/>
<field name="id" type="int" indexed="true" stored="true" required="true" multiValued="false" />
<field name="price" type="int" indexed="true" stored="true"/>
<field name="saleNum" type="int" indexed="true" stored="true" />
<field name="favNum" type="int" indexed="true" stored="true" />
<field name="color" type="string" indexed="true" stored="true"/>
<field name="size" type="int" indexed="true" stored="true"/>
<field name="itemNum" type="int" indexed="true" stored="true"/>
<field name="created_at" type="long" indexed="true" stored="true"/>
<field name="dsr" type="float" indexed="true" stored="true"/>
<field name="tag" type="string" indexed="true" stored="true"/> <uniqueKey>id</uniqueKey> <fieldType name="string" class="solr.StrField" sortMissingLast="true" />
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>
<fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/>
<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/>
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/>
<fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" positionIncrementGap="0"/>
<fieldtype name="binary" class="solr.BinaryField"/> </schema>
这段配置源自千里码的一道题目,有兴趣的童鞋可以看一下,题目附带数据。传送门奉上http://www.qlcoder.com/task/7647
然后就是数据导入了
这个比较简单,bin目录下执行一个命令:post -c test books.csv。
然后就可以愉快的查询了~
apache solr简单搭建的更多相关文章
- solr 简单搭建 数据库数据同步(待续)
原来在别的公司负责过文档检索模块的维护(意思就是不是俺开发的啦). 所以就略微接触和研究了下文档检索. 文档检索事实上是全文检索.是通过一种技术把N多文档进行一定规律的分割归类,然后创建易于搜索的索引 ...
- 1.3.8、CDH 搭建Hadoop在安装之前(端口---Apache Flume和Apache Solr使用的端口)
Apache Flume和Apache Solr使用的端口 Apache Flume用于与Apache Solr通信的端口可能会有所不同,具体取决于您的配置以及是否使用安全性(例如,SSL).使用Fl ...
- Solr搜索引擎搭建详细过程
1 什么是solr Solr 是Apache下的一个顶级开源项目,采用Java开发,它是基于Lucene的全文搜索服务器.Solr可以独立运行在Jetty.Tomcat等这些Servlet容器中 ...
- Apache Solr 初级教程(介绍、安装部署、Java接口、中文分词)
Python爬虫视频教程零基础小白到scrapy爬虫高手-轻松入门 https://item.taobao.com/item.htm?spm=a1z38n.10677092.0.0.482434a6E ...
- Apache Solr 介绍
Apache Solr 介绍 Solr 是什么? Solr 是一个开源的企业级搜索服务器,底层使用易于扩展和修改的Java 来实现.服务器通信使用标准的HTTP 和XML,所以如果使用Solr 了解J ...
- CVE-2019-0193 Apache solr velocity模块漏洞
Solr简单介绍 Solr是建立在Apache Lucene ™之上的一个流行.快速.开放源代码的企业搜索平台. Solr具有高度的可靠性,可伸缩性和容错能力,可提供分布式索引,复制和负载平衡查询,自 ...
- Apache Solr应用服务器存在远程代码执行漏洞👻
Apache Solr应用服务器存在远程代码执行漏洞 1.描述 Apache Solr是一个开源的搜索服务,使用Java语言开发,主要基于HTTP和Apache Lucene实现的. Solr是一个高 ...
- python简单搭建HTTP Web服务器
对于Python 2,简单搭建Web服务器,只需在i需要搭建Web服务器的目录(如C:/ 或 /home/klchang/)下,输入如下命令: python -m SimpleHTTPServer 8 ...
- springmvc4环境简单搭建和定时任务
之前复制粘贴创建了几个ssm的项目,然而回头让自己写的时候还是一头雾水,究其原因是spring的陌生.仅仅是写过几个helloworld而已.而且是照着写.我都不知道springmvc到底需要多少ja ...
随机推荐
- linux模块安装卸载命令
lsmod 查看系统安装了那些模块 insmod 安装模块 rmmod 卸载模块 modprobe可安装模块,也可卸载模块 modprobe [-acdlrtvV][--help][模块文件][符 ...
- Understanding Item Import and Debugging Problems with Item Import (Doc ID 268968.1)
In this Document Purpose Details Scenario 1: Testing the basic item import with minimum columns po ...
- Subline Text快捷键
我经常使用的快捷键 Ctrl+A: 全选Ctrl+C: 复制 重复工作必备: Ctrl+D:选择单词,重复可增加选择下一个相同的单词Alt+F3:选择所有相同的词F3: 下一个Shift+F3:前一个 ...
- Hibernate一级缓存、二级缓存
缓存就是把以前从数据库中查询出来和使用过的对象保存在内存中,准确说就是一个数据结构中,这个数据结构通常是或类似HashMap,当以后要使用某个对象时,先查询缓存中是否有这个对象,如果有则使用缓存中的对 ...
- Linux 性能监测工具总结
前言: Linux系统出现问题时,我们不仅需要查看系统日志信息,而且还要使用大量的性能监测工具来判断究竟是哪一部分(内存.CPU.硬盘……)出了问题.在Linux系统中,所有的运行参数保存在虚拟目录/ ...
- CodeForces_#354_Div.2_2016.5.25(A+B+C)
A 描述:给出一串数,可以互换任意两个数的位置一次,求最大的数和最小的数的最大距离. 分析:找到最大的数和最小的数的位置,求右边的数到左端点的距离和左边的数到右端点的距离. #include < ...
- [Bhatia.Matrix Analysis.Solutions to Exercises and Problems]ExI.2.1
For fixed basis of in $\scrH$ and $\scrK$, the matrix $A^*$ is the conjugate transpose of the matrix ...
- Set up your first C# test with NUnit or resharper
此链接为一种方式,用Nunit单元测试驱动测试代码 http://relevantcodes.com/using-nunit-to-execute-selenium-webdriver-tests/ ...
- GTK+中的树状列表构件(GtkTreeView)
GTK+中的树状列表构件(GtkTreeView) GTK+中的树状列表构件(GtkTreeView) 在本章的GTK+程序设计教程中,我们将向大家重点介绍非常常用也有点复杂的构件--GtkTreeV ...
- 【转】由DFT推导出DCT
原文地址:http://blog.sina.com.cn/s/blog_626631420100xvxd.htm 已知离散傅里叶变换(DFT)为: 由于许多要处理的信号都是实信号,在使用DFT时由于傅 ...