sorl基础练习 实验报告
0.启动solr
bin/solr start -e techprojects
(下面解决权限问题)


1.理解索引
1.1定位techproducts文内核所在文件目录,分析目录结构
输入网址:http://119.29.41.86:8983/solr/# (进入solr控制台)

1.2 定位 techproducts 索引数据的文件位置。
/opt/solr-6.3.0/example/techproducts/solr/techproducts/data/index
1.3 下载索引数据到本地,熟悉 Solr/Lucene 索引相关的多文件结构。
在终端找到上述文件位置进行下载。
1.4 使用 Luke 查看索引数据。
1.4.1 在本地打开 Luke jar 应用窗口。
1.4.2 打开 techproducts 的索引数据,熟悉 Luke 的 5 个选项卡,结合已打开的索引数据,简述 Luke 能做什么。

1.4.3 在 search 选项卡中,搜索 name:ipod,查看搜索结果,点击 explain,了解第一条搜索结果的 score 得分。

1.5 了解 schema 的作用。
1.5.1 定位 techproducts 的 schema 信息(managed-schema 文件),对照之前的索引情况,解读其 schema 内容。
/opt/solr-6.3.0/example/techproducts/solr/techproducts/conf/
详情见:http://www.cnblogs.com/langfanyun/p/5829874.html
1.5.2 定位 techproducts 的被索引文档(原始文档),对照索引和 schema 情况,分析多个原始文档的内容构成。
2.掌握 Query 查询构造
2.1 搜索制造商为 Belkin 的 iPod 配件,搜索结果按价格升序排列,搜索结果内容包含名称(name)、价格(price)、特征(features),返回 xml 数据。
查询请求:
http://120.24.46.77:8983/solr/techproducts/select?fl=name,price,features&fq=Belkin&indent=on&q=iPod&sort=price asc&wt=xml
查询结果(片段及分析):

2.2 搜索流行度为 5 及以上的产品,搜索结果先按 inStock 降序,再按 price 升序,每页显示 5 个结果分页,搜索结果内容包括名称(name)、价格(price)、特征(features),受欢迎程度(popularity),返回 json 数据。
查询请求:
http://120.24.46.77:8983/solr/techproducts/select?fl=name,price,features,popularity&fq=popularity:[5 to 20*]&indent=on&rows=5&sort=inStock desc,price asc&wt=json
查询结果(片段及分析):

2.3 搜索价格在 400 以下且有存库的商品,按受欢迎程度降序排列,搜索结果内容包括名称(name),价格(price),特征(features)及得分(score),返回 json 数据。
查询请求:http://120.24.46.77:8983/solr/techproducts/select?fl=name,price,features,score&fq=price:[0 to 400],inStock:[0 to *]&indent=on&sort=popularity desc&wt=json
查询结果(片段及分析):

2.4 在特征(features)字段中搜索“plays”,对其进行高亮,搜索结果内容采用默认形式,返回 xml 数据。
查询请求:
http://120.24.46.77:8983/solr/techproducts/select?fl=features&fq=features&hl=true&hl.field=plays

未完待续....