@@ -0,0 +1,1177 @@
+import java.io.*;%0Aimport java.util.*;%0A%0Apublic class QueryIndex %7B%0A%09public static void main(String%5B%5D args) throws IOException %7B%0A%09%09//Read in the 2nd argument which is the Inverted Index result file from the MapReduce job%0A%09%09FileReader fpResult = new FileReader(args%5B1%5D);%0A%09%09BufferedReader fpBufferedResult = new BufferedReader(fpResult);%0A%09%09String lineResult;%0A%09%09String%5B%5D splitLine;%0A%09%09Hashtable%3CString, String%3E hashDoc = new Hashtable%3CString, String%3E();%0A%0A%09%09//Read the file and create a HashTable with word as key and the rest as value%0A%09%09while ((lineResult = fpBufferedResult.readLine()) != null) %7B%0A%09%09%09splitLine = lineResult.split(%22%5C%5Cs+:%5C%5Cs*%22);%0A%09%09%09hashDoc.put(splitLine%5B0%5D, splitLine%5B1%5D);%0A%09%09%7D%0A%0A%09%09//Open the 3rd argument for writing%0A%09%09PrintWriter fpOut = new PrintWriter(args%5B2%5D);%0A%0A%09%09//Parse the 1st argument which is the Query file %0A%09%09FileReader fpQuery = new FileReader(args%5B0%5D);%0A%09%09BufferedReader fpBufferedQuery = new BufferedReader(fpQuery);%0A%09%09String lineQuery;%0A%09%09%0A%09%09while ((lineQuery = fpBufferedQuery.readLine()) != null) %7B%0A%09%09%09//For every query word, print using the HashTable created previously%0A%09%09%09fpOut.println(lineQuery+%22%5Ct%22+hashDoc.get(lineQuery));%0A%09%09%7D%0A%09%09fpOut.close();%09%0A%09%7D%0A%7D%0A

Create QueryIndex.java