[ckan-dev] Spatial search returning too many results

Adrià Mercader adria.mercader at okfn.org
Tue Jun 13 15:33:31 UTC 2017


Hi Mark,

The behaviour that you describe (returning datasets with extents that
intersect with the query extent) is the default one. You can check it on
the demo site as well (note that not the whole of Afghanistan is used as
the query extent and yet the dataset is returned):

http://demo.ckan.org/dataset?q=&sort=score+desc%2C+metadata_modified+desc&ext_bbox=57.30468749999999%2C32.99023555965106%2C63.984375%2C37.43997405227057&ext_prev_extent=55.810546875%2C31.541089879585808%2C65.478515625%2C38.71980474264237

The algorithm used will sort the datasets based on the closeness of the
query extent to the dataset one.

The code for the `solr` backend is in [1] and for the `solr-spatial-field`
one in [2]. If you want, you can customize the queries sent to Solr to use
"contain" rather than "intersect". To do so implement the
IPackageController from your plugin and add the `before_search` method to
tweak the query parameters sent to solr as the spatial extension does.

Hope this helps,

Adrià

[1]
https://github.com/ckan/ckanext-spatial/blob/master/ckanext/spatial/plugin.py#L256
[2]
https://github.com/ckan/ckanext-spatial/blob/master/ckanext/spatial/plugin.py#L258


On 13 June 2017 at 15:57, Mark Winterbottom <Mark.Winterbottom at jisc.ac.uk>
wrote:

> Hello,
>
> I'm not sure if this is a bug or if I have done something wrong in the
> configuration.
>
> I have a CKAN 2.6.2 instance with the latest version of ckanext-spatial
> (installed from the master branch). I am using the solr backend and have
> added the solr fields to the schema as suggested here:
> http://docs.ckan.org/projects/ckanext-spatial/en/latest/
> spatial-search.html. I am also using Solr 6.0.
>
> Here is a URL to the instance:
> http://rdds.researchdata.alpha.jisc.ac.uk
>
> My problem is that when using the map search, it returns all datasets
> where the coordinates overlap the searched area.
>
> I would expect it to return only the datasets with the entire bounding box
> of the dataset falls within the selected area on the map, just like it does
> on the demo site (http://demo.ckan.org/).
>
> Is this the desired behaviour or is something wrong with my instance? Are
> there any details available as to the configuration and plugin versions
> installed on the demo site that I can look it to compare with my own setup?
>
> Thanks in advance,
> Mark
>
>
> *Mark Winterbottom*
>
> Full-Stack Software Engineer
>
> Skype: mark.winterbottom
>
> Jisc is a registered charity (number 1149740) and a company limited by
> guarantee which is registered in England under Company No. 5747339, VAT No.
> GB 197 0632 86. Jisc’s registered office is: One Castlepark, Tower Hill,
> Bristol, BS2 0JA. T 0203 697 5800.
>
> Jisc Services Limited is a wholly owned Jisc subsidiary and a company
> limited by guarantee which is registered in England under company number
> 2881024, VAT number GB 197 0632 86. The registered office is: One Castle
> Park, Tower Hill, Bristol BS2 0JA. T 0203 697 5800.
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20170613/5dfeaa93/attachment-0003.html>


More information about the ckan-dev mailing list