List of usage examples for org.apache.solr.handler.extraction ExtractingParams UNKNOWN_FIELD_PREFIX
String UNKNOWN_FIELD_PREFIX
To view the source code for org.apache.solr.handler.extraction ExtractingParams UNKNOWN_FIELD_PREFIX.
Click Source Link
From source file:org.dspace.discovery.SolrServiceImpl.java
License:BSD License
/** * Write the document to the index under the appropriate handle. * * @param doc the solr document to be written to the server * @param streams/*from w w w . java 2 s . c o m*/ * @throws IOException IO exception */ protected void writeDocument(SolrInputDocument doc, List<BitstreamContentStream> streams) throws IOException { try { if (getSolr() != null) { if (CollectionUtils.isNotEmpty(streams)) { ContentStreamUpdateRequest req = new ContentStreamUpdateRequest("/update/extract"); for (BitstreamContentStream bce : streams) { req.addContentStream(bce); } ModifiableSolrParams params = new ModifiableSolrParams(); //req.setParam(ExtractingParams.EXTRACT_ONLY, "true"); for (String name : doc.getFieldNames()) { for (Object val : doc.getFieldValues(name)) { params.add(ExtractingParams.LITERALS_PREFIX + name, val.toString()); } } req.setParams(params); req.setParam(ExtractingParams.UNKNOWN_FIELD_PREFIX, "attr_"); req.setParam(ExtractingParams.MAP_PREFIX + "content", "fulltext"); req.setParam(ExtractingParams.EXTRACT_FORMAT, "text"); req.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true); req.process(getSolr()); } else { getSolr().add(doc); } } } catch (SolrServerException e) { log.error(e.getMessage(), e); } }