@@ -116,11 +116,26 @@ function searchConfigToTemplateNodes(
116
116
const searchRequestProcessors = processorConfigsToTemplateProcessors (
117
117
searchConfig . enrichRequest . processors
118
118
) ;
119
+ // For the configured response processors, we don't maintain separate UI / config
120
+ // between response processors and phase results processors. So, we parse
121
+ // out those different processor types here when configuring the final search pipeline.
122
+ // Currently, the only special phase results processor supported is the normalization processor,
123
+ // so we filter & partition on that type.
124
+ const normalizationProcessor = searchConfig . enrichResponse . processors . find (
125
+ ( processor ) => processor . type === PROCESSOR_TYPE . NORMALIZATION
126
+ ) ;
127
+ const phaseResultsProcessors = processorConfigsToTemplateProcessors (
128
+ normalizationProcessor ? [ normalizationProcessor ] : [ ]
129
+ ) ;
119
130
const searchResponseProcessors = processorConfigsToTemplateProcessors (
120
- searchConfig . enrichResponse . processors
131
+ searchConfig . enrichResponse . processors . filter (
132
+ ( processor ) => processor . type !== PROCESSOR_TYPE . NORMALIZATION
133
+ )
121
134
) ;
122
135
const hasProcessors =
123
- searchRequestProcessors . length > 0 || searchResponseProcessors . length > 0 ;
136
+ searchRequestProcessors . length > 0 ||
137
+ searchResponseProcessors . length > 0 ||
138
+ phaseResultsProcessors . length > 0 ;
124
139
125
140
return hasProcessors
126
141
? [
@@ -133,6 +148,7 @@ function searchConfigToTemplateNodes(
133
148
configurations : JSON . stringify ( {
134
149
request_processors : searchRequestProcessors ,
135
150
response_processors : searchResponseProcessors ,
151
+ phase_results_processors : phaseResultsProcessors ,
136
152
} as SearchPipelineConfig ) ,
137
153
} ,
138
154
} as CreateSearchPipelineNode ,
@@ -254,6 +270,49 @@ export function processorConfigsToTemplateProcessors(
254
270
} ) ;
255
271
break ;
256
272
}
273
+ // optionally add any parameters specified, in the expected nested format
274
+ // for the normalization processor
275
+ case PROCESSOR_TYPE . NORMALIZATION : {
276
+ const {
277
+ normalization_technique,
278
+ combination_technique,
279
+ weights,
280
+ } = processorConfigToFormik ( processorConfig ) ;
281
+
282
+ let finalConfig = { } as any ;
283
+ if ( ! isEmpty ( normalization_technique ) ) {
284
+ finalConfig = {
285
+ ...finalConfig ,
286
+ normalization : {
287
+ technique : normalization_technique ,
288
+ } ,
289
+ } ;
290
+ }
291
+ if ( ! isEmpty ( combination_technique ) ) {
292
+ finalConfig = {
293
+ ...finalConfig ,
294
+ combination : {
295
+ ...( finalConfig ?. combination || { } ) ,
296
+ technique : combination_technique ,
297
+ } ,
298
+ } ;
299
+ }
300
+ if ( ! isEmpty ( weights ) && weights . split ( ',' ) . length > 0 ) {
301
+ finalConfig = {
302
+ ...finalConfig ,
303
+ combination : {
304
+ ...( finalConfig ?. combination || { } ) ,
305
+ parameters : {
306
+ weights : weights . split ( ',' ) . map ( Number ) ,
307
+ } ,
308
+ } ,
309
+ } ;
310
+ }
311
+ processorsList . push ( {
312
+ [ processorConfig . type ] : finalConfig ,
313
+ } ) ;
314
+ break ;
315
+ }
257
316
case PROCESSOR_TYPE . SPLIT :
258
317
case PROCESSOR_TYPE . SORT :
259
318
default : {
0 commit comments