Skip to content

Commit

Permalink
GH-101 Fix is_array on index of single object field
Browse files Browse the repository at this point in the history
  • Loading branch information
steleal committed Aug 15, 2024
1 parent 443e664 commit 0393d07
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,14 @@ List<ReindexerIndex> parseIndexes(Class<?> itemClass, boolean subArray, String r
Json json = field.getAnnotation(Json.class);
String jsonPath = jsonBasePath + (json == null ? field.getName() : json.value());
FieldInfo fieldInfo = getFieldInfo(field);

// If at least one array (collection) is encountered on a nested path for some field,
// or the field itself is an array, then the index on it must also be an array.
if (subArray) {
fieldInfo.isArray = true;
}
if (COMPOSITE == fieldInfo.fieldType && !fieldInfo.isArray) {
List<ReindexerIndex> nested = parseIndexes(field.getType(), true, reindexPath, jsonPath, joined);
List<ReindexerIndex> nested = parseIndexes(field.getType(), subArray, reindexPath, jsonPath, joined);
indexes.addAll(nested);
} else if ((fieldInfo.isArray) && fieldInfo.componentType != null
&& getFieldTypeByClass(fieldInfo.componentType) == COMPOSITE) {
Expand Down

0 comments on commit 0393d07

Please sign in to comment.