我正在遵循django文档将solr与Django-Oscar集成。我在尝试重建索引时遇到以下错误。我如何解决这个问题?
$python3 manage.py rebuild_index --noinput Removing all documents from your index because you said so. Failed to clear Solr index: Solr responded with an error (HTTP 500): [Reason: Error 500 {msg=SolrCore 'collection1' is not available due to init failure: Schema Parsing Failed: unknown field 'id'. Schema file is /project/solr-4.7.2/example/solr/collection1/schema.xml,trace=org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init failure: Schema Parsing Failed: unknown field 'id'. Schema file is /project/solr-4.7.2/example/solr/collection1/schema.xml at org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:827) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:305) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:205) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:368) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489) at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53) at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:953) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1014) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:861) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72) at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.solr.common.SolrException: Schema Parsing Failed: unknown field 'id'. Schema file is /project/solr-4.7.2/example/solr/collection1/schema.xml at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:618) at org.apache.solr.schema.IndexSchema.(IndexSchema.java:166) at org.apache.solr.schema.IndexSchemaFactory.create(IndexSchemaFactory.java:55) at org.apache.solr.schema.IndexSchemaFactory.buildIndexSchema(IndexSchemaFactory.java:69) at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:559) at org.apache.solr.core.CoreContainer.create(CoreContainer.java:597) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:258) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:250) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ... 1 more Caused by: java.lang.RuntimeException: unknown field 'id' at org.apache.solr.schema.IndexSchema.getIndexedField(IndexSchema.java:340) at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:536) ... 13 more ,code=500}] Traceback (most recent call last): File "/home/asanka/.local/lib/python3.5/site-packages/haystack/backends/solr_backend.py", line 105, in clear self.conn.delete(q='*:*', commit=commit) File "/home/asanka/.local/lib/python3.5/site-packages/pysolr.py", line 948, in delete return self._update(m, commit=commit, softCommit=softCommit, waitFlush=waitFlush, waitSearcher=waitSearcher, handler=handler) File "/home/asanka/.local/lib/python3.5/site-packages/pysolr.py", line 488, in _update return self._send_request('post', path, message, {'Content-type': 'text/xml; charset=utf-8'}) File "/home/asanka/.local/lib/python3.5/site-packages/pysolr.py", line 403, in _send_request raise SolrError(error_message % (resp.status_code, solr_message)) pysolr.SolrError: Solr responded with an error (HTTP 500): [Reason: Error 500 {msg=SolrCore 'collection1' is not available due to init failure: Schema Parsing Failed: unknown field 'id'. Schema file is /home/asanka/Music/devBranch/dailyDeal_v3/main_app/solr-4.7.2/example/solr/collection1/schema.xml,trace=org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init failure: Schema Parsing Failed: unknown field 'id'. Schema file is /home/asanka/Music/devBranch/dailyDeal_v3/main_app/solr-4.7.2/example/solr/collection1/schema.xml at org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:827) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:305) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:205) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:368) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489) at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53) at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:953) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1014) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:861) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72) at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.solr.common.SolrException: Schema Parsing Failed: unknown field 'id'. Schema file is /home/asanka/Music/devBranch/dailyDeal_v3/main_app/solr-4.7.2/example/solr/collection1/schema.xml at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:618) at org.apache.solr.schema.IndexSchema.(IndexSchema.java:166) at org.apache.solr.schema.IndexSchemaFactory.create(IndexSchemaFactory.java:55) at org.apache.solr.schema.IndexSchemaFactory.buildIndexSchema(IndexSchemaFactory.java:69) at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:559) at org.apache.solr.core.CoreContainer.create(CoreContainer.java:597) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:258) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:250) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ... 1 more Caused by: java.lang.RuntimeException: unknown field 'id' at org.apache.solr.schema.IndexSchema.getIndexedField(IndexSchema.java:340) at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:536) ... 13 more ,code=500}] All documents removed.
我也有类似的问题。在检查solr模式(conf/schema.xml
)文件时,我发现
行重复(不完全重复,但对于相同的name
参数肯定是重复的)。
我删除了
的第二个实例,问题已经解决。
我最终将solr
以及最新的haystack
升级到6.6.3,现在build_schema
可以正常工作。
当我跑的时候 我得到以下错误: 我试着改变我的ElasticSearch的版本。我的当前版本是: $curl-xget'localhost:9200'{“name”:“mokbeeq”,“cluster_name”:“elasticsearch”,“cluster_uuid”:“pf_z62bbtl-jq31hsuahqa”,“version”:{“number”:“5.6.8”,“build_h
我想我可能在haystack/solr中发现了一个bug,但我不确定,我想先看看我是否做了一些完全错误的事情。我正在使用: django 1.8 haystack 2.4.1 solr 4.10.4 当我尝试筛选SearchQuerySet时,SOLR抱怨从haystack生成的筛选查询语法无效。奇怪的是,在pdb中单步执行代码是可行的,但在正常情况下都会失败。守则的有关部分如下: 执行此查询时,
问题内容: 我的团队正在与使用solr作为搜索索引的第三方CMS合作。我注意到,似乎作者使用Solr作为各种数据库,因为返回的每个文档都包含两个字段: Solr文档ID(基本上是类名和数据库ID) 整个对象的XML表示形式 因此,基本上,它针对Solr运行搜索,下载对象的XML表示,然后从XML实例化对象,而不是使用id在数据库中查找对象。 我的直觉告诉我这是一个不好的做法。Solr是一个搜索索引
我开始了Django-haystack和弹性搜索的实验。 使用: models.py 我想为上述模型创建一个搜索索引: 是否可以使用多个模型创建搜索索引。或者我必须为多个模型创建多个搜索索引。 注:两种型号完全独立。
本文向大家介绍solr范围搜索,包括了solr范围搜索的使用技巧和注意事项,需要的朋友参考一下 示例 age:[50 TO 60] 匹配年龄在50和60之间(包括50和60)的文档 age:{50 TO 60} 匹配年龄在50到60之间(不包括50到60)的文档 age:[* TO 60] 匹配年龄小于或等于60的文档 age:[50 TO *] 匹配年龄大于或等于50的文档 age:{50 to
本文向大家介绍solr 布尔搜索,包括了solr 布尔搜索的使用技巧和注意事项,需要的朋友参考一下 示例 +firstname:john +surname:doe 匹配名字为john且姓氏为doe的文档。+前缀表示搜索词必须出现(AND)。 +firstname:john -surname:doe 匹配名字为john而名字不是doe的文档。-前缀表示不得出现搜索词(否)。 +firstname:j