Index authors' institutions

This commit is contained in:
coolneng 2021-01-11 19:58:17 +01:00
parent 9dbfe1ccc4
commit b1d6afb7fe
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 6 additions and 3 deletions

View File

@ -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);

View File

@ -43,6 +43,6 @@ public class Paper {
String paper_id;
Metadata metadata;
@SerializedName("abstract")
List<Abstract> abstract_;
List<Abstract> abstr;
List<Body_Text> body_text;
}