This project is a simple file-based search engine implemented in C++. It allows you to search for text within files located in a specified folder and outputs the results to a text file. You can perform searches either manually or by reading from a query file.
- Manual Search: Enter queries directly in the console.
- File-based Search: Reads queries from a specified file (
query.txt
). - Results Output: Outputs the results of each query into
answer.txt
.
-
Clone or Download the Repository: Place all project files in a single folder.
-
Modify the Database Folder:
- Place the files you want the search engine to search through inside this
Database
folder. Each file should contain text content you want to search within.
- Place the files you want the search engine to search through inside this
-
Open a terminal (or command prompt) and navigate to the project folder.
-
Compile the C++ files using the following command:
g++ search.cpp helperFunction.cpp trie.cpp -o search_engine.exe
-
This will create an executable file named
search_engine.exe
.
- Run the executable by entering:
search_engine.exe
- You will be prompted with options:
- Manual Search: Type queries directly in the console.
- File-based Search: The program will read queries from
query.txt
and search for each query in the files within theDatabase
folder.
- After the search is complete, check
answer.txt
for the search results. The file will include each query followed by the filenames and content matches, or a "Not found" message if there are no results.
answer.txt
: This file contains the results of each search query, generated automatically after the program runs.