Search code examples
solrrdfsolr-schema

SolrException: Document is missing mandatory uniqueKey field: id by Solr using RDF format file


When I was trying to indexing using Solr, I am getting "Document is missing mandatory uniqueKey field: id" exception. I looked at the schema.xml file in the solr folder and found that there is a tag like below,

<field name="id" type="string" indexed="true" stored="true" />
<uniqueKey>id</uniqueKey>

I looked at my rdf file and trying to look for any id field defined there, but unfortunately there is no id field. I am not sure what is the unique field in RDF format file so that I can replace the field name "id" to the one uniquely present in the rdf file.

Any help please?


Solution

  • It looks like you're new to rdf so I highly recommend you check out the W3C RDF Primer here. However in the meantime you must understand that every rdf resource is given in the form "triples". Each of these resources is identified with an unique URI. Usually this identifier looks like <rdf:Description rdf:about="some URI" > *Resource triples* </rdf:Description>
    The long and the short being that the unique id you are looking for is given by these URI's.
    Note: it does get a bit more complicated when dealing with blank nodes, hence please do look at the rdf primer.