import { Schema } from '../../../../shared/schema/types' ; import { Fields } from './types' ; export const buildSearchUIConfig = ( apiConnector , schema , fields ) => { const facets = fields . filterFields . reduce ( ( facetsConfig , fieldName ) => ( { ... facetsConfig , [ fieldName ] : { type : 'value' , size : 30 } , } ) , { } ) ; return { alwaysSearchOnInitialLoad : true , apiConnector , trackUrlState : false , initialState : { sortDirection : 'desc' , sortField : 'id' , } , searchQuery : { disjunctiveFacets : fields . filterFields , facets , result_fields : Object . keys ( schema ) . reduce ( ( acc , key ) => { acc [ key ] = { snippet : { size : 300 , fallback : true , } , raw : { } , } ; return acc ; } , { } ) , } , } ; } ;