简体   繁体   English

具有动态字段的Solr查询

[英]Solr query with dynamic field

I have documents with the following link.* dynamic fields: 我的文档带有以下link.*动态字段:

"docs": [{
    "id":"id1" 
    "link.1.text":"mytext"
    "link.1.nImg":1
    "link.2.text":"mytext"
    "link.2.nImg":2
}, {
    "id":"id2" 
    "link.1.text":"mytext"
    "link.1.nImg":1
    "link.2.text":"mytext"
    "link.2.nImg":1
}]

How can I get a query like : link.*.text:"mytext" or link.*.nImg:2 ? 如何获得类似以下查询: link.*.text:"mytext"link.*.nImg:2

You couldn't do that in Solr. 您无法在Solr中做到这一点。

Dynamic fields allow Solr to index fields that you did not explicitly define in your schema. 动态字段允许Solr索引您在架构中未明确定义的字段。 This is useful if you discover you have forgotten to define one or more fields. 如果发现忘记定义一个或多个字段,此功能很有用。 Dynamic fields can make your application less brittle by providing some flexibility in the documents you can add to Solr. 动态字段通过在可以添加到Solr的文档中提供一定的灵活性,可以使您的应用程序不那么脆弱。

In query you need to list exact name of a field name, so dynamic fields give you an index time flexibility 在查询中,您需要列出字段名称的确切名称,因此动态字段为您提供了索引时间的灵活性

Some more info - https://cwiki.apache.org/confluence/display/solr/Dynamic+Fields 一些更多信息-https: //cwiki.apache.org/confluence/display/solr/Dynamic+Fields

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM