Can I make location[within] return also entries with no location defined

Hi,

I have one content type of service that can be of type digital or physical.

If it’s physical it will have a location field value, but if it’s digital the the value for that field is null.

I would like a query like location[within]=lat,long,radius to return services in that radius, but also services where the location is null.

Is there a way to get this without using 2 queries?

Thanks

Hi Jose,

Because you’re already using a value for the location parameter, you’d have to send a separate query to get the items that don’t have a location value.

To do that, you can use the existence parameter, as described in the following section of our documentation:

https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/existence

1 Like