我是solr apache的新手,我正在尝试基于这个平台构建一个搜索引擎。我上传了所有文件,但它继续给我这样的错误,我不知道发生了什么。此错误带来其他错误,如CoreContainer无法创建核心文件,我无法执行查询搜索。你能帮帮我们吗?
org.apache.solr.common.SolrException: _version_ field must exist in schema and be searchable (indexed or docValues) and retrievable(stored or docValues) and not multiValued (_version_ does not exist)
at org.apache.solr.update.VersionInfo.getAndCheckVersionField(VersionInfo.java:68)
at org.apache.solr.update.VersionInfo.<init>(VersionInfo.java:94)
at org.apache.solr.update.UpdateLog.init(UpdateLog.java:308)
at org.apache.solr.update.UpdateHandler.<init>(UpdateHandler.java:137)
at org.apache.solr.update.UpdateHandler.<init>(UpdateHandler.java:94)
at org.apache.solr.update.DirectUpdateHandler2.<init>(DirectUpdateHandler2.java:102)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:706)
at org.apache.solr.core.SolrCore.createUpdateHandler(SolrCore.java:768)
at org.apache.solr.core.SolrCore.initUpdateHandler(SolrCore.java:1009)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:874)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:776)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:842)
at org.apache.solr.core.CoreContainer.lambda$load$0(CoreContainer.java:498)
at org.apache.solr.core.CoreContainer$$Lambda$24/135640095.call(Unknown Source)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:229)
at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor$$Lambda$25/328827614.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
这些是我在schema.xml中的字段构建
<field name="_version_" type="long" indexed="true" stored="true"/>
<field name="id" type="string" indexed="true" stored="true" required="true"/>
<field name="title" type="string" indexed="true" stored="true"/>
<field name="revision" type="int" indexed="true" stored="false"/>
<field name="user" type="string" indexed="true" stored="false"/>
<field name="userId" type="int" indexed="true" stored="false"/>
<field name="text" type="text_en" indexed="true" stored="true"/>
<uniqueKey> id </uniqueKey>
答案 0 :(得分:0)
首先下载与架构关联的最新配置集可以使用以下命令下载最新配置集:solr zk -downconfig -d目录下载-n配置集名称-z ip:portkeeper端口
例如:solr zk -downconfig -d C:\ solr \ workingConfig -n configsetName -z localhost:2181
在schema.xml中进行必要的更改 添加版本(如果它不存在)
然后使用以下命令将最新的配置集上传到zookeeper。
solr zk -upconfig -d目录上传-n configset name -z ip:portkeeper的端口例如:solr zk -upconfig -d C:\ solr \ workingConfig -n configsetName -z localhost:2181
然后,您需要重新加载架构,以便更改立即生效。
可以使用以下命令重新加载架构:http://ip:port/solr/admin/collections?action=RELOAD&name=
然后尝试添加文档