Re-add lost logic to remove fields from the index (take 2)
This commit is contained in:
parent
4a4c36f4e2
commit
c4fd9ce21a
|
@ -264,6 +264,17 @@ class SpatialQuery(SpatialQueryMixin, p.SingletonPlugin):
|
|||
|
||||
pkg_dict['spatial_geom'] = wkt
|
||||
|
||||
# Coupled resources are URL -> uuid links, they are not needed in SOLR
|
||||
# and might be huge if there are lot of coupled resources
|
||||
if pkg_dict.get('coupled-resource'):
|
||||
pkg_dict.pop('coupled-resource', None)
|
||||
pkg_dict.pop('extras_coupled-resource', None)
|
||||
|
||||
# spatial field is geojson coordinate data, not needed in SOLR either
|
||||
if pkg_dict.get('spatial'):
|
||||
pkg_dict.pop('spatial', None)
|
||||
pkg_dict.pop('extras_spatial', None)
|
||||
|
||||
return pkg_dict
|
||||
|
||||
def before_dataset_search(self, search_params):
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pytest
|
||||
|
||||
from ckan.lib.search import SearchError
|
||||
|
@ -88,6 +90,23 @@ class TestBBoxSearch(SpatialTestBase):
|
|||
assert result["count"] == 1
|
||||
assert result["results"][0]["id"] == dataset["id"]
|
||||
|
||||
def test_spatial_polygon_split_across_antimeridian(self):
|
||||
dataset = factories.Dataset(
|
||||
extras=[
|
||||
{
|
||||
"key": "spatial",
|
||||
"value": self.read_file("data/chukot.geojson")
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
result = helpers.call_action(
|
||||
"package_search", extras={"ext_bbox": "175,61,179,64"}
|
||||
)
|
||||
|
||||
assert result["count"] == 1
|
||||
assert result["results"][0]["id"] == dataset["id"]
|
||||
|
||||
def test_spatial_query_nz(self):
|
||||
dataset = factories.Dataset(extras=[{"key": "spatial", "value": extents["nz"]}])
|
||||
|
||||
|
|
Loading…
Reference in New Issue