Solr入门学习(二)—— Solr 的基本查询

Server : Ubuntu 16.04
Java Version : 1.8
Solr Version : 7.4.0

一、数据准备

Solr 刚刚安装后,是没有任何数据的,所以此时我们无法进行任何查询。幸运的是,官方为用户提供了索引工具以及样本数据,方便新手快速建立索引。

首先,我们先看一下索引工具和样本数据分别位于哪个位置。

  • 索引工具:/{solr_home}/bin/post
  • 样本数据:/{solr_home}/example/exampledocs

在样本数据中,包含了 jsoncsvxmlhtml 等多种格式的数据。尽管如此,官方提供的 post 工具只需一个命令即可为上述多种格式的数据建立索引:

./post -c techproducts ../example/exampledocs/*

成功运行命令,我们看到以下信息输出:

SimplePostTool version 5.0.0
Posting files to [base] url http://localhost:8983/solr/testCollection/update...
Entering auto mode. File endings considered are xml,json,jsonl,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log
POSTing file books.csv (text/csv) to [base]
POSTing file books.json (application/json) to [base]/json/docs
POSTing file gb18030-example.xml (application/xml) to [base]
POSTing file hd.xml (application/xml) to [base]
POSTing file ipod_other.xml (application/xml) to [base]
POSTing file ipod_video.xml (application/xml) to [base]
POSTing file manufacturers.xml (application/xml) to [base]
POSTing file mem.xml (application/xml) to [base]
POSTing file money.xml (application/xml) to [base]
POSTing file monitor2.xml (application/xml) to [base]
POSTing file monitor.xml (application/xml) to [base]
POSTing file more_books.jsonl (application/json) to [base]/json/docs
POSTing file mp500.xml (application/xml) to [base]
POSTing file post.jar (application/octet-stream) to [base]/extract
POSTing file sample.html (text/html) to [base]/extract
POSTing file sd500.xml (application/xml) to [base]
POSTing file solr-word.pdf (application/pdf) to [base]/extract
POSTing file solr.xml (application/xml) to [base]
POSTing file test_utf8.sh (application/oc
  • 8
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值