lizzie
lizzie

Reputation: 1656

Solr query with dynamic field

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 ?

Upvotes: 1

Views: 3335

Answers (1)

Mysterion
Mysterion

Reputation: 9320

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

Upvotes: 4

Related Questions