Support Geo3D Spatial context

Created on 19 May 2024, 12 months ago
Updated 7 June 2024, 11 months ago

So right now Search API Solr supports spatial stuff through "JTS". However, since seemingly at least Solr 7, there seems to be a much simpler out-of-the-box alternative "Geo3D".

I tested this locally with Solr/DDEV altering SolrConnectorPluginBase:alterConfigFiles():line1373+ to

  public function alterConfigFiles(array &$files, string $lucene_match_version, string $server_id = '') {
    if (!empty($this->configuration['jmx']) && version_compare($this->getSolrVersion(), '9.0', '<')) {
      $files['solrconfig_extra.xml'] .= "<jmx />\n";
    }

    if (!empty($this->configuration['jts'])) {
      $jts_arguments = 'spatialContextFactory="Geo3D"';
      $files['schema.xml'] = preg_replace("#\sclass\s*=\s*\"solr\.SpatialRecursivePrefixTreeFieldType\"#ms", "\\0\n        " . $jts_arguments, $files['schema.xml']);
    }
  }

and it just works fine.

Now this is just a hack, but the way forward is not entirely clear to me. "JTS" here should not be a boolean, but instead the spatial support should be an option between the two. Even more so, if possible (and I don't know how), "JTS" should only be available, if the Server actually has Spatial4J library enabled.
And then I'd even go one further and ask, why not enable Geo3D by default? If it's built in?

So tasks I assume:
1.) Add Geo3D support for spatial fields.
1.1.) Decide for default or not.
2.) Alter JTS support to be either/or relative to Geo3D
2.1) Update hook?

Feature request
Status

Needs review

Version

4.3

Component

Code

Created by

🇩🇪Germany christianadamski Berlin, Germany

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024