首先,下载位置是: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简单搭建的更多相关文章

  1. solr 简单搭建 数据库数据同步(待续)

    原来在别的公司负责过文档检索模块的维护(意思就是不是俺开发的啦). 所以就略微接触和研究了下文档检索. 文档检索事实上是全文检索.是通过一种技术把N多文档进行一定规律的分割归类,然后创建易于搜索的索引 ...

  2. 1.3.8、CDH 搭建Hadoop在安装之前(端口---Apache Flume和Apache Solr使用的端口)

    Apache Flume和Apache Solr使用的端口 Apache Flume用于与Apache Solr通信的端口可能会有所不同,具体取决于您的配置以及是否使用安全性(例如,SSL).使用Fl ...

  3. Solr搜索引擎搭建详细过程

    1    什么是solr Solr 是Apache下的一个顶级开源项目,采用Java开发,它是基于Lucene的全文搜索服务器.Solr可以独立运行在Jetty.Tomcat等这些Servlet容器中 ...

  4. Apache Solr 初级教程(介绍、安装部署、Java接口、中文分词)

    Python爬虫视频教程零基础小白到scrapy爬虫高手-轻松入门 https://item.taobao.com/item.htm?spm=a1z38n.10677092.0.0.482434a6E ...

  5. Apache Solr 介绍

    Apache Solr 介绍 Solr 是什么? Solr 是一个开源的企业级搜索服务器,底层使用易于扩展和修改的Java 来实现.服务器通信使用标准的HTTP 和XML,所以如果使用Solr 了解J ...

  6. CVE-2019-0193 Apache solr velocity模块漏洞

    Solr简单介绍 Solr是建立在Apache Lucene ™之上的一个流行.快速.开放源代码的企业搜索平台. Solr具有高度的可靠性,可伸缩性和容错能力,可提供分布式索引,复制和负载平衡查询,自 ...

  7. Apache Solr应用服务器存在远程代码执行漏洞👻

    Apache Solr应用服务器存在远程代码执行漏洞 1.描述 Apache Solr是一个开源的搜索服务,使用Java语言开发,主要基于HTTP和Apache Lucene实现的. Solr是一个高 ...

  8. python简单搭建HTTP Web服务器

    对于Python 2,简单搭建Web服务器,只需在i需要搭建Web服务器的目录(如C:/ 或 /home/klchang/)下,输入如下命令: python -m SimpleHTTPServer 8 ...

  9. springmvc4环境简单搭建和定时任务

    之前复制粘贴创建了几个ssm的项目,然而回头让自己写的时候还是一头雾水,究其原因是spring的陌生.仅仅是写过几个helloworld而已.而且是照着写.我都不知道springmvc到底需要多少ja ...

随机推荐

  1. 【HDOJ】1297 Children’s Queue

    递推,最近发现自己做递推的题总是没有思路.下周多练习.对于f(n)可以在第n个位置为男生,此时共有f(n-1)种情况:若在第n个位置为女生,因此第n-1个位置也必须为女生.此时有两种情况,一种情况是在 ...

  2. poj2187

    求最远点对,这是一道经典的旋转卡壳的题目话说由于是前年写的,之后就没怎么研究过计算几何了……感觉都不大记得清了,来稍微回忆一下……首先最远点对一定出现在凸包上显然,然后穷举肯定不行,这时候就需要旋转卡 ...

  3. apache开源项目--lucence

    Lucene 是apache软件基金会一个开放源代码的全文检索引擎工具包,是一个全文检索引擎的架构,提供了完整的查询引擎和索引引擎,部分文本分析引擎.Lucene的目的是为软件开发人员提供一个简单易用 ...

  4. jquery插件cloud-zoom(放大镜)

    效果预览:http://www.helloweba.com/demo/cloud-zoom/ 源代码下载:http://pan.baidu.com/s/1eQnadXo Cloud Zoom是一个图像 ...

  5. druid简单教程

    java程序很大一部分要操作数据库,为了提高性能操作数据库的时候,有不得不使用数据库连接池.数据库连接池有很多选择,c3p.dhcp.proxool等,druid作为一名后起之秀,凭借其出色的性能,也 ...

  6. ActiveMQ, RabbitMQ和ZeroMQ 选型关注点

    选择MQ时,主要关注的特性,可能就以下几个: 通信模式(是否满足业务场景): ActiveMQ: queue(producer/consumer), topic(publisher/subsriber ...

  7. 【VLFeat】使用matlab版本计算HOG

    下载 vlfeat-0.9.18    http://www.vlfeat.org cd D:\program\vlfeat-0.9.18\toolbox

  8. 华为2015 简单 字典输入法 java

    题目摘自http://blog.csdn.net/dongyi91/article/details/38639915 写了2个小时,水平太菜了 入法的编码原理为:根据已有编码表,当输入拼音和数字后输出 ...

  9. leecode 归并排序 链表(java)

    写了好久,终于写成了.第一次zai leecode错题,题目质量很高,适合面试,与 1.归并排序是稳定的,在java中 Arrays.sort(a);中对于对象的排序就是归并排序.对于原子类型数据使用 ...

  10. hotplug\uevent机制(1)

    hotplug就是热拔插,在linux里面,这个功能是通过class_device_create这个函数来实现的,那么我们来分析下这个函数: class_device_create(cls, NULL ...