2017-01-09 50 views
0

我正在使用apache solr for text search。我有嵌套文档结构。这是one.json文件:如何用嵌套文档的solr执行部分文本搜索?

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

我已经创建使用以下命令Solr的核心命名为 “演示”:

solr create -c demo 

然后,我上面贴索引记录使用以下命令:

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

Solr ind exed和扁平上述文档的嵌套结构,我想为更好的索引以如下形式:

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

现在,当我把文本“约翰”的搜索查询:

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 

它不工作,返回空。

如何进行此类搜索?我是否缺少一些索引编制来进行部分文本搜索?

+1

使用通配符*搜索通过'http://本地主机:8983/Solr的/演示/选择缩进= ON&Q =荷兰Joh *重量= json' – vinod

回答

1

搜索荷兰Joh *这应该工作