Closed ChristianAdamski closed 1 month ago
I downloaded jts-core-1.19.0.jar and placed it in .dev/solr/lib
Documentation now says:
Copy third party Solr modules and libraries jar files here. To load and use them within a collection, add this line to your collection's solrconfig.xml:
<lib dir="/opt/solr/modules/ddev/lib/" regex=".*\.jar" />
How would I do that?
Sorry for all the hassle. I really do not know.
Added the following to SolrConnectorPluginBase.php:alterConfigFiles():
$files['solrconfig.xml'] = preg_replace('/<\/config>/', '<lib dir="/opt/solr/modules/ddev/lib/" regex=".*\.jar" /></config>', $files['solrconfig.xml']);
but uploading config still fails:
2024-05-12 08:46:06.973 INFO (qtp693267461-26-ddev-drupal-solr-22) [c: s: r: x:geometry_shard1_replica_n1 t:ddev-drupal-solr-22] o.a.s.h.a.CoreAdminOperation core create command qt=/admin/cores&collection.configName=geometry_2xxqdt&newCollection=true&collection=geometry&version=2&replicaType=NRT&coreNodeName=core_node2&name=geometry_shard1_replica_n1&action=CREATE&numShards=1&shard=shard1&wt=javabin 2024-05-12 08:46:07.010 INFO (qtp693267461-26-ddev-drupal-solr-22) [c:geometry s:shard1 r:core_node2 x:geometry_shard1_replica_n1 t:ddev-drupal-solr-22] o.a.s.c.SolrResourceLoader Added 101 libs to classloader, from paths: [/opt/solr-9.6.0/modules/analysis-extras/lib, /opt/solr-9.6.0/modules/extraction/lib, /opt/solr-9.6.0/modules/langid/lib, /opt/solr-9.6.0/modules/ltr/lib, /opt/solr/modules/ddev/lib] 2024-05-12 08:46:07.041 INFO (qtp693267461-26-ddev-drupal-solr-22) [c:geometry s:shard1 r:core_node2 x:geometry_shard1_replica_n1 t:ddev-drupal-solr-22] o.a.s.c.SolrConfig Using Lucene MatchVersion: 9.10.0 2024-05-12 08:46:07.042 INFO (qtp693267461-26-ddev-drupal-solr-22) [c:geometry s:shard1 r:core_node2 x:geometry_shard1_replica_n1 t:ddev-drupal-solr-22] o.a.s.u.SolrIndexConfig IndexWriter infoStream solr logging is enabled 2024-05-12 08:46:07.056 INFO (qtp693267461-26-ddev-drupal-solr-22) [c:geometry s:shard1 r:core_node2 x:geometry_shard1_replica_n1 t:ddev-drupal-solr-22] o.a.s.s.IndexSchema Schema name=drupal-4.3.3-solr-9.x-0 2024-05-12 08:46:07.114 ERROR (qtp693267461-26-ddev-drupal-solr-22) [c: s: r: x: t:ddev-drupal-solr-22] o.a.s.s.HttpSolrCall 500 Exception => java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/locationtech/jts/geom/CoordinateSequenceFactory at org.apache.solr.servlet.HttpSolrCall.sendError(HttpSolrCall.java:858) java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/locationtech/jts/geom/CoordinateSequenceFactory
I do notice, with my new line added, 101 libs are loaded, without just 100...
Aha.
https://solr.apache.org/guide/solr/latest/query-guide/spatial-search.html
You must download it (a JAR file) and put that in a special location internal to Solr: SOLR_INSTALL/server/solr-webapp/webapp/WEB-INF/lib/. You can readily download it here: https://mvnrepository.com/artifact/org.locationtech.jts/jts-core/1.17.1. It will not work if placed in other more typical Solr lib directories, unfortunately.
But good news (?)
Simply altering
$jts_arguments = 'spatialContextFactory="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory" autoIndex="true" validationRule="repairBuffer0"';
to
$jts_arguments = 'spatialContextFactory="Geo3D"';
Seems to work!
Didn't you notice that Search API Solr already provides a checkbox for JTS?
OK, it uses the built-in Spatial4j.
So what is the request here? Switching to Geo3D might be a feature request for search_api_solr and has nothing to do with ddv-solr. Or do you want to have jts-core added as lib to ddev-solr?
@ChristianAdamski I want to do the next release of ddev-solr. Do you need jts-core?
My concern is that most Solr hosting providers won't allow that their customers put this lib under that path.
Hey, thanks for the effort. I'm currently just a monkey trying to figure out how the machine works. Specifically, I'm fiddling around with geo stuff when I have some spare time. I will document my findings in this issue.
I very much do not want to recommend any far reaching decissions based on that.
It might happen, as you suggested, that I will recommend a change to search_api_solr to add an option for Geo3D instead of JTS. But I'm not that far yet in my testing around. Not enough time for Open Source...
So thanks for your question, but simply do as you see fit, no need to change anything based on my work here.
Closing in favor of d.o Tickets
As written in another issue, I'm working on geolocation supoprt, specifically geometry.
POINT & LineString work, Polygon does not. Seems to require "JTS". I have understood that being the integration of another library.
Creating a collection fails.
Going through the error log, this is likely caused by:
which then cascades to multiple errors, finally failing as above.
1.) How do I enable "JTS"? 2.) It might be worth checking for this library being present, before trying to upload this config. Alternatively, more helpful error messages..