Thanks for the prompt reply Jack.  Could you point me towards any code
examples of that technique?


On Fri, Aug 24, 2012 at 4:31 PM, Jack Krupansky <j...@basetechnology.com> wrote:
> The general rule in Solr is simple: denormalize your data.
>
> If you have some maps (or tables) and a set of keys (columns) for each map
> (table), define fields with names like <map-name>_<key-name>, such as
> "map1_name", "map2_name", "map1_field1", "map2_field1". Solr has dynamic
> fields, so you can define "<map-name>_*" to have a desired type - if all the
> keys have the same type.
>
> -- Jack Krupansky
>
> -----Original Message----- From: Sheldon P
> Sent: Friday, August 24, 2012 3:33 PM
> To: solr-user@lucene.apache.org
> Subject: How do I represent a group of customer key/value pairs
>
>
> I've just started to learn Solr and I have a question about modeling data
> in the schema.xml.
>
> I'm using SolrJ to interact with my Solr server.  It's easy for me to store
> key/value paris where the key is known.  For example, if I have:
>
> title="Some book title"
> author="The authors name"
>
>
> I can represent that data in the schema.xml file like this:
>
>        <field name="title" type="text_general" indexed="true"
> stored="true"/>
>        <field name="author" type="text_general" indexed="true"
> stored="true"/>
>
> I also have data that is stored as a Java HashMap, where the keys are
> unknown:
>
> Map<String, String> map = new HashMap<String, String>();
> map.put("some unknown key", "some unknown data");
> map.put("another unknown key", "more unknown data");
>
>
> I would prefer to store that data in Solr without losing its hierarchy.
> For example:
>
> <field name="map" type="maptype" indexed="true" stored="true"/>
>
> <field name="some unknown key" type="text_general" indexed="true"
> stored="true"/>
>
> <field name="another unknown key" type="text_general" indexed="true"
> stored="true"/>
>
> </field>
>
>
> Then I could search for "some unknown key", and receive "some unknown data".
>
> Is this possible in Solr?  What is the best way to store this kind of data?

Reply via email to