@@ -0,0 +1,1607 @@
+package edu.neu.ccs.pyramid.experiment;%0A%0Aimport edu.neu.ccs.pyramid.configuration.Config;%0A%0Aimport edu.neu.ccs.pyramid.data_formatter.review_polarity.IndexBuilder;%0Aimport edu.neu.ccs.pyramid.util.DirWalker;%0Aimport org.elasticsearch.action.index.IndexResponse;%0Aimport org.elasticsearch.client.Client;%0Aimport org.elasticsearch.common.xcontent.XContentBuilder;%0Aimport org.elasticsearch.node.Node;%0A%0Aimport java.io.File;%0Aimport java.util.List;%0A%0Aimport static org.elasticsearch.node.NodeBuilder.nodeBuilder;%0A%0A/**%0A * index review polarity%0A * Created by chengli on 10/24/14.%0A */%0Apublic class Exp16 %7B%0A    public static void main(String%5B%5D args) throws Exception %7B%0A        if (args.length != 1) %7B%0A            throw new IllegalArgumentException(%22please specify the config file%22);%0A        %7D%0A%0A        Config config = new Config(args%5B0%5D);%0A        System.out.println(config);%0A%0A        String dir = config.getString(%22input.folder%22);%0A%0A        Node node = nodeBuilder().client(true).clusterName(config.getString(%22index.clusterName%22)).node();%0A        Client client = node.client();%0A%0A        List%3CFile%3E list = DirWalker.getFiles(dir);%0A        int id = 0;%0A        for (File file : list) %7B%0A            System.out.println(%22id = %22+id);%0A            XContentBuilder builder = IndexBuilder.getBuilder(file);%0A            //               System.out.println(builder.string());%0A            IndexResponse response = client.prepareIndex(%22review_polarity%22, %22document%22,%22%22+id)%0A                    .setSource(builder)%0A                    .execute()%0A                    .actionGet();%0A            id += 1;%0A        %7D%0A%0A        node.close();%0A    %7D%0A%7D%0A

add Exp16