【问题标题】:How to perform partial text search with solr with nested documents?如何使用带有嵌套文档的 solr 执行部分文本搜索?
【发布时间】:2017-05-23 16:33:29
【问题描述】:

我正在使用 apache solr 进行 文本搜索。我有嵌套文档结构。这是 one.json 文件:

{
"id": "1",
"info": {
       "first_name": "John",
       "last_name": "Doe",
       "gender": "male"
        }
}

我使用以下命令创建了一个名为“demo”的solr core

solr create -c demo

然后,我使用以下命令发布了上述记录以进行索引:

bin/post -c demo docs2/   //docs2 has the one.json file 

Solr 对上述文档的嵌套结构进行了索引和展平,我猜想以以下形式更好地索引:

{
    "id":["1"],
    "info.first_name":["John"],
    "info.last_name":["Doe"],
    "personal.gender":["male"]
}

现在,当我使用文本“John”进行搜索查询时:

http://localhost:8983/solr/demo/select?indent=on&q=John&wt=json

它可以工作并给出预期的结果。

但是,当我尝试使用文本“Joh”进行部分搜索时:

http://localhost:8983/solr/demo/select?indent=on&q=Joh&wt=json

它不起作用并返回空。

如何进行这种类型的搜索?我是否遗漏了一些索引以进行部分文本搜索?

【问题讨论】:

  • 使用通配符 * 搜索http://localhost:8983/solr/demo/select?indent=on&q=Joh*&wt=json

标签: solr


【解决方案1】:

搜索 Joh*,这应该可以工作

【讨论】:

    猜你喜欢
    • 2020-11-04
    • 1970-01-01
    • 2012-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-24
    相关资源
    最近更新 更多