From 4501f9eac4bbd9429100498dc3d92bf4636dd945 Mon Sep 17 00:00:00 2001 From: "jackdaw@loafle.com" Date: Tue, 25 Apr 2017 16:29:33 +0900 Subject: [PATCH] result set --- .../overflow/crawler/result/OFResultSet.java | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/loafle/overflow/crawler/result/OFResultSet.java b/src/main/java/com/loafle/overflow/crawler/result/OFResultSet.java index ac50fc0..3ebc56e 100644 --- a/src/main/java/com/loafle/overflow/crawler/result/OFResultSet.java +++ b/src/main/java/com/loafle/overflow/crawler/result/OFResultSet.java @@ -41,7 +41,29 @@ public class OFResultSet { } - public void setMeta(List meta) { + public void setMeta() { + + + String type = (String) this.item.getQuery().getQueryInfo().get("parseDirection"); + List meta = new ArrayList<>(); + if (type.equals("row")) { + + List arrayColumns = (List) this.item.getQuery().getQueryInfo().get("arrayColumns"); + List keyColumns = (List) this.item.getQuery().getQueryInfo().get("keyColumns"); + String valueColumn = (String) this.item.getQuery().getQueryInfo().get("valueColumn"); + + for (String c : arrayColumns) { + meta.add(c); + } + for (String c: keyColumns) { + meta.add(c); + } + meta.add(valueColumn); + + } else { + + } + if(this.meta == null) { this.meta = new HashMap<>(); @@ -54,13 +76,9 @@ public class OFResultSet { } public OFResultSet(Item item) { - this(item,null); - } - - public OFResultSet(Item item,List meta) { this.item = item; this.rows = new ArrayList<>(); - this.setMeta(meta); + this.setMeta(); } public void addRow(List row) {