void QueryProcessor::displayFrequency(IndexInterface* &myIndex, DocIndex &dIndex, DocParse &parser) { QueryProcessor qProcessor; //queryString = qProcessor.search(myIndex, finalPageList, frequency); qProcessor.first(); while (queryString != "EXIT") { queryString = qProcessor.search(myIndex, finalPageList, frequency); if(queryString == "EXIT") { break; } if(queryString != " ") { if(finalPageList.size() == 0 || frequency.size() == 0) { cout << "No Results Returned. Please Search Again" << endl; } else { cout << endl; cout << "Here are the Most Relevant Results:" << endl; for(int i = 0; i < finalPageList.size(); i++) { if(i == 15) break; dIndex.getPageInfo(finalPageList[i], title, author, date); cout << i+1 << ". Title: \"" << title << "\" by: " << author << " Date: " << date << " TF/IDF: " << frequency[i] << endl; cout << endl; cout << endl; } cout << "1. Search Again" << endl; cout << "2. Expand an Article" << endl; cout << "Please choose an option from above: "; int choice; cin >> choice; while(choice < 1 || choice > 2) { cout << "Error: please enter a valid choice: "; cin >> choice; } if (choice == 2) { cout << "To expand an article, enter it's corresponding number: "; cin>>choice; if (choice > 15 || choice < 1) { cout << "Invalid, enter a valid number: "; cin >> choice; } cout << "Please Hold. The page contents will appear soon... " << endl; parser.displayPageContents(finalPageList[choice - 1], dIndex); qProcessor.first(); } else { qProcessor.first(); } }