How to serialize / deserialize a map using Solr / Lucene?

I am new to solr and I am facing a problem when I try to serialize / deserialize a map in Solr.

I am using Spring Data Solr in my Java application like this:

@Field("mapped_*")
private Map<String, String> values;

      

It flattens and orders my map in Solr like this:

"key1" : "value1"
"key2" : "value2"
...

      

However, when I run the search, the returned objects always set this field to NULL. Deserialization doesn't work on this particular field, it looks like it doesn't recognize key1, key2 ... as part of the Map.

Does anyone know how to get the derivation to work? Should I use my own converter?

0


source to share


1 answer


At this time, Spring Data Solr will not automatically prefix the values ​​contained in the map with the data @Field#value

, but simply use it Map#key

as the field name. An improvement ( DATASOLR-202 ) opens there .

At this time key1

, key2

.. in values requires that the field name has been key*

correctly to read the values.



@Field("key*")
private Map<String, String> values;

      

+3


source







All Articles