public ArrayList<String> tempResultQuery(ArrayList<String> temp,
			String query) {
		ArrayList<String> tempResults = new ArrayList<String>();

		if (temp.isEmpty()) {
			docIdResults.clear();
			docIdResultsBoolean.clear();
			parser.clearStemmerFile();
			ArrayList<String> p1 = new ArrayList<String>();
			ArrayList<String> p2 = new ArrayList<String>();

			String operator = "";
			if (query.contains("&")) {
				operator = "&";
				query = query.replaceAll("&", " ");
				stemQuery = parser.stemLine(query);
				String q1 = stemQuery.get(0);
				String q2 = stemQuery.get(1);
				p1 = searchWord(q1);
				p2 = searchWord(q2);
			} else if (query.contains("|")) {
				operator = "|";
				query = query.replaceAll("\\|", " ");
				stemQuery = parser.stemLine(query);
				String q1 = stemQuery.get(0);
				String q2 = stemQuery.get(1);
				p1 = searchWord(q1);
				p2 = searchWord(q2);
			}

			switch (operator) {
			case "&":
				docIdResultsBoolean = intersect(p1, p2);
				break;
			case "|":
				docIdResultsBoolean = union(p1, p2);
				break;
			}
			tempResults.addAll(docIdResultsBoolean);
		} else {
			docIdResults.clear();
			docIdResultsBoolean.clear();
			parser.clearStemmerFile();
			ArrayList<String> p1 = temp;
			ArrayList<String> p2 = new ArrayList<String>();
			String operator = "";
			if (query.contains("&")) {
				operator = "&";
				query = query.replaceAll("&", " ");
				stemQuery = parser.stemLine(query);
				p2 = searchWord(stemQuery.get(0));
			} else if (query.contains("|")) {
				operator = "|";
				query = query.replaceAll("\\|", " ");
				stemQuery = parser.stemLine(query);
				p2 = searchWord(stemQuery.get(0));
			}

			switch (operator) {
			case "&":
				docIdResultsBoolean = intersect(p1, p2);
				break;
			case "|":
				docIdResultsBoolean = union(p1, p2);
				break;
			}
			tempResults.addAll(docIdResultsBoolean);
		}
		return tempResults;
	}