public ArrayList<Query> getQueries(String queryFileName) {
		ArrayList<Query> queryList = new ArrayList<Query>();
		Query query = new Query();
		FileReader fileReader;

		try {
			fileReader = new FileReader(queryFileName);
			BufferedReader reader = new BufferedReader(fileReader);
			String line;
			try {
				while ((line = reader.readLine()) != null) {
					StringTokenizer tokenizer = new StringTokenizer(line);
					long featureId = Long.parseLong(tokenizer.nextToken());
					int weight = Integer.parseInt(tokenizer.nextToken());
					if (!(featureId == 0 && weight == 0)) {
						if (dictionary.map.containsKey(featureId))
							query.addTerm(featureId, weight);
					} else {
						queryList.add(query);
						query = new Query();
					}
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		} catch (FileNotFoundException e1) {
			e1.printStackTrace();
		}

		ArrayList<Query> returnList;
		if (SORT_QUERIES) {
			// Send back the shortest queries
			Collections.sort(queryList);
			returnList = new ArrayList<Query>(queryList.subList(0, NUM_QUERIES));
		} else if (REVERSE_SORT_QUERIES) {
			// Send back the longest queries
			Collections.sort(queryList, Collections.reverseOrder());
			returnList = new ArrayList<Query>(queryList.subList(0, NUM_QUERIES));
		} else {
			// Send back random queries
			returnList = new ArrayList<Query>();
			for (int i = 0; i < queryIndices.length; i++) {
				returnList.add(queryList.get(queryIndices[i]));
			}
		}

		return returnList;
	}