In general, you flatten the data when you put things into Solr. I know that's anathema to DB training, but this is searching <G>...
If you have a reasonable number of distinct column names, you could just define your schema to have an entry for each and index the associated values that way. Then your facets become easy, you're just faceting on the "facet_hobby" field in your example. If that's impractical (say you can add arbitrary columns), you can do something very similar with dynamic fields. You could also create a field with the column/name pairs (watch your tokenizer!) in a single field and facet by prefix, where the prefix was the column name (e.g. index tokens like hobby_sailing hobby_camping interest_reading then facet with facet.prefix:hobby_). There are tradeoffs for each that you'll have to experiment with. Note that there is no penalty in Solr for defining fields in your schema but not using them. Best Erick On Fri, Sep 23, 2011 at 12:06 AM, Chorherr Nikolaus <nikolaus.chorh...@umweltbundesamt.at> wrote: > Hi All! > > We are working first time with solr and have a simple data model > > Entity Person(column surname) has 1:n Attribute(column name) has 1:n > Value(column text) > > We need faceted search on the content of Attribute:name not on Attribute:name > itself, e.g if an Attribute of person has name=hobby, we would like to have > something like ... "facet=true&facet.name=hobby" and get back > all related Value with count.(We do not need a "facet.name=name" and get back > all distinct values of the name column of Attribute) > > How do we have to map our database, define or document and/or define our > schema? > > Any help is highly appreciated - Thx in advance > > Niki >