An unexpected error occurred: [400] Filters is missing keys for field

Hi,

I am no front end developer but working with the searh UI templete generate form reference UI in app serach. I want to add a geolocation facet, and I think I have managed to add the facet to the searchQuery by ediding buildFacetConfigFromConfig() from config-helpers.

    export function buildFacetConfigFromConfig() {

         const facets =  {location: [{"type": "range", "center": "59.911491,-10.757933","unit": "m", "ranges": [{ "from": 0, "to": 100000, "name": "Nearby" }, { "from": 100000, "to": 300000, "name": "A longer drive." }, { "from": 300000, "name": "Perhaps fly?" }]}], type: [{ type: "value", size: 30 }]}

      return facets;

    } 

Further I have generated my own Facets (deleted the getFacetFields() from the autogenerated origin) and added them to sidecontent.


                         <Facet 

                           field = "type"

                            label = "type"

                            filtertype = "all"

                            filtertype = "any"

                            isFilterable = {true}

                            //view={BooleanFacet}

                          />

                          <Facet 

                            field = "location"

                            label = "location"

                            //center = "59.911491,-10.757933"

                            //unit = "m"   
                            />,

The result looks correct so far:

using the type filter works fine. But when i try to apply one of the location options i get the following error:

An unexpected error occurred: [400] Filters is missing keys for field: location; keys: unit and center

Do I also need to update a Filter somewhere or what is the connection between facets and filters here?

It is most likely something in your filter configuration.

Can you inspect the outbound API request in your browser's network tab, and post the filters you are sending here?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.