一.环境说明
Windows 10 x64
IDEA 2019.2.3
Spring 4.3.25.RELEASE
Solr 7.7.2
二.开始吧,少年
最近在做solr的升级工作,从4.10升级到最新的7.7,却发现困难难重重.因为相关可参考的资料太少了,能搜到的基本都是停留在solr4或5之类的内容,而再往上的却只有寥寥,让我这个菜鸟很是忧伤.没办法,只能一步步查源码,翻官方文档,来研究更新了什么。
三.对比
在4.10.3的时候,配置是这样的,新建个application-solr.xml,作为Solr的配置文件(个人喜好,也可以不单独出来)。
首先一个改变就是,在4.10的时候,要配置的是HttpSolrServer,而在7.7的时候,你需要配置的东西改名成HttpSolrClient了。
下面就是我们Spring整合Solr7所需的配置文件的内容:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="https://www.springframework.org/schema/beans" xsi:schemalocation="https://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd" xmlns:xsi="https://www.w3.org/2001/XMLSchem