Index the abstract

This commit is contained in:
coolneng 2021-01-11 19:23:43 +01:00
parent 6a3087cabd
commit a4d505ce06
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
3 changed files with 10 additions and 1 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ data
data-test data-test
target target
output output
.index

View File

@ -85,6 +85,11 @@ public class Indexer {
authorName = authorName.replaceAll("\\p{P}", ""); authorName = authorName.replaceAll("\\p{P}", "");
doc.add(new TextField("authors", authorName, Field.Store.YES)); doc.add(new TextField("authors", authorName, Field.Store.YES));
} }
StringBuilder fullAbstract = new StringBuilder();
for (Abstract abstract_ : paper.abstract_) {
fullAbstract.append(abstract_.text);
}
doc.add(new TextField("abstract", fullAbstract.toString(), Field.Store.NO));
index.addDocument(doc); index.addDocument(doc);
} }

View File

@ -2,6 +2,8 @@ package org.RI.P2;
import java.util.List; import java.util.List;
import com.google.gson.annotations.SerializedName;
class Affiliation { class Affiliation {
String laboratory; String laboratory;
String institution; String institution;
@ -40,6 +42,7 @@ class Body_Text {
public class Paper { public class Paper {
String paper_id; String paper_id;
Metadata metadata; Metadata metadata;
List<Abstract> _abstract; @SerializedName("abstract")
List<Abstract> abstract_;
List<Body_Text> body_text; List<Body_Text> body_text;
} }