I am trying to set up the Apache Solr backend for searching products in Django Oscar.So I have followed the documentation provided here:https://django-oscar.readthedocs.io/en/latest/howto/how_to_setup_solr.html.
However after extracting the tar file and putting the required code in the settings.py file.I ran the command
./manage.py build_solr_schema > solr-4.7.2/example/solr/collection1/conf/schema.xml
On the console I got this output:
Save the following output to 'schema.xml' and place it in your Solr configuration directory.
--------------------------------------------------------------------------------------------
So I copied it on top of the existing code in schema.xml.Then ran java -jar start.jar
and I got this error org.xml.sax.SAXParseException: Content is not allowed in prolog
, so I googled it up and found an answer
here ,it seems that there was an extra space inserted after I copied the output from the console to this file, so I just removed it.
Now I ran the same command java -jar start.jar
and I got another error.
3552 [coreLoadExecutor-4-thread-1] ERROR org.apache.solr.core.CoreContainer – Unable to create core: collection1
org.apache.solr.common.SolrException: Schema Parsing Failed: unknown field 'id'. Schema file is /home/netzary/SamuelProjects/cecilia_new2/cecilia/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.<init>(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)
at java.lang.Thread.run(Thread.java:748)
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
3561 [coreLoadExecutor-4-thread-1] ERROR org.apache.solr.core.CoreContainer – null:org.apache.solr.common.SolrException: Unable to create core: collection1
at org.apache.solr.core.CoreContainer.recordAndThrow(CoreContainer.java:989)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:606)
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)
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/netzary/SamuelProjects/cecilia_new2/cecilia/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.<init>(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)
... 8 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
3564 [main] INFO org.apache.solr.servlet.SolrDispatchFilter – user.dir=/home/netzary/SamuelProjects/cecilia_new2/cecilia/solr-4.7.2/example
3565 [main] INFO org.apache.solr.servlet.SolrDispatchFilter – SolrDispatchFilter.init() done
3619 [main] INFO org.eclipse.jetty.server.AbstractConnector – Started SocketConnector@0.0.0.0:8983
I guess it means that there is a field named 'id' which it cannot run?I don't know how to solve this, so I need some help to make this work or are there any other steps that I might be missing?