Tell us a little more, with examples, of how you really want to search and facet this information.

One technique is to store the same information in multiple ways, for different uses, combining the name in different ways, such as "Berlin", "Berlin:DE", "Berlin, NJ", "Berlin:Germany", "Berlin GERMANY", etc.

Ultimately, the idea for facets is not that they uniquely identify an entity, but that a combination of facet selections let you drill down into the data, such that each facet selection narrows one dimension.

-- Jack Krupansky

-----Original Message----- From: Achim Domma
Sent: Monday, May 20, 2013 5:12 PM
To: solr-user@lucene.apache.org
Subject: Store complex (i.e. label + id) meta data in SOLR document

I store documents having some meta data that is composed out of multiple values. Usually an id with a label. A simple example would be the name of a city and the unique id of that city. The id is needed, because different cities can have the same name like Berlin in Germany and Berlin in the US. The name is obviously needed, because I want to search for that string.

If I use facets, I would like to get back two facets having the label "Berlin". If I restrict my search (using some other meta data field) to documents from germany, I would expect to get only one facet for the german Berlin. Obviously this does not work, if I store id and label in two seperated SOLR fields.

I would assume that this is not an uncommon requirement, but I was not able to find any useful information. My current approaches are:

* Implement a complete custom field type in Java: Hard to estimate for me, because I'm currently just a SOLR user, not a SOLR developer.

* Put id and label in a single string (like "123:Berlin" and "456:Berlin") and define custom field types in schema.xml using a custom analyzer which splits the value. Sound reasonable to me, but I'm not 100% sure if it will work with faceting.

* I found some references to subfields, but only on older pages and I was not able to find useful documentation.

Is there some well known way to solve this in SOLR?

kind regards,
Achim=

Reply via email to