solr第三篇-solr使用,
https://lucene.apache.org/solr/guide/7_5/solr-tutorial.html#launch-solr-in-solrcloud-mode
一、hosts和port
2.本地调用用localhost
http://localhost:8983/solr/gettingstarted/select?q=brown+cow
二、directory path
solr.home = server/solr
image.png三、api example
v1 api
v2 api
四、启动solr,导入数据源,检索
start Solr, create a collection, index some basic documents, and then perform some searches.
1。创建集合techproducts2:
collection:
techproducts2
shards:
replicas;
configSet:
至少也要包含2个配置文件
the schema file (named either managed-schema or schema.xml), and solrconfig.xml.
2.导入数据源,简历索引库
solr-7.5.0:$ bin/post -c techproducts2 example/exampledocs/*
在techproducts2集合下导入 example/exampledocs/*中所有文档,简历索引库。
3.检索方式:
联合查询Combining Searches
+electronics +music
+electronics -music
短语查询Phrase Search
To search for a multi-term phrase, enclose it in double quotes: q="multiple terms here". For example, search for "CAS latency" by entering that phrase in quotes to the q box in the Admin UI.
"CAS latency"表示一个短语,""不可省略。
指定域查询Field Searches
cat:electronics
搜索单个目标Search for a Single Term
foundation
搜索过滤:只显示id
http://localhost:8983/solr/techproducts/select?q=foundation&fl=id
搜索全部
*:*
4、删除集合techproducts2
bin/solr delete -c techproducts2
5、删除,创建,停止
delete this collection:
bin/solr delete -c techproducts
And then create a new collection:
bin/solr create -c <yourCollection> -s 2 -rf 2
To stop both of the Solr nodes we started, issue the command:
bin/solr stop -all
五、solr安装目录解读
https://lucene.apache.org/solr/guide/7_5/installing-solr.html#directory-layout
- bin/solr
定义了一些命令,便于操控solr
start and stop Solr.
create collections or cores,
configure authentication, and work with configuration files when running in SolrCloud mode.
- bin/example/
一些使用范例
-
bin/server/
image.png
SolrCloud
nodes
cluster
zookeeper