First you need to tell us how you wish to use and query the data. That will largely determine how the data must be stored. Give us a few example queries of how you would like your application to be able to access the data.

Note that Lucene has only simple multivalued fields - no structure or nesting within a single field other that a list of scalar values.

But you can always store a complex structure as a BSON blob or JSON string if all you want is to store and retrieve it in its entirety without querying its internal structure. And note that Lucene queries are field level - does a field contain or match a scalar value.

-- Jack Krupansky

-----Original Message----- From: A Geek
Sent: Friday, September 06, 2013 7:10 AM
To: solr user
Subject: Store 2 dimensional array( of int values) in solr 4.0

hi All, I'm trying to store a 2 dimensional array in SOLR [version 4.0]. Basically I've the following data:
[[20121108, 1],[20121110, 7],[20121111, 2],[20121112, 2]] ...

The inner array being used to keep some count say X for that particular day. Currently, I'm using the following field to store this data: <field name="dataX" type="string" indexed="true" stored="true" multiValued="true"/> and I'm using python library pySolr to store the data. Currently the data that gets stored looks like this(its array of strings) <arr name="dataX"><str>[20121108, 1]</str><str>[20121110, 7]</str><str>[20121111, 2]</str><str>[20121112, 2]</str><str>[20121113, 2]</str><str>[20121116, 1]</str></arr> Is there a way, i can store the 2 dimensional array and the inner array can contain int values, like the one shown in the beginning example, such that the the final/stored data in SOLR looks something like: <arr name="dataX">
<arr name=index><int>20121108</int> <int> 7 </int> </arr>
<arr name=index><int> 20121110</int><int> 12 </int></arr>
<arr name=index><int> 20121110</int><int> 12 </int></arr>
</arr>
Just a guess, I think for this case, we need to add one more field[the index for instance], for each inner array which will again be multivalued (which will store int values only)? How do I add the actual 2 dimensional array, how to pass the inner arrays and how to store the full doc that contains this 2 dimensional array. Please help me out sort this issue. Please share your views and point me in the right direction. Any help would be highly appreciated. I found similar things on the web, but not the one I'm looking for: http://lucene.472066.n3.nabble.com/Two-dimensional-array-in-Solr-schema-td4003309.html Thanks

Reply via email to