Reference fields are not indexed properly: in case of multiple references only the last id is indexed on the content. The result is that the main content cannot be found using a content query by the reference field.
When the content only has one referenced value, the result is perfectly fine, but when reference field has multiple value, the result will only work with one of the referenced content id. Presumably with the latest addition, the other id will result an empty array. When multiple id is given to the query, there is only the same one result.
Reference fields are not indexed properly: in case of multiple references only the last id is indexed on the content. The result is that the main content cannot be found using a content query by the reference field.
Investigation
Reference FieldIndexHandler returns a list of integer index fields. This is not compatible with the rest of the code below. The problem: we need to return a single indexfield here that contains an array of integer values. But there is no underlying API for that, only for strings. If we try to convert reference ids to strings here (creating a string array), search still does not work. https://github.com/SenseNet/sensenet/blob/06fb544fa32db4b6bd5084b1b947dae7743ba73e/src/ContentRepository/Search/Indexing/FieldIndexHandler.cs#L997
IndexDocumentProvider adds them one by one: https://github.com/SenseNet/sensenet/blob/06fb544fa32db4b6bd5084b1b947dae7743ba73e/src/ContentRepository/Search/Indexing/IndexDocumentProvider.cs#L99
But IndexDocument overwrites older entries in the dictionary, because the field name is the same: https://github.com/SenseNet/sensenet/blob/06fb544fa32db4b6bd5084b1b947dae7743ba73e/src/Search/Indexing/IndexDocument.cs#L312
Original client-side error
Client function loadCollection seems to not work properly when queried reference field.
When the content only has one referenced value, the result is perfectly fine, but when reference field has multiple value, the result will only work with one of the referenced content id. Presumably with the latest addition, the other id will result an empty array. When multiple id is given to the query, there is only the same one result.
(Path instead of the Id won't work at all)