question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error - Rebuild search index with django-oscar and Solr

See original GitHub issue

I’m following the django-oscar documentation to integrate solr with django-Oscar.It raises the following error when trying to rebuild the index.How can I fix this issue?

$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.

[schema.zip](https://github.com/django-oscar/django-oscar/files/1795821/schema.zip)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
asanka-Jcommented, May 23, 2018

Thanks for the feedback @solarissmoke

@MR612 and @SalahAdDin I couldn’t really find any other solution. schema.zip

Instead of building schema, use the above schema.xml and modify if you need any additional field elements.

1reaction
TheRockXucommented, Jul 8, 2018

Solr 4.7 requires that fields to be enclosed in the fields tag and the types in the types tag. But the build_solr_schema generator doesnt do so. I had to tweak around solr 4.8 to get it to work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error - Rebuild search index with django-oscar and Solr
I'm following the django documentation to integrate solr with django-Oscar.I'm getting the following error when trying to rebuild the index.
Read more >
Error - Rebuild search index with django-oscar and Solr-django
I had a similar issue. Upon inspecting the solr schema ( conf/schema.xml ) file I found that <field name="id"> line was repeated (not...
Read more >
Error - Solr Rebuild search index with django-oscar
I'm following the django documentation to integrate solr with django-Oscar.I'm getting the following error when trying to rebuild the index.
Read more >
How to setup Solr with Oscar — django-oscar 3.0 documentation
Rebuild search index ​​ The products being indexed twice is caused by a low-priority bug in Oscar and can be safely ignored. If...
Read more >
Solr Error When Rebuild xDB Search Index
You will need to go custom on that one. Check this answer on some of your options to avoid Solr rejecting to index...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found