具有动态字段的Solr查询 [英] Solr query with dynamic field
问题描述
pre $ p $ docs:[{
id:id1
link.1.text:mytext
link.1.nImg:1
link.2.text:mytext
link.2.nImg:2
},{
id:id2
链接。 1.text:mytext
link.1.nImg:1
link.2.text:mytext
link.2.nImg:1
}]
如何获取一个查询:链接。 * .text:mytext
或链接*。nImg:2
?
你不能在Solr中这样做。
动态字段允许Solr索引您在模式中未明确显示
定义的字段。如果您发现
忘记定义一个或多个字段,这很有用。动态字段可以通过在可以添加到Solr的
文档中提供一些灵活性,使您的
应用程序变得不那么脆弱。
在查询中,您需要列出字段名称的确切名称,因此动态字段为您提供索引时间灵活性
某些更多信息 - https://cwiki.apache.org/confluence/display/solr/Dynamic+Fields
I have documents with the following link.*
dynamic fields:
"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
?
You couldn't do that in Solr.
Dynamic fields allow Solr to index fields that you did not explicitly define in your schema. 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.
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
这篇关于具有动态字段的Solr查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!