use of cz.mzk.recordmanager.server.model.DedupRecord in project RecordManager2 by moravianlibrary.
the class SolrInputDocumentFactoryImpl method create.
public List<SolrInputDocument> create(DedupRecord dedupRecord, List<HarvestedRecord> records) {
if (records.isEmpty()) {
return null;
}
List<SolrInputDocument> childs = records.stream().map(rec -> create(rec)).collect(Collectors.toCollection(ArrayList::new));
SolrUtils.sortByWeight(childs);
HarvestedRecord record = records.get(0);
SolrInputDocument mergedDocument = asSolrDocument(mapper.map(dedupRecord, records));
mergedDocument.addField(SolrFieldConstants.ID_FIELD, dedupRecord.getId());
mergedDocument.addField(SolrFieldConstants.MERGED_FIELD, 1);
mergedDocument.addField(SolrFieldConstants.WEIGHT, record.getWeight());
mergedDocument.addField(SolrFieldConstants.LOCAL_IDS_FIELD, getLocalIds(childs));
if (childs.size() > 1)
mergedDocument.addField(SolrFieldConstants.MERGED_RECORDS, 1);
mergedDocument.addField(SolrFieldConstants.INSPIRATION, getInspirations(records));
dedupRecordEnrichers.forEach(enricher -> enricher.enrich(dedupRecord, mergedDocument, childs));
mergedDocument.addChildDocuments(childs);
if (logger.isTraceEnabled()) {
logger.info("Mapping of dedupRecord with id = {} finished", dedupRecord.getId());
}
return Collections.singletonList(mergedDocument);
}
use of cz.mzk.recordmanager.server.model.DedupRecord in project RecordManager2 by moravianlibrary.
the class DedupRecordRowMapper method mapRow.
@Override
public DedupRecord mapRow(ResultSet rs, int rowNum) throws SQLException {
DedupRecord record = new DedupRecord();
record.setId(rs.getLong(columnName));
return record;
}
use of cz.mzk.recordmanager.server.model.DedupRecord in project RecordManager2 by moravianlibrary.
the class DedupRecordDAOTest method test.
@Test
public void test() {
DedupRecord record = new DedupRecord();
dedupRecordDao.persist(record);
}
use of cz.mzk.recordmanager.server.model.DedupRecord in project RecordManager2 by moravianlibrary.
the class KrameriusFulltextWriter method write.
@Override
public void write(List<? extends HarvestedRecord> items) throws Exception {
try {
for (HarvestedRecord hr : items) {
DedupRecord dr = hr.getDedupRecord();
if (dr != null) {
dr.setUpdated(new Date());
dedupDao.persist(dr);
}
recordDao.persist(hr);
}
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations