solr8 导数据
程序员文章站
2022-06-12 23:15:18
...
背景知识:solr按官网上的步骤跑起来之后。数据是空的。那么就用XML把数据导进来。
E:\source\example\exampledocs>java -jar -Dc=data-1 -Dauto post.jar *
SimplePostTool version 5.0.0
Posting files to [base] url http://localhost:8983/solr/data-1/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 monitor.xml (application/xml) to [base]
POSTing file monitor2.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/octet-stream) to [base]/extract
POSTing file utf8-example.xml (application/xml) to [base]
POSTing file vidcard.xml (application/xml) to [base]
21 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/data-1/update...
Time spent: 0:00:07.905
然后在你的SOLR控制台的页面左侧菜单看到两个下拉条。选择第一个下拉。然后点击QUERY.就可以用SELECT检测数据是否已经进库了。
http://localhost:8983/solr/data-1/select?q=*%3A*
{
"responseHeader":{
"zkConnected":true,
"status":0,
"QTime":77,
"params":{
"q":"*:*",
"_":"1563270289124"}},
"response":{"numFound":52,"start":0,"maxScore":1.0,"docs":[
{
"id":"0812521390",
"cat":["book"],
"name":["The Black Company"],
"price":[6.99],
"inStock":[false],
"author":["Glen Cook"],
"series_t":"The Chronicles of The Black Company",
"sequence_i":1,
"genre_s":"fantasy",
"_version_":1639209160941764608},
{
"id":"0441385532",
"cat":["book"],
"name":["Jhereg"],
"price":[7.95],
"inStock":[false],
"author":["Steven Brust"],
"series_t":"Vlad Taltos",
"sequence_i":1,
"genre_s":"fantasy",
"_version_":1639209160954347520},
{
"id":"0380014300",
"cat":["book"],
"name":["Nine Princes In Amber"],
"price":[6.99],
"inStock":[true],
"author":["Roger Zelazny"],
"series_t":"the Chronicles of Amber",
"sequence_i":1,
"genre_s":"fantasy",
"_version_":1639209160955396096},
{
"id":"0805080481",
"cat":["book"],
"name":["The Book of Three"],
"price":[5.99],
"inStock":[true],
"author":["Lloyd Alexander"],
"series_t":"The Chronicles of Prydain",
"sequence_i":1,
"genre_s":"fantasy",
"_version_":1639209160959590400},
{
"id":"080508049X",
"cat":["book"],
"name":["The Black Cauldron"],
"price":[5.99],
"inStock":[true],
"author":["Lloyd Alexander"],
"series_t":"The Chronicles of Prydain",
"sequence_i":2,
"genre_s":"fantasy",
"_version_":1639209160961687552},
{
点完query后执行查询可以看到所有的数据已经成功导入。
在q那一栏输入features:功能
即可查询字段名为features的内容为功能的数据了。
简单查询就这样喽。
OK..pass.
E:\source\example\exampledocs>java -jar -Dc=data-1 -Dauto post.jar *
SimplePostTool version 5.0.0
Posting files to [base] url http://localhost:8983/solr/data-1/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 monitor.xml (application/xml) to [base]
POSTing file monitor2.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/octet-stream) to [base]/extract
POSTing file utf8-example.xml (application/xml) to [base]
POSTing file vidcard.xml (application/xml) to [base]
21 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/data-1/update...
Time spent: 0:00:07.905
然后在你的SOLR控制台的页面左侧菜单看到两个下拉条。选择第一个下拉。然后点击QUERY.就可以用SELECT检测数据是否已经进库了。
http://localhost:8983/solr/data-1/select?q=*%3A*
{
"responseHeader":{
"zkConnected":true,
"status":0,
"QTime":77,
"params":{
"q":"*:*",
"_":"1563270289124"}},
"response":{"numFound":52,"start":0,"maxScore":1.0,"docs":[
{
"id":"0812521390",
"cat":["book"],
"name":["The Black Company"],
"price":[6.99],
"inStock":[false],
"author":["Glen Cook"],
"series_t":"The Chronicles of The Black Company",
"sequence_i":1,
"genre_s":"fantasy",
"_version_":1639209160941764608},
{
"id":"0441385532",
"cat":["book"],
"name":["Jhereg"],
"price":[7.95],
"inStock":[false],
"author":["Steven Brust"],
"series_t":"Vlad Taltos",
"sequence_i":1,
"genre_s":"fantasy",
"_version_":1639209160954347520},
{
"id":"0380014300",
"cat":["book"],
"name":["Nine Princes In Amber"],
"price":[6.99],
"inStock":[true],
"author":["Roger Zelazny"],
"series_t":"the Chronicles of Amber",
"sequence_i":1,
"genre_s":"fantasy",
"_version_":1639209160955396096},
{
"id":"0805080481",
"cat":["book"],
"name":["The Book of Three"],
"price":[5.99],
"inStock":[true],
"author":["Lloyd Alexander"],
"series_t":"The Chronicles of Prydain",
"sequence_i":1,
"genre_s":"fantasy",
"_version_":1639209160959590400},
{
"id":"080508049X",
"cat":["book"],
"name":["The Black Cauldron"],
"price":[5.99],
"inStock":[true],
"author":["Lloyd Alexander"],
"series_t":"The Chronicles of Prydain",
"sequence_i":2,
"genre_s":"fantasy",
"_version_":1639209160961687552},
{
点完query后执行查询可以看到所有的数据已经成功导入。
在q那一栏输入features:功能
即可查询字段名为features的内容为功能的数据了。
简单查询就这样喽。
OK..pass.
上一篇: java读取txt文件乱码惹人烦
下一篇: 微信的支付申请