API Browse filter error

I am browsing my index using these opts:

{
    query:"", 
    attributesToRetrieve: ["file_name"], 
    filters: "(vegetation_type:Upland%20Grassland/Herbaceous%20OR%20vegetation_type:Upland%20Savannah/Shrub%20Steppe)%20AND%20(map_zones:23)"
}

The decoded filters value is:

(vegetation_type:Upland Grassland/Herbaceous OR vegetation_type:Upland Savannah/Shrub Steppe) AND (map_zones:23)

This, when I use these opts to in apisearch.browse(), I get this error message:

filters: Unexpected token ':' expected ')' at col 69

What am I doing wrong here?

THanks
Eric

@ecoffman There should be no need to encore those whitespaces in the JSON object, can you try without %20 and try with quotes instead:

 {
   query:"", 
   attributesToRetrieve: ["file_name"], 
   filters: "(vegetation_type:\"Upland Grassland/Herbaceous\" OR vegetation_type:\"Upland Savannah/Shrub Steppe\") AND map_zones:23"
  }

Let us know how that goes.

1 Like

vvo,

Thanks, that worked. :slight_smile: