java -jar post.jar -h](https://img.haomeiwen.com/i5778083/da58e4afddbe9a65.PNG?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
1.2 解决错误
sudo apt-get install python-software-properties
sudo apt-get install apt-file
apt-file update
apt-file search add-apt-repository
sudo apt-get software-properties-common
至此,问题解决。
1.3 配置环境
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
1.4 测试
java -version
2.安装solr
2.1 获取solr
wget http://archive.apache.org/dist/lucene/solr/6.3.0/solr-6.3.0.gz
2.2 安装solr
apt install unzip
tar zxvf solr-6.3.0.gz
2.3启动solr
cd solr-6.3.0/bin
sudo ./solr start -cloud -p 8983 -force
3.solr中文分词实践
3.1 加载smartcn包

3.2 managed-schema中,新建一个字段类型text_chinese, 用以处理中文分词

3.3 分词测试

中英文混合分词效果

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

网友评论