Affects Version/s: 5.5.5.Final
I am trying to work with hibernate search facets.
I have three use cases :
- Faceting on a simple field -> This is OK.
- Faceting on a Collection of entity (with an IndexEmbeded) -> This is OK.
- Faceting on a simple Collection (like a Collection of String) -> This does not work.
This is an example :
I register my facets like this :
and get facets values like this :
So when I perform this code and try to get facets values, I get a list of String like :
This is totally normal regarding the code in the Class
In fact, facets work well on a Collection of entities because it is detected that there is embeded objects. So the method buildDocumentFieldsForEmbeddedObjects is called.
In this method, ther is something like this :
So it's works because you iterate on each item. Moreover, multivalued (a FacetHandling property) is set to true.
However, on my use case, it is not an embeded. So multivalued property is set to false and the method which is called is this buildDocumentFieldsForProperties which called getFacetDocValues method on a collection object. In this method ther is something like this :
This is applied directly on a collection object. That's why I get the result above.
I think I have a solution to fix the issue but I would like to know if this is really an issue or if I misunderstood something.
I have put the file DocumentBuilderIndexedEntity.java with my fix.
Thanks for the help.