doublemc
doublemc

Reputation: 3311

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?

Upvotes: 1

Views: 582

Answers (1)

Cliff Pereira
Cliff Pereira

Reputation: 473

If you are still looking for an answer:

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

should do the trick

Upvotes: 1

Related Questions