java -jar post.jar -h](http://upload-images.jianshu.io/upload_images/5778083-da58e4afddbe9a65.PNG?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
1.2 解决错误
sudo apt-get install python-software-properties
9.PNG
10.PNG
sudo apt-get install apt-file
apt-file update
11.PNG
apt-file search add-apt-repository
12.PNG
sudo apt-get software-properties-common
13.PNG
至此,问题解决。
1.3 配置环境
sudo add-apt-repository ppa:webupd8team/java
14.PNG
sudo apt-get update
15.PNG
sudo apt-get install oracle-java8-installer
16.PNG
17.PNG
18.PNG
1.4 测试
java -version
19.PNG
2.安装solr
2.1 获取solr
wget http://archive.apache.org/dist/lucene/solr/6.3.0/solr-6.3.0.gz
20.PNG
2.2 安装solr
apt install unzip
tar zxvf solr-6.3.0.gz
23.PNG
24.PNG
2.3启动solr
cd solr-6.3.0/bin
sudo ./solr start -cloud -p 8983 -force
28.PNG
3.solr中文分词实践
3.1 加载smartcn包
image.png
3.2 managed-schema中,新建一个字段类型text_chinese, 用以处理中文分词
image.png
3.3 分词测试
image.png
中英文混合分词效果
image.png
4.solr使用
4.1 post.jar导入数据
java -jar post.jar -h
```

导入gb18030-example.xml
java -Dc=gettingstarted -jar post.jar gb18030-example.xml
导入post.jar books.json(需要指明文件类型)
java -Dtype=application/json -Dc=gettingstarted -jar post.jar books.json

###4.2 查询
第一种方式:使用query查询

右侧查询结果

第二种方式:直接构造查询地址
http://localhost:8983/solr/zjj1/select?wt=xml&indent=true&q=foundation
