There isn't any parameter for /update/extra named "attachmentid".
You probably wanted to use the "literal.*" parameter to set a field to a
literal value, such as:
litereral.attachmentid=fileid_123
-- Jack Krupansky
-----Original Message-----
From: adammyatt
Sent: Friday, August 09, 2013 11:05 PM
To: solr-user@lucene.apache.org
Subject: Problem with UniqueKey When Using ContentStreamUpdateRequest
Using Solr 4.3.1 with SolrJ...
In my schema xml I have defined :
<field name="attachmentid" type="string" indexed="true" stored="true"
required="true" multiValued="false" />
and farther down
<uniqueKey>attachmentid</uniqueKey>
Then following all the examples of ContentStreamUpdateRequest online I am
trying to index a file using :
File file = new File("c:\\solr\\indexme.pdf");
ContentStreamUpdateRequest csur = new
ContentStreamUpdateRequest("/update/extract");
csur.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
csur.addFile(file, "application/octet-stream");
csur.setPram("attachmentid", "fileid_" + i); // where i is a unique number
solrCore.request(csur);
solrCore.commit();
QueryResponse rsp = solrCore.query(new SolrQuery("*:*"));
System.out.println(rsp);
When I run this it connects fine to the Solr server but get this Java
exception :
HttpSolrServer$RemoteSolrException: Document is missing mandatory uniqueKey
field: attachmentid
If I look in the log file for solr server I see the request made it there as
this shows up :
webapp=/solr path=/update/extract params={attachmentid=fileid_0
&wt=javabin&version=2} {} 0 817
5687 [qtp533789436-16] ERROR org.apache.solr.core.SolrCore รป
org.apache.solr.co
mmon.SolrException: Document is missing mandatory uniqueKey field:
attachmentid
Based on the log statement above it looks like my uniqueKey "attachmentid"
is getting passed. Since it is defined in my schema.xml I'm at a loss why
this doesn't seem to work?
--
View this message in context:
http://lucene.472066.n3.nabble.com/Problem-with-UniqueKey-When-Using-ContentStreamUpdateRequest-tp4083684.html
Sent from the Solr - User mailing list archive at Nabble.com.