首页 技术 正文
技术 2022年11月17日
0 收藏 338 点赞 3,871 浏览 1139 个字

转自 http://hongweiyi.com/2013/03/configurate-solr-src-in-eclipse/

1. 下载solr的src包,并解压

2. 解压后,在解压后的根目录执行ant eclipse,即生成eclipse需要的项目文件

打开eclipse,File > Import > Existing Projects into Workspace

选择刚才解压后的根目录,这时候java build path等都已经设置好了。

3. Open Type(Ctrl+Shift+T)找到StartSolrJetty 这个类,修改main方法里面的setPort参数为默认的8983,以及ContextPath,War

War为”solr/webapp/web/”

最后的代码应该是这样的:

1 Server server = new Server();
2 SocketConnector connector = new SocketConnector();
3 // Set some timeout options to make debugging easier.
4 connector.setMaxIdleTime(1000 60 60);
5 connector.setSoLingerTime(-1);
6 connector.setPort(8983); // HWY: MODI
7 server.setConnectors(new Connector[] { connector });
8 WebAppContext bb = new WebAppContext();
9 bb.setServer(server);
10 bb.setContextPath("/solr"); // HWY: MODI
11 bb.setWar("solr/webapp/web"); // HWY: MODI

4. 设置solr.solr.home,并run

在run configure中Arguments > VM arguments中写入

-Dsolr.solr.home=your/path/of/example/solr

我的配置为-Dsolr.solr.home=D:/Workspaces/Eclipse/lucene_trunk/solr/example/multicore

也可以在代码中修改,

System.setProperty(“solr.solr.home”, “your/path/of/example/solr”);

使用solr自带的一个example作为sold配置的根目录,也可以设置其他的solr配置目录。点击run即可运行Solr,debug也可以用。

5. 浏览器输入http://localhost:8983/solr查看Solr Admin。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,105
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,582
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,429
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,200
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,836
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,919