From b1d6afb7feb7ca48c1704f0b9094d9e231c5f7f8 Mon Sep 17 00:00:00 2001 From: coolneng Date: Mon, 11 Jan 2021 19:58:17 +0100 Subject: [PATCH] Index authors' institutions --- src/main/java/org/RI/P2/Indexer.java | 7 +++++-- src/main/java/org/RI/P2/Paper.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/RI/P2/Indexer.java b/src/main/java/org/RI/P2/Indexer.java index 0e66c72..0195158 100644 --- a/src/main/java/org/RI/P2/Indexer.java +++ b/src/main/java/org/RI/P2/Indexer.java @@ -81,15 +81,18 @@ public class Indexer { doc.add(new StringField("document_id", paper.paper_id, Field.Store.YES)); doc.add(new TextField("title", paper.metadata.title, Field.Store.YES)); StringBuilder authors = new StringBuilder(); + StringBuilder institutions = new StringBuilder(); for (Author author : paper.metadata.authors) { String authorName = author.first + " " + author.middle + " " + author.last; authorName = authorName.replaceAll("\\p{P}", ""); authors.append(authorName); + institutions.append(author.affiliation.institution); } doc.add(new TextField("authors", authors.toString(), Field.Store.YES)); + doc.add(new TextField("institution", institutions.toString(), Field.Store.NO)); StringBuilder fullAbstract = new StringBuilder(); - for (Abstract abstract_ : paper.abstract_) { - fullAbstract.append(abstract_.text); + for (Abstract abstr : paper.abstr) { + fullAbstract.append(abstr.text); } doc.add(new TextField("abstract", fullAbstract.toString(), Field.Store.NO)); index.addDocument(doc); diff --git a/src/main/java/org/RI/P2/Paper.java b/src/main/java/org/RI/P2/Paper.java index a6c01ae..d5fa1dd 100644 --- a/src/main/java/org/RI/P2/Paper.java +++ b/src/main/java/org/RI/P2/Paper.java @@ -43,6 +43,6 @@ public class Paper { String paper_id; Metadata metadata; @SerializedName("abstract") - List abstract_; + List abstr; List body_text; }