public ArrayList<Term> getOverlappingTerms(String query, ArrayList<Integer> selectedChapters){
		if(index.hasTerm(query)){
			if(selectedChapters.size() == 0){
				return index.getOverlappingTerms(query, 0, 0);
			}
			else {
				ArrayList<Term> overlappingTerms = new ArrayList<>();
				for(int i = 0;i < selectedChapters.size();i++){
					ArrayList<Term> allPotentialCandidatesFromCurrentChapter = index.getOverlappingTerms(query, toc.getChapters().get(selectedChapters.get(i)).getStart(), toc.getChapters().get(selectedChapters.get(i)).getEnd());
					for(Term maybe : allPotentialCandidatesFromCurrentChapter){
						if(!overlappingTerms.contains(maybe)){
							overlappingTerms.add(maybe);
						}
					}
				}
				return overlappingTerms;
			}
		}
		else {
			return null;
		}
	}