recordTypes) {
article.setAuthors(parts[1].split("::")[1]);
article.setKeywords(parts[2].split("::")[1]);
article.setBody(parts[3].split("::")[1]);
+ article.setPublisher(parts[4].split("::")[1]);
+ article.setDate(parts[5].split("::")[1]);
+ article.setType(parts[6].split("::")[1]);
article.setDc(parsedDc.getDc());
articles.add(article);
@@ -183,98 +183,9 @@ private LocalDateTime parseDateTime(String string) {
}
-
- public String search(String q) throws IOException {
-
- SearchRequest searchRequest = new SearchRequest("harvester");
- SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
- searchSourceBuilder.query(QueryBuilders.termQuery("dc",q));
- searchSourceBuilder.sort(new FieldSortBuilder("title.keyword").order(SortOrder.DESC));
- searchSourceBuilder.fetchSource("title","");
- searchRequest.source(searchSourceBuilder);
- SearchResponse searchResponse = restClient.search(searchRequest);
- String result = searchResponse.toString();
-
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- JsonParser jp = new JsonParser();
- JsonElement je = jp.parse(result);
- String prettyJsonString = gson.toJson(je);
-
- System.out.println(prettyJsonString);
-
- return ""+prettyJsonString+"
"; //pre tag for json, otherwise it didnt show pretty in browser
-
- }
-
- public String searchForm(String q) throws IOException {
-
- SearchRequest searchRequest = new SearchRequest("harvester");
- SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
- searchSourceBuilder.query(QueryBuilders.termQuery("dc",q));
- searchSourceBuilder.sort(new FieldSortBuilder("title.keyword").order(SortOrder.DESC));
- searchSourceBuilder.fetchSource("title","");
- searchRequest.source(searchSourceBuilder);
- SearchResponse searchResponse = restClient.search(searchRequest);
- String result = searchResponse.toString();
-
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- JsonParser jp = new JsonParser();
- JsonElement je = jp.parse(result);
- String prettyJsonString = gson.toJson(je);
-
- System.out.println(prettyJsonString);
-
- return prettyJsonString; //pre tag for json, otherwise it didnt show pretty in browser
-
- }
-
- public String getAll() throws IOException {
-
-
- final Scroll scroll = new Scroll(TimeValue.timeValueMinutes(1L));
-
- SearchRequest searchRequest = new SearchRequest("harvester");
- searchRequest.scroll(scroll);
- SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
- searchSourceBuilder.query(QueryBuilders.matchAllQuery());
- searchRequest.source(searchSourceBuilder);
-
- SearchResponse searchResponse = restClient.search(searchRequest);
- String scrollId = searchResponse.getScrollId();
- SearchHit[] searchHits = searchResponse.getHits().getHits();
- String result="";
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- JsonParser jp = new JsonParser();
- JsonElement je ;
- String prettyJsonString ;
- while (searchHits != null && searchHits.length > 0) {
- SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId);
- scrollRequest.scroll(scroll);
- searchResponse = restClient.searchScroll(scrollRequest);
- scrollId = searchResponse.getScrollId();
- searchHits = searchResponse.getHits().getHits();
-
-
- je = jp.parse(searchResponse.toString());
- prettyJsonString = gson.toJson(je);
- result+=prettyJsonString;
-
-
-
- }
-
- ClearScrollRequest clearScrollRequest = new ClearScrollRequest();
- clearScrollRequest.addScrollId(scrollId);
- ClearScrollResponse clearScrollResponse = restClient.clearScroll(clearScrollRequest);
- boolean succeeded = clearScrollResponse.isSucceeded();
-
-
- return ""+result+"
"; //pre tag for json, otherwise it didnt show pretty in browser
- }
-
public void delete() throws IOException {
-
+ //TODO:check if there is any indices with that name
DeleteIndexRequest request = new DeleteIndexRequest("harvester");
restClient.indices().deleteIndex(request);
diff --git a/src/main/java/io/academic/service/ProcessorService.java b/src/main/java/io/academic/service/ProcessorService.java
index 6a2ca86..bd66d5c 100644
--- a/src/main/java/io/academic/service/ProcessorService.java
+++ b/src/main/java/io/academic/service/ProcessorService.java
@@ -35,7 +35,7 @@ public void startProcessors() {
taskExecutor.execute(recordTypeProcessor);
taskExecutor.execute(urlProcessor);
-// oaiDataProviderService.queue(new OaiDataProvider("Acta Medica Anatolia","http://dergipark.gov.tr/api/public/oai/","dergipark.ulakbim.gov.tr" ));
+ oaiDataProviderService.queue(new OaiDataProvider("Acta Medica Anatolia","http://dergipark.gov.tr/api/public/oai/","dergipark.ulakbim.gov.tr" ));
// oaiDataProviderService.queue(new OaiDataProvider("http://export.arxiv.org/oai2"));
try {
oaiService.delete();
diff --git a/src/main/resources/templates/searchform.html b/src/main/resources/templates/searchform.html
index 91b9cd1..b18121a 100644
--- a/src/main/resources/templates/searchform.html
+++ b/src/main/resources/templates/searchform.html
@@ -10,6 +10,16 @@
OAI Harvester Search Form
diff --git a/src/main/resources/templates/searchresult.html b/src/main/resources/templates/searchresult.html
index 99a9691..b43f52a 100644
--- a/src/main/resources/templates/searchresult.html
+++ b/src/main/resources/templates/searchresult.html
@@ -9,6 +9,7 @@
Result
+
Search moooore