public int run(String[] args) throws Exception {
    // TODO Auto-generated method stub

    Configuration conf = getConf();
    String query = "";
    for(int i = 2; i < args.length - 1; i++){
      query += args[i]+"@";
    }
    query += args[args.length - 1];
    conf.set("textfilter.query", query);

    Job filterJob = new Job(conf, "Wikipedia page filter job");
    filterJob.setJarByClass(XmlPageFilterDriver.class);
    filterJob.setMapperClass(FilterMapper.class);
    filterJob.setReducerClass(FilterReducer.class);

    // FileSystem fs = FileSystem.get(conf);
    // FileStatus[] list = fs.listStatus(new Path(args[1]));
    // if (list != null) {
    // for (FileStatus status : list) {
    // FileInputFormat.addInputPath(filterJob, status.getPath());
    // }
    // }

    // FileSystem fs = FileSystem.get(conf);
    // fs.delete(new Path(args[2]), true);

    FileInputFormat.setInputPaths(filterJob, new Path(args[0]));
    FileOutputFormat.setOutputPath(filterJob, new Path(args[1]));

    // WholeFileInputFormat
    filterJob.setInputFormatClass(WholeFileInputFormat.class);
    filterJob.setMapOutputKeyClass(Text.class);
    filterJob.setMapOutputValueClass(Text.class);

    filterJob.setNumReduceTasks(1);

    filterJob.waitForCompletion(true);
    return 0;
  }