[ 
https://issues.apache.org/jira/browse/SDAP-80?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16487540#comment-16487540
 ] 

ASF GitHub Bot commented on SDAP-80:
------------------------------------

lewismc commented on a change in pull request #28: SDAP-80
URL: 
https://github.com/apache/incubator-sdap-mudrod/pull/28#discussion_r190307563
 
 

 ##########
 File path: 
core/src/main/java/org/apache/sdap/mudrod/ssearch/ranking/TrainingImporter.java
 ##########
 @@ -63,29 +63,31 @@ public void addMapping() {
   /**
    * Method of importing training set in to Elasticsearch
    *
-   * @param dataFolder the path to the traing set
-   * @throws IOException IOException
+   * @param dataFolder
+   *          the path to the traing set
+   * @throws IOException
+   *           IOException
    */
   public void importTrainingSet(String dataFolder) throws IOException {
     es.createBulkProcessor();
 
     File[] files = new File(dataFolder).listFiles();
     for (File file : files) {
-      BufferedReader br = new BufferedReader(new 
FileReader(file.getAbsolutePath()));
-      br.readLine();
-      String line = br.readLine();
-      while (line != null) {
-        String[] list = line.split(",");
-        String query = file.getName().replace(".csv", "");
-        if (list.length > 0) {
-          IndexRequest ir = new 
IndexRequest(props.getProperty(MudrodConstants.ES_INDEX_NAME), 
"trainingranking")
-              .source(jsonBuilder().startObject().field("query", 
query).field("dataID", list[0]).field("label", list[list.length - 
1]).endObject());
-          es.getBulkProcessor().add(ir);
+      try (BufferedReader br = new BufferedReader(new 
FileReader(file.getAbsolutePath()))) {
+        String line = null;
+        line = br.readLine(); // cvs header
+        while ((line = br.readLine()) != null) {
 
 Review comment:
   Have you tested this code? It look suspicious.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Fix bugs in TrainingImporter.java
> ---------------------------------
>
>                 Key: SDAP-80
>                 URL: https://issues.apache.org/jira/browse/SDAP-80
>             Project: Apache Science Data Analytics Platform
>          Issue Type: Bug
>          Components: mudrod
>            Reporter: Yun Li
>            Priority: Major
>             Fix For: 0.1
>
>
> Fix bugs in TrainingImporter.java @[~lewismc] 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to