def main(): se = SearchEngine() option_str = displayMenu() option = int(option_str) while(option !=5): results = list() if option == 1: callNumber = input("Enter Call Number: ") results = se.search_by_call_no(callNumber) se.display(results) elif option == 2: subject = input("Enter Subject: ") results = se.search_by_subjects(subject) se.display(results) elif option == 3: title = input("Enter Title: ") results = se.search_by_title(title) se.display(results) elif option == 4: other = input("Enter Other : ") results = se.search_by_other(other) se.display(results) else: print('\n') print("Enter Correct option:") print('\n') print("Total No. of Matching Result: ", len(results)) print('\n') option_str = displayMenu() option = int(option_str)
def processCommand(): print("Enter the option you want to search by") print("1.Title") print("2.Number") print("3.Subjects") print("4.Other") inp = input() search_result = [] if (inp == "Title"): input_title = input("Enter the title to be searched") se = SearchEngine() search_result = se.search_by_title(input_title) display_main(search_result) elif (inp == "Number"): input_number = input("Enter the number to be searched ") se = SearchEngine() search_result = se.search_by_call_number(input_number) display_main(search_result) elif (inp == "Subjects"): input_subjects = input ("Enter the subject to be searched") se = SearchEngine() search_result = se.search_by_subjects(input_subjects) display_main(search_result) elif (inp == "Other"): input_other= input("Enter the data to be searched ") se = SearchEngine() search_result = se.search_by_other(input_other) display_main(search_result) yesno = input ("Do you wish to continue? Yes or No") if (yesno == "Yes"): processCommand() elif(yesno == "No"): exit