使用 JSON 请求 API 获取 MoreLikeThis 结果

问题描述 投票:0回答:1

我可以使用 JSON 请求 API 轻松查询我的 Solr 索引。 是否可以使用 JSON 请求 API 和 RequestHandler 查找 MoreLikeThis 文档?

简单的 JSON 查询(根据文档):

url:  http://localhost:8983/solr/techproducts/query
body: 
{
  "query" : "memory",
  "filter" : "inStock:true"
}

MoreLikeThis 查询如下所示:

url: http://localhost:8983/solr/techproducts/mlt?mlt.fl=author&mlt.mindf=0&mlt.mintf=0&q=id%3A0553573403

是否可以将上述内容转换为 JSON 请求的正文?

感谢您的帮助!

注意:我知道我可以使用 SearchComponent RequestHandler 在查询结果中包含 MLT 文档,但这不是我想要的。

solr morelikethis
1个回答
0
投票

在这里发布自己的答案...

使用 MoreLikeThis 查询解析器,似乎可以检索 MLT 记录。

这个

url: http://localhost:8983/solr/techproducts/mlt?mlt.fl=author&mlt.mindf=0&mlt.mintf=0&q=id%3A0553573403

翻译成这样

url: http://localhost:8983/solr/techproducts/query
body: 
{
    "query": "{!mlt qf=author mintf=0 mindf=0}0553573403"
}

根据文档(https://solr.apache.org/guide/solr/latest/query-guide/morelikethis.html#morelikethis-query-parser),MLT 查询解析器使用文档的唯一键来识别文档.

希望这有帮助!

© www.soinside.com 2019 - 2024. All rights reserved.