Skip to content

Commit

Permalink
Merge pull request ckan#306 from ckan/handle-missing-geometry
Browse files Browse the repository at this point in the history
TypeError when spatial is missing
  • Loading branch information
amercader authored Apr 11, 2023
2 parents 944ae4d + d5cee0b commit 1205d3a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ckanext/spatial/search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def index_dataset(self, dataset_dict):
"""

geom_from_metadata = dataset_dict.get("spatial")
if not geom_from_metadata:
return dataset_dict

geometry = self.parse_geojson(geom_from_metadata)
shape = self.shape_from_geometry(geometry)

Expand Down Expand Up @@ -130,6 +133,9 @@ class SolrSpatialFieldSearchBackend(SpatialSearchBackend):
def index_dataset(self, dataset_dict):
wkt = None
geom_from_metadata = dataset_dict.get("spatial")
if not geom_from_metadata:
return dataset_dict

geometry = self.parse_geojson(geom_from_metadata)
if not geometry:
return dataset_dict
Expand Down

0 comments on commit 1205d3a

Please sign in to comment.