I have an entity, which I want to link to an indexed file uploaded to solr via SolrJ. Preferably it would be a field on the entity with the file's entry id as value. Thing is - I don't know how to get that id after it just being uploaded. Here is the code:
//File tempFile;
//MultipartFile file;
tempFile = File.createTempFile(prefix, postfix);
file.transferTo(tempFile);
ContentStreamUpdateRequest req = new ContentStreamUpdateRequest("/update/extract");
req.addFile(tempFile, file.getContentType());
req.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
NamedList list = solrClient.request(req);
System.out.println(list);
//{responseHeader={status=0,QTime=1328}}
tempFile.delete();
The solution was to create id myself and set it like this:
req.setParam("literal.id", UUID.randomUUID().toString());