Solr是基于Apache Lucene项目开发成的一款开源的企业版搜索平台,本人觉得对于一些中型的互联网信息网站,还是有可用之处,尤其是电子商务网站。下面是Solr的官网标榜的特点,具体有多少符合需要实践来考量,
一、特点
- 强大的全文搜索
- 搜索词高亮
- 侧面搜索
- 动态集群
- 数据库集成
- 富文档处理
- 地图搜索
- 高可扩展性,
- 分布式搜索
- 索引复制
Solr是全Java语言写的,可用作为一个单例运行在一个servlet容器里面例如tomcat.其实就是对Lucene做了一次包装,可以让用户利用Rest的方式(像HTTPXML和JSON)去发搜索请求。这样客户端就跟平台或者语言无关了,你可以用PHP或者.NET去发请求,也可以在windows或者linux系统里面去请求搜索。
二、易用性
- 完善的Web管理界面
- 服务器统计信息
- 可扩展的插件架构
三、使用
现在最新稳定版是 Apache Solr 3.6.1 ,下载地址是:http://lucene.apache.org/solr/downloads.html
安装要求:
- Java 1.5 or greater installed. (Note: starting with Solr 4, Java 1.6 will be required)
- A servlet container such as Tomcat, Jetty, or Resin
- A Solr distribution (Or a Nightly build if you want the latest)
- Although Solr strives to be agnostic of the Locale where the server is running, some code paths may inadvertently be depending on the System default Locale, or Charset. (In particular, there are known bugs in Sun’s JVM dealing with XSLTs in non English locales) It is recommended that when running Solr you set the following system properties: -Duser.language=en -Duser.country=US
- For full international charset support, please make sure you use a full Java JDK, as opposed to the default JRE which is pre-installed on many computers
安装步骤:
- Stop your servlet container
- From the Solr distribution, copy the Solr war to the webapps directory of your servlet container as solr.war
- From the Solr distribution, copy the example Solr home example/solr as a template for your Solr home.
- Start the servlet container, passing the location of your Solr home. This may be done in a number of ways:
- Set the java system property solr.solr.home to your Solr home. (ie: using the example jetty setup: java -Dsolr.solr.home=/some/dir -jar start.jar
- Configure the servlet container such that a JNDI lookup of “java:comp/env/solr/home” by the Solr webapp will point to the Solr home.
- The default Solr home is “solr” under the JVM’s current working directory ($CWD/solr), so start the servlet container in the directory containing ./solr
- Go to the Solr admin page to verify that the installation is working. It will be at http://localhost:8080/solr/admin
- The servlet container may have started on a port other than 8080… check the servlet containers documentation if you don’t know what this is.
- If there is already a servlet container running at that port, yours may fail to start. Shut down the other one or change the port that yours is running at.
Solr除了可以在如下容器里面运行外:
还可以支持2种云平台:亚马逊的EC2、微软的Azure