public double getNDCG(ResultList trueResultList, Result predictResult) {
		Result trueResult = new Result();
		for (String query : trueResultList.resultMap.keySet()) {
			if (predictResult.query.equals(query)) {
				trueResult = trueResultList.resultMap.get(query);
				break;
			}
		}
		
		double dcg = 0;
		int index = 1;
		for (String id : predictResult.getIdList()) {
			if (trueResult.containsId(id)) {
				if (index > 1) {
					dcg += 1.0 * Integer.parseInt(trueResult.results.get(trueResult
							.getIdIndex(id)).relevant) / log(index, 2);
				}
			}
			index++;
		}

		double idcg = 0;
		int ideal_index = 1;
		for (String id : trueResult.getIdList()) {
			if (ideal_index > 1) {
				idcg += 1.0 * Integer.parseInt(trueResult.results.get(trueResult
						.getIdIndex(id)).relevant) / log(ideal_index, 2);
			}
			ideal_index++;
		}
        
		System.out.println("NDCG: " + (dcg/idcg));
		return dcg/idcg;
	}