}
} else {
moreFields.add(SearchManager.makeField("_hasxlinks", "0", true, true));
}
final Metadata fullMd = _metadataRepository.findOne(id$);
final String schema = fullMd.getDataInfo().getSchemaId();
final String createDate = fullMd.getDataInfo().getCreateDate().getDateAndTime();
final String changeDate = fullMd.getDataInfo().getChangeDate().getDateAndTime();
final String source = fullMd.getSourceInfo().getSourceId();
final MetadataType metadataType = fullMd.getDataInfo().getType();
final String root = fullMd.getDataInfo().getRoot();
final String uuid = fullMd.getUuid();
final String extra = fullMd.getDataInfo().getExtra();
final String isHarvested = String.valueOf(Constants.toYN_EnabledChar(fullMd.getHarvestInfo().isHarvested()));
final String owner = String.valueOf(fullMd.getSourceInfo().getOwner());
final String groupOwner = String.valueOf(fullMd.getSourceInfo().getGroupOwner());
final String popularity = String.valueOf(fullMd.getDataInfo().getPopularity());
final String rating = String.valueOf(fullMd.getDataInfo().getRating());
final String displayOrder = fullMd.getDataInfo().getDisplayOrder() == null ? null : String.valueOf(fullMd.getDataInfo().getDisplayOrder());
if(Log.isDebugEnabled(Geonet.DATA_MANAGER)) {
Log.debug(Geonet.DATA_MANAGER, "record schema (" + schema + ")"); //DEBUG
Log.debug(Geonet.DATA_MANAGER, "record createDate (" + createDate + ")"); //DEBUG
}
moreFields.add(SearchManager.makeField("_root", root, true, true));
moreFields.add(SearchManager.makeField("_schema", schema, true, true));
moreFields.add(SearchManager.makeField("_createDate", createDate, true, true));
moreFields.add(SearchManager.makeField("_changeDate", changeDate, true, true));
moreFields.add(SearchManager.makeField("_source", source, true, true));
moreFields.add(SearchManager.makeField("_isTemplate", metadataType.codeString, true, true));
moreFields.add(SearchManager.makeField("_uuid", uuid, true, true));
moreFields.add(SearchManager.makeField("_isHarvested", isHarvested, true, true));
moreFields.add(SearchManager.makeField("_owner", owner, true, true));
moreFields.add(SearchManager.makeField("_dummy", "0", false, true));
moreFields.add(SearchManager.makeField("_popularity", popularity, true, true));
moreFields.add(SearchManager.makeField("_rating", rating, true, true));
moreFields.add(SearchManager.makeField("_displayOrder",displayOrder, true, false));
moreFields.add(SearchManager.makeField("_extra", extra, true, false));
if (owner != null) {
User user = _applicationContext.getBean(UserRepository.class).findOne(fullMd.getSourceInfo().getOwner());
if (user != null) {
moreFields.add(SearchManager.makeField("_userinfo", user.getUsername() + "|" + user.getSurname() + "|" + user
.getName() + "|" + user.getProfile(), true, false));
}
}
if (groupOwner != null) {
moreFields.add(SearchManager.makeField("_groupOwner", groupOwner, true, true));
}
// get privileges
OperationAllowedRepository operationAllowedRepository = _applicationContext.getBean(OperationAllowedRepository.class);
GroupRepository groupRepository = _applicationContext.getBean(GroupRepository.class);
List<OperationAllowed> operationsAllowed = operationAllowedRepository.findAllById_MetadataId(id$);
for (OperationAllowed operationAllowed : operationsAllowed) {
OperationAllowedId operationAllowedId = operationAllowed.getId();
int groupId = operationAllowedId.getGroupId();
int operationId = operationAllowedId.getOperationId();
moreFields.add(SearchManager.makeField("_op" + operationId, String.valueOf(groupId), true, true));
if(operationId == ReservedOperation.view.getId()) {
Group g = groupRepository.findOne(groupId);
if (g != null) {
moreFields.add(SearchManager.makeField("_groupPublished", g.getName(), true, true));
}
}
}
for (MetadataCategory category : fullMd.getCategories()) {
moreFields.add(SearchManager.makeField("_cat", category.getName(), true, true));
}
final MetadataStatusRepository statusRepository = _applicationContext.getBean(MetadataStatusRepository.class);