Search code examples
spring-data-solr

Spring Data Solr: map type field


is it possible to define in @SolrDocument a field with type Map<String, List<String>>? I've tried using:

@Indexed(name = "words", type = "string") 
var words: Map<String, List<String>>?

I'm setting that field as val words = mapOf(Pair("1111", listOf("word1", "word2"))) but when saving to Solr this field isn't saved at all. And when this document is found by SolrRepository the value for field words is null.

What type in @Indexed annotation do I have to use to get Map type?


Solution

  • If you are still looking for an answer:

    @Field("words_*")
    @Dynamic
    var words: Map<String, List<String>>?
    

    should do the trick