文档视界 最新最全的文档下载
当前位置:文档视界 › solr安装

solr安装

1、先下载Apache Solr

1.3 https://www.docsj.com/doc/286183169.html,/lucene/solr/1.3.0/apache-solr-1.3.0.zip,解压到如E:\apache-solr-1.3.0。

2、下载Apache Tomcat

6.0.18 https://www.docsj.com/doc/286183169.html,/apache-mirror/tomcat/tomcat-6/v6.0.18/bin/a pache-tomcat-6.0.18.zip,解压到如E:\apache-tomcat-6.0.18。

3、solr 安装到tomcat。修改E:\apache-tomcat-6.0.18\conf\server.xml,加个URIEncoding="UTF-8",把8080 的那一块改为:

1.

2.connectionTimeout="20000"

3.redirectPort="8443"URIEncoding="UTF-8"/>

把下面的内容保存到E:\apache-tomcat-6.0.18\conf\Catalina\localhost\solr.xml,没有这个目录自行创建。

1.

e="true">

2.

3.

solr 的更多方式请看:solr install

4、现在安装好,启动tomcat,并打开http://localhost:8080/solr/admin/看看界面。

5、为搜索论坛帖子应用设计索引结构:

6、上面的索引结构告诉solr,把下面的内容覆盖

E:\apache-solr-1.3.0\example\solr\conf\scheam.xml,(可以先备份这文件,方便以后看官方示例):

1.

2.

3.

4.

5.

6.

itNorms="true"/>

7.

8.

9.

29.

tNorms="true"/>

30.

31.

>

32.

33.

34.

35.

36.

37.

38.

39.

40.

/>

41.

42.

43.

44.

"NOW"/>

45.

46.

48.

"true"/>

49.

50.

51.

54.id

55.

56.

57.text

58.

59.

60.

61.

62.

65.

66.

67.

68.

69.

7、重启tomcat,然后手动在E:\apache-solr-1.3.0\example\exampledocs 创建两个xml 数据文件。分别保存为demo-doc1.xml 和demo-doc2.xml:

1.

2.

3.

4.1

5.chenlb

6.solr 应用演讲

7.这一小节是讲提交数据给服务器做索引,这里有一些数据,

如:服务器,可以试查找它。

8.

9.

1.

2.

3.

4.2

5.bory.chan

6.搜索引擎

7.搜索服务器那边有很多数据。

8.2009-02-18T00:00:00Z

9.

10.

11.3

12.other

13.这是什么

14.你喜欢什么运动?篮球?

15.2009-02-18T12:33:05.123Z

16.

17.

8、提交数据做索引,到E:\apache-solr-1.3.0\example\exampledocs,运行:

E:\apache-solr-1.3.0\example\exampledocs>java

-Durl=http://localhost:8080/solr/update -Dcommit=yes -jar post.jar

demo-doc*.xml

SimplePostTool: version 1.2

SimplePostTool: WARNING: Make sure your XML documents are encoded in UTF-8, other encodings are not currently supported

SimplePostTool: POSTing files to http://localhost:8080/solr/update..

SimplePostTool: POSTing file demo-doc1.xml

SimplePostTool: POSTing file demo-doc2.xml

SimplePostTool: COMMITting Solr index changes..

9、查看搜索结果:

所有内

容http://localhost:8080/solr/select/?q=*%3A*&version=2.2&start=0&rows= 10&indent=on

1.

2.

3.

4.

5.0

6.0

7.

8.on

9.0

10.*:*

11.10

12.2.2

13.

14.

15.

16.

17.这一小节是讲提交数据给服务器做索引,这里有一些数据,如:服务

器,可以试查找它。

18.1

19.2009-05-27T04:07:54.89Z

20.solr 应用演讲

21.chenlb

22.

23.

24.搜索服务器那边有很多数据。

25.2

26.2009-02-18T00:00:00Z

27.搜索引擎

28.bory.chan

29.

30.

31.你喜欢什么运动?篮球?

32.3

33.2009-02-18T12:33:05.123Z

34.这是什么

35.other

36.

37.

38.

bory.chan 用户的:

http://localhost:8080/solr/select/?q=user%3Abory.chan&version=2.2&start= 0&rows=10&indent=on

1.

2.

3.

4.

5.0

6.0

7.

8.on

9.0

10.user:bory.chan

11.10

12.2.2

13.

14.

15.

16.

17.搜索服务器那边有很多数据。

18.2

19.2009-02-18T00:00:00Z

20.搜索引擎

21.bory.chan

22.

23.

24.

间http://localhost:8080/solr/select/?q=timestamp%3A%5B%222009-02-18T 00%3A00%3A00Z%22+TO+%222009-02-19T00%3A00%3A00Z%22%5D&v ersion=2.2&start=0&rows=10&indent=on

1.

2.

3.

4.

5.0

6.16

7.

8.on

9.0

10.timestamp:["2009-02-18T00:00:00Z" TO "2009-02-19T00:00:00Z"]

11.10

12.2.2

13.

14.

15.

16.

17.搜索服务器那边有很多数据。

18.2

19.2009-02-18T00:00:00Z

20.搜索引擎

21.bory.chan

22.

23.

24.你喜欢什么运动?篮球?

25.3

26.2009-02-18T12:33:05.123Z

27.这是什么

28.other

29.

30.

31.

常用的solr 查询参数请看:solr 查询参数说明

简单的示例已经完成了,索引文件(默认)会在CWD/solr/data/index 目录下,要改为solr.home/data目录下,在

F:\apache-solr-1.3.0\example\solr\conf\solrconfig.xml 把dataDir 注释掉,如:

1.

相关文档