Document ckanext.spatial.solr_query

This commit is contained in:
amercader 2022-10-11 15:13:39 +02:00
parent 03ad3ef31c
commit 6c48fdd32d
2 changed files with 6 additions and 3 deletions

View File

@ -196,7 +196,7 @@ you need to split the geometry in order to fit the parts. Not indexing"""
if not search_params.get("fq_list"):
search_params["fq_list"] = []
default_spatial_query = "{{!field f={spatial_field}}}Intersects(ENVELOPE({minx}, {maxx}, {maxy}, {miny}))"
default_spatial_query = "{{!field f=spatial_geom}}Intersects(ENVELOPE({minx}, {maxx}, {maxy}, {miny}))"
spatial_query = config.get("ckanext.spatial.solr_query", default_spatial_query)

View File

@ -148,7 +148,7 @@ details about the available options (again, you don't need to modify Solr if you
* ``solr-spatial-field``
This option uses the `RPT <https://solr.apache.org/guide/8_11/spatial-search.html#rpt>`_ Solr field, which allows
to index points, rectangles and more complex geometries like polygons. This requires the install of the `JTS`_ library. See the linked Solr documentation for details on this. Note that it does not support spatial sorting of the returned results.
to index points, rectangles and more complex geometries like polygons. This requires the install of the `JTS`_ library. See the linked Solr documentation for details on this. Note that it does not support spatial sorting of the returned results.
You will need to add the following field type and field to your Solr
schema file to enable it ::
@ -168,6 +168,9 @@ details about the available options (again, you don't need to modify Solr if you
<field name="spatial_geom" type="location_rpt" indexed="true" multiValued="true" />
</fields>
By default, the ``solr-sptatial-field`` backend uses the following query. This can be customized by setting the ``ckanext.spatial.solr_query`` configuration option, but note that all placeholders must be included::
"{{!field f=spatial_geom}}Intersects(ENVELOPE({minx}, {maxx}, {maxy}, {miny}))"
.. note:: The old ``postgis`` search backend is deprecated and will be removed in future versions of the extension.
You should migrate to one of the other backends instead but if you need to keep using it for a while see :ref:`legacy_postgis`.
@ -258,5 +261,5 @@ For adding the map to the main body, add this to the main dataset page template
You need to load the ``spatial_metadata`` plugin to use these snippets.
.. _action API: http://docs.ckan.org/en/latest/apiv3.html
.. _JTS: https://github.com/locationtech/jts
.. _JTS: https://github.com/locationtech/jts
.. _GeoJSON: http://geojson.org