Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-101 Fix is_array on index of single object field #102

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading