Skip to content

Latest commit

 

History

History
75 lines (45 loc) · 1.38 KB

README.md

File metadata and controls

75 lines (45 loc) · 1.38 KB

Java Search Engine

A command line search engine which implements Inverted Index, Strategy pattern.

Demo

Final

Run Locally

Clone the project

git clone https://github.com/anhtuansggd/Search_Engine.git

Go to the project directory

cd ./Search_Engine/src/

Compile source files

javac --class-path ./search/ search/*.java

Executes with arguments

java -classpath ./ search.Main --data ./search/tests.txt

Features

3 search option:
- ALL: Find names that inclued give name
- ANY: Find names that comes from any part of give any
- NONE: Find names that are different from give name

More Explanation

Start with a given text file which will be add to list of all names:

Katie Jacobs
Erick Harrington [email protected]
Myrtle Medina
Erick Burgess

The program maps each word of name to the index of line it starts:

katie -> [0]
jacobs -> [0]
erick -> [1, 3]
harrington -> [1]
[email protected] -> [1]
myrtle -> [2]
medina -> [2]
burgess -> [3]

Now, the program compare the name with chosen finding strategy to return index of result name to queries from list of all name.

Reference

1: https://www.geeksforgeeks.org/inverted-index/
2: https://refactoring.guru/design-patterns/strategy