Dear Stefan, Am still getting the following error message even after including the pk-Attribute to the query :
WARNING: Error creating document : SolrInputDocument[{lname=lname(1.0)={cindy}, file=file(1.0)={ http://localhost:8084/Access/UploadFiles/laura.mp3}, fname=fname(1.0)={troutman}}] org.apache.solr.common.SolrException: Document [null] missing required field: id at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:305) at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:60) at org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:75) at org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:292) at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:392) at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:242) at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:180) at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:331) at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:389) at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:370) and here is the data-config.xml file : <dataConfig> <dataSource driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/mp3" user="root" password="root" /> <document> <entity name="file" pk="fileNo" query="select fname, lname, file, fileNo from mp3.file"> <field column="fname" name="fname" /> <field column="lname" name="lname" /> <field column="file" name="file" /> </entity> </document> </dataConfig> Regards, Serenity On Tue, May 3, 2011 at 10:43 AM, Stefan Matheis < matheis.ste...@googlemail.com> wrote: > Serenity, > > there is no field fileNo in your SELECT-Query? you've defined it in > the pk-Attribut of the <entity> Tag, but it's also required in the > Query itself. just to note it: you can skip your <field> definition, > if the query returns the field with exactly the same name as the > solr-schema requires it. > > Regards > Stefan > > On Tue, May 3, 2011 at 5:38 PM, serenity keningston > <serenity.kenings...@gmail.com> wrote: > > Hello Friends, > > > > > > I am new to Solr and experiencing issue while trying to use > > DataImportHandler. I added the required fields to schema.xml file and > here > > is my data-config.xml file : > > > > <dataConfig> > > <dataSource driver="com.mysql.jdbc.Driver" > > url="jdbc:mysql://localhost:3306/mp3" > > user="root" > > password="root" /> > > <document> > > <entity name="file" pk="fileNo" query="select fname, lname, file from > > mp3.file"> > > <field column="fileNo" name="id"/> > > <field column="fname" name="fname" /> > > <field column="lname" name="lname" /> > > <field column="file" name="file" /> > > </entity> > > </document> > > </dataConfig> > > > > I am getting the following errors : > > > > org.apache.solr.common.SolrException: Document [null] missing required > > field: id > > > > solr home defaulted to 'solr/' (could not find system property or JNDI) > > May 3, 2011 9:59:08 AM org.apache.solr.core.SolrResourceLoader <init> > > INFO: Solr home set to 'solr/' > > > > DataImportHandler can extract the information from the database and it is > > displayed in log file, however, it is not indexing the data. Can anyone > > please let me know, where I am commiting mistake ? > > > > Regards, > > Serenity > > >