Skip to content

Commit

Permalink
issue #1013: adds settings from request if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
mrk-vi committed Aug 26, 2024
1 parent f1b37f9 commit 190358b
Showing 1 changed file with 25 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,6 @@ public static class GetMappingsOrSettingsFromDocTypesRequest {
private List<Long> docTypeIds;
}

@Data
@AllArgsConstructor
@NoArgsConstructor
public static class CreateDataIndexFromDocTypesRequest {
private List<Long> docTypeIds;
private String indexName;
}

@Inject
Mutiny.SessionFactory sessionFactory;

@Inject
IndexerEvents indexerEvents;

@Path("/create-data-index-from-doc-types/{datasourceId}")
@POST
public Uni<DataIndex> createDataIndexFromDocTypes(
Expand Down Expand Up @@ -229,8 +215,16 @@ public Uni<DataIndex> createDataIndexFromDocTypes(

Settings settings;

Map<String, Object> settingsMap =
MappingsUtil.docTypesToSettings(di.getDocTypes());
Map<String, Object> settingsMap = null;

Map<String, Object> requestSettings = request.getSettings();

if (requestSettings != null && !requestSettings.isEmpty()) {
settingsMap = requestSettings;
}
else {
settingsMap = MappingsUtil.docTypesToSettings(di.getDocTypes());
}

if (settingsMap.isEmpty()) {
settings = Settings.EMPTY;
Expand Down Expand Up @@ -272,6 +266,21 @@ public Uni<DataIndex> createDataIndexFromDocTypes(

}

@Inject
Mutiny.SessionFactory sessionFactory;

@Inject
IndexerEvents indexerEvents;

@Data
@AllArgsConstructor
@NoArgsConstructor
public static class CreateDataIndexFromDocTypesRequest {
private List<Long> docTypeIds;
private String indexName;
private Map<String, Object> settings;
}

@Inject
DocTypeService docTypeService;

Expand Down

0 comments on commit 190358b

Please sign in to comment.