Description
Now let's Improve your search engine to make it support complex queries containing word sequences and use several strategies that determine how to match data.
Objectives
In this stage, your program should be able to use such searching strategies as ALL, ANY, and NONE.
Take, for example, these six sample lines:
Dwight Joseph [email protected]
Rene Webb [email protected]
Katie Jacobs
Erick Harrington [email protected]
Myrtle Medina
Erick BurgessIf the strategy is
ALL, the program should print lines containing all the words from the query.
Query:
Harrington ErickResult:
Erick Harrington [email protected]If the strategy is
ANY, the program should print the lines containing at least one word from the query.
Query:
Erick Dwight [email protected]Result:
Erick Harrington [email protected]
Erick Burgess
Dwight Joseph [email protected]
Rene Webb [email protected]If the strategy is
NONE, the program should print the lines that do not contain any words from the query at all.
Query:
[email protected] ERICKResult:
Katie Jacobs
Myrtle Medina
Rene Webb [email protected]All the listed operations should be implemented with an inverted index, and the results should not contain any duplicates.
Do not forget to use methods to decompose your program.
Example
The lines that start with > represent the user input. Note that these symbols are not part of the input.
=== Menu ===
1. Find a person
2. Print all persons
0. Exit
> 1
Select a matching strategy: ALL, ANY, NONE
> ANY
Enter a name or email to search all matching people.
> Katie Erick QQQ
3 persons found:
Katie Jacobs
Erick Harrington [email protected]
Erick Burgess