private void updateTilebarWithQuery(ArrayList<Term> query, ArrayList<String> searchTerms, int which){
		String informationForCurrentQuery = "";
		if(query.size() != 0){
			for(int i = 0;i < query.size();i++){
				Term termRoot = query.get(i);
				informationForCurrentQuery += termRoot.getTerm() + " found in chapters: ";
				ArrayList<Integer> rootFoundInChapters = selected.foundInChapters(query.get(i).getTerm());
				for(int k = 0;k < rootFoundInChapters.size();k++){
					informationForCurrentQuery += rootFoundInChapters.get(k)+1 + ", ";
				}
				informationForCurrentQuery += "\nOn pages: "+termRoot.getExtendedRange().toString()+"\n\n";
				ArrayList<Integer> pageRangeOfPotentiallyRelatedTerm = termRoot.getExtendedRange().getRanges();
				pageRangeOfPotentiallyRelatedTerm = termRoot.getExtendedRange().getRanges();
				for(int j = 0;j < rootFoundInChapters.size();j++){
					int startingPageForCurrentChapter = selected.getChapter(rootFoundInChapters.get(j)).getStart();
					int endingPageForCurrentChapter = selected.getChapter(rootFoundInChapters.get(j)).getEnd();
					ArrayList<Integer> filterUnnecessaryPages = new ArrayList<>();
					for(int k = 0;k < pageRangeOfPotentiallyRelatedTerm.size();k++){
						if(pageRangeOfPotentiallyRelatedTerm.get(k) >= startingPageForCurrentChapter && pageRangeOfPotentiallyRelatedTerm.get(k) <= endingPageForCurrentChapter){
							filterUnnecessaryPages.add(pageRangeOfPotentiallyRelatedTerm.get(k));
						}
					}
					if(coloringMode == FIXED_COLORING){
						if(which == 1){
							chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(255, 0, 0), which);
						}
						else if(which == 2){
							chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(0, 255, 0), which);
						}
						else if(which == 3){
							chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(0, 0, 255), which);
						}
					}
					else if(coloringMode == FREQUENCY_COLORING){
						if(which == 1){
							if(USE_CHAPTER_FREQUENCY_COLORING){
								chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(MINIMUM_COLOR+(1-MINIMUM_COLOR)*((float)filterUnnecessaryPages.size()/(float)selected.getChapter(rootFoundInChapters.get(j)).getNumPages()), 0, 0), which);
							}
							else {
								chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(MINIMUM_COLOR+(1-MINIMUM_COLOR)*((float)pageRangeOfPotentiallyRelatedTerm.size()/(float)selected.getSize()), 0, 0), which);
							}
						}
						else if(which == 2){
							if(USE_CHAPTER_FREQUENCY_COLORING){
								chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(0, MINIMUM_COLOR+(1-MINIMUM_COLOR)*((float)filterUnnecessaryPages.size()/(float)selected.getChapter(rootFoundInChapters.get(j)).getNumPages()), 0), which);
							}
							else {
								chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(0, MINIMUM_COLOR+(1-MINIMUM_COLOR)*((float)pageRangeOfPotentiallyRelatedTerm.size()/(float)selected.getSize()), 0), which);
							}
						}
						else if(which == 3){
							if(USE_CHAPTER_FREQUENCY_COLORING){
								chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(0, 0, MINIMUM_COLOR+(1-MINIMUM_COLOR)*((float)filterUnnecessaryPages.size()/(float)selected.getChapter(rootFoundInChapters.get(j)).getNumPages())), which);
							}
							else {
								chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(0, 0, MINIMUM_COLOR+(1-MINIMUM_COLOR)*((float)pageRangeOfPotentiallyRelatedTerm.size()/(float)selected.getSize())), which);
							}
						}
					}
					else if(coloringMode == INVERSE_FREQUENCY_COLORING){
						if(which == 1){
							if(USE_CHAPTER_FREQUENCY_COLORING){
								chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(MINIMUM_COLOR+((1-MINIMUM_COLOR)-((1-MINIMUM_COLOR)*((float)filterUnnecessaryPages.size()/(float)selected.getChapter(rootFoundInChapters.get(j)).getNumPages()))), 0, 0), which);
							}
							else {
								chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(MINIMUM_COLOR+((1-MINIMUM_COLOR)-((1-MINIMUM_COLOR)*((float)pageRangeOfPotentiallyRelatedTerm.size()/(float)selected.getSize()))), 0, 0), which);
							}
						}
						else if(which == 2){
							if(USE_CHAPTER_FREQUENCY_COLORING){
								chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(0, MINIMUM_COLOR+((1-MINIMUM_COLOR)-((1-MINIMUM_COLOR)*((float)filterUnnecessaryPages.size()/(float)selected.getChapter(rootFoundInChapters.get(j)).getNumPages()))), 0), which);
							}
							else {
								chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(0, MINIMUM_COLOR+((1-MINIMUM_COLOR)-((1-MINIMUM_COLOR)*((float)pageRangeOfPotentiallyRelatedTerm.size()/(float)selected.getSize()))), 0), which);
							}
						}
						else if(which == 3){
							if(USE_CHAPTER_FREQUENCY_COLORING){
								chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(0, 0, MINIMUM_COLOR+((1-MINIMUM_COLOR)-((1-MINIMUM_COLOR)*((float)filterUnnecessaryPages.size()/(float)selected.getChapter(rootFoundInChapters.get(j)).getNumPages())))), which);
							}
							else {
								chapterTiles.get(rootFoundInChapters.get(j)).updateTileBar(filterUnnecessaryPages, new Color(0, 0, MINIMUM_COLOR+((1-MINIMUM_COLOR)-((1-MINIMUM_COLOR)*((float)pageRangeOfPotentiallyRelatedTerm.size()/(float)selected.getSize())))), which);
							}
						}
					}
				}
			}
		}
		//Append on search terms which were not found.
		for(int i = 0;i < searchTerms.size();i++){
			if(!informationForCurrentQuery.contains(searchTerms.get(i)+" found in chapters")){
				informationForCurrentQuery += searchTerms.get(i) + " not found.\n\n";
			}
		}
		textInformation += informationForCurrentQuery;
	}