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