Index a List of Strings


I am using Hibernate Search 6.
How would I index a list of Strings? I want to be able to filter (match 100%) or search (match a term) in this field.

List<string> coopPartner;

I read that the solution may be to use PropertyBridge. But how would the binder for a list of strings be implemented? Or is there another solution?

List<String> keywords;

See Hibernate Search 6.0.6.Final: Reference Documentation

EDIT: Also, hello :slight_smile:

EDIT: As to your requirement to “match 100%”, you will have to be more precise. Do you mean you want to match one particular element of the list exactly, or to match the whole list exactly?

thanky for the fast responds. But when i do that, i get the following error

Caused by: org.hibernate.MappingException: Could not determine type for: java.util.List, at table: research_project, for columns: [org.hibernate.mapping.Column(coop_partner)]

This is a Hibernate ORM / JPA error, not a Hibernate Search error.
I would guess you forgot to add @ElementCollection.

What is your full mapping?

Yes! You are right. While converting the property from String to List<String> i forgot it.
Sorry and thank you very much!

1 Like