简体   繁体   中英

java.lang.ClassNotFoundException: solr.LatLonType when starting solr with a schema from django build_solr_schema

I want to connect a search functionality to Django. I use django-haystack and solr. with a newly created Solr core I get the following error when starting Solr with a new schema.xml generated from python manage.py build_solr_schema

Caused by: java.lang.ClassNotFoundException: solr.LatLonType
        at java.net.URLClassLoader.findClass(URLClassLoader.java:445) ~[?:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:588) ~[?:?]
        at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:872) ~[?:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
        at java.lang.Class.forName0(Native Method) ~[?:?]
        at java.lang.Class.forName(Class.java:488) ~[?:?]
        at java.lang.Class.forName(Class.java:467) ~[?:?]
        at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:527) ~[?:?]
        at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:604) ~[?:?]
        at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:598) ~[?:?]
        at org.apache.solr.schema.FieldTypePluginLoader.create(FieldTypePluginLoader.java:74) ~[?:?]
        at org.apache.solr.schema.FieldTypePluginLoader.create(FieldTypePluginLoader.java:43) ~[?:?]
        at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:144) ~[?:?]
        at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:531) ~[?:?]
        at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:188) ~[?:?]
        at org.apache.solr.schema.ManagedIndexSchema.<init>(ManagedIndexSchema.java:119) ~[?:?]
        at org.apache.solr.schema.ManagedIndexSchemaFactory.create(ManagedIndexSchemaFactory.java:279) ~[?:?]
        at org.apache.solr.schema.ManagedIndexSchemaFactory.create(ManagedIndexSchemaFactory.java:51) ~[?:?]
        at org.apache.solr.core.ConfigSetService.createIndexSchema(ConfigSetService.java:342) ~[?:?]
        at org.apache.solr.core.ConfigSetService.lambda$loadConfigSet$0(ConfigSetService.java:253) ~[?:?]
        at org.apache.solr.core.ConfigSet.<init>(ConfigSet.java:49) ~[?:?]
        at org.apache.solr.core.ConfigSetService.loadConfigSet(ConfigSetService.java:249) ~[?:?]
        at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1550) ~[?:?]
        at org.apache.solr.core.CoreContainer.lambda$load$10(CoreContainer.java:950) ~[?:?]

how can i fix my schema.xml?

apache solr 9.0 django 4.0

The LatLonType has been deprecated since Solr 7 and has now been removed in Solr 9.

Use LatLonPointSpatialField instead.

<fieldType name="location" class="solr.LatLonPointSpatialField" docValues="true"/>

LLPSF supports toggling indexed, stored, docValues, and multiValued. LLPSF internally uses a 2-dimensional Lucene "Points" (BDK tree) index when "indexed" is enabled (the default). When "docValues" is enabled, a latitude and longitudes pair are bit-interleaved into 64 bits and put into Lucene DocValues. The accuracy of the docValues data is about a centimeter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM