From 7e56aae1a28a7f6e77c70d0765144188031edc58 Mon Sep 17 00:00:00 2001 From: coolneng Date: Mon, 11 Jan 2021 20:09:47 +0100 Subject: [PATCH] Index authors' emails --- src/main/java/org/RI/P2/Indexer.java | 6 ++++++ src/main/java/org/RI/P2/Paper.java | 8 -------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/RI/P2/Indexer.java b/src/main/java/org/RI/P2/Indexer.java index 0195158..b00d5be 100644 --- a/src/main/java/org/RI/P2/Indexer.java +++ b/src/main/java/org/RI/P2/Indexer.java @@ -47,9 +47,12 @@ public class Indexer { PerFieldAnalyzerWrapper createAnalyzer() { Map analyzerPerField = new HashMap<>(); + analyzerPerField.put("document_id", new StandardAnalyzer()); analyzerPerField.put("title", new EnglishAnalyzer()); analyzerPerField.put("abstract", new EnglishAnalyzer()); analyzerPerField.put("authors", new StandardAnalyzer()); + analyzerPerField.put("institutions", new StandardAnalyzer()); + analyzerPerField.put("emails", new StandardAnalyzer()); PerFieldAnalyzerWrapper customAnalyzer = new PerFieldAnalyzerWrapper(new WhitespaceAnalyzer(), analyzerPerField); return customAnalyzer; @@ -82,14 +85,17 @@ public class Indexer { doc.add(new TextField("title", paper.metadata.title, Field.Store.YES)); StringBuilder authors = new StringBuilder(); StringBuilder institutions = new StringBuilder(); + StringBuilder emails = 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); + emails.append(author.email); } doc.add(new TextField("authors", authors.toString(), Field.Store.YES)); doc.add(new TextField("institution", institutions.toString(), Field.Store.NO)); + doc.add(new TextField("emails", emails.toString(), Field.Store.NO)); StringBuilder fullAbstract = new StringBuilder(); for (Abstract abstr : paper.abstr) { fullAbstract.append(abstr.text); diff --git a/src/main/java/org/RI/P2/Paper.java b/src/main/java/org/RI/P2/Paper.java index d5fa1dd..9ee1d62 100644 --- a/src/main/java/org/RI/P2/Paper.java +++ b/src/main/java/org/RI/P2/Paper.java @@ -9,20 +9,12 @@ class Affiliation { String institution; } -class Location { - String postCode; - String settlement; - String region; - String country; -} - class Author { String first; List middle; String last; String suffix; Affiliation affiliation; - Location location; String email; }