public static void printResult(Map<String, Double> result, ArgumentValidator validator, int limit) {
			try {
				FileWriter fstream = null;
				BufferedWriter out = null;
				boolean writeToFile = validator.getSearchOut() == null ? false : true; 
				
				// Create file 
				if (writeToFile) {
					fstream = new FileWriter(new File(validator.getSearchOut()));
					out = new BufferedWriter(fstream);
				}
				
				DecimalFormat df = new DecimalFormat("0.##E0");
				//df.setMaximumFractionDigits(2);

				int i = 0;
				for (String doc : result.keySet()) {
					if (i == limit)
						break;
					if (writeToFile) {
						out.write("topic" + validator.getTopicNumber() + " Q0 " + doc + " " + (i+1) + " " + df.format(result.get(doc)) + " group1_" + validator.getListSize()+"\n");
					}
					else {
						System.out.printf("topic%d Q0 %s %d %s groupA_%s\n", validator.getTopicNumber(), doc, i + 1, df.format(result.get(doc)), validator.getListSize());
					}
					i++;
				}
				if (writeToFile) {
					out.close();
					logger.info("Wrote search results to " + validator.getSearchOut());
				}
				
			}
			catch (Exception e) {
				logger.error("Search failed :/", e);
			}
		}