private static String format(Writable key, DocumentWrapper documentWrapper) { StringBuilder sb = new StringBuilder(); sb.append("-------------------------------------------\n"); sb.append("key : ").append(key).append("\n"); sb.append("rowid : ").append(documentWrapper.getRowId()).append("\n"); sb.append("title0 : ").append(DocumentWrapperUtils.getMainTitle(documentWrapper.getDocumentMetadata())).append("\n"); sb.append("year : ").append(DocumentWrapperUtils.getPublicationYear(documentWrapper)).append("\n"); for (Author author : documentWrapper.getDocumentMetadata().getBasicMetadata().getAuthorList()) { sb.append(author.getPositionNumber()).append(". ").append(author.getName()).append(" ").append(author.getSurname()).append("\n"); } sb.append("\n"); return sb.toString(); }
positionsCorrect = false; } else { int authorPosition = author.getPositionNumber() - 1; if (authorPosition < 0 || authorPosition >= resultByPositionNb.length || resultByPositionNb[authorPosition] != null) { positionsCorrect = false;
private void convertPosition(Author contribution, SolrInputDocument doc) { doc.setField(SolrIndexConstants.CONTRIBUTION_POSITION_FIELD_NAME, contribution.getPositionNumber()); }
private void convertId(Author contribution, SolrInputDocument doc) { String id = contribution.getDocId() + "_" + contribution.getPositionNumber(); doc.setField(SolrIndexConstants.CONTRIBUTION_ID_FIELD_NAME, id); }
/** * Returns the author of the publication that is on the given authorPosition. * Returns null if there is no author on the authorPosition. */ public static Author getAuthor(DocumentWrapper documentWrapper, int authorPosition) { List<Author> authors = getAuthors(documentWrapper); for (Author author : authors) { if (author.getPositionNumber()==authorPosition) { return author; } } return null; }