diff --git a/src/main/java/org/RI/P2/Indexer.java b/src/main/java/org/RI/P2/Indexer.java index 3d2af20..0e66c72 100644 --- a/src/main/java/org/RI/P2/Indexer.java +++ b/src/main/java/org/RI/P2/Indexer.java @@ -80,11 +80,13 @@ public class Indexer { Document doc = new Document(); 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(); for (Author author : paper.metadata.authors) { String authorName = author.first + " " + author.middle + " " + author.last; authorName = authorName.replaceAll("\\p{P}", ""); - doc.add(new TextField("authors", authorName, Field.Store.YES)); + authors.append(authorName); } + doc.add(new TextField("authors", authors.toString(), Field.Store.YES)); StringBuilder fullAbstract = new StringBuilder(); for (Abstract abstract_ : paper.abstract_) { fullAbstract.append(abstract_.text); @@ -102,7 +104,9 @@ public class Indexer { createIndex(); for (File file : files) { Paper paper = parseJSONFile(file); - addDocument(paper); + if (paper != null) { + addDocument(paper); + } } commitChanges(); }