public static void WriteFile(ArrayList<InveList> currentResult,File WriteFile) throws IOException{
		//write all ranked results to output file

		FileOutputStream IOStream = new FileOutputStream(WriteFile, true);
		OutputStreamWriter write = new OutputStreamWriter(IOStream);
		BufferedWriter writer = new BufferedWriter(write);
		String str = "";

		for (int i = 0; (i < 100) && (i < currentResult.size()); i++){
			InveList tmp = currentResult.get(i);

			////output string for trec_eval results
			if (IsRanked == "Ranked")
				str = queryID + " Q0 " + tmp.getDocID() + " " + (i+1) + " " + tmp.getTf() + " run-1";
			else if (IsRanked == "UnRanked")
				str = queryID + " Q0 " + tmp.getDocID() + " " + (i+1) + " 1 run-1";

//			//output string for Sample results
//			if (IsRanked == "Ranked")
//				str = (i+1) + " " + tmp.getDocID() + " "+ tmp.getTf();
//			else if (IsRanked == "UnRanked")
//				str = (i+1) + " " + tmp.getDocID() + " 1";


			writer.write(str);
			writer.newLine();
			writer.flush();
			write.flush();
		}

		writer.close();
		write.close();
		IOStream.close();
	}