Search Engine is a simple, efficient engine that builds a reverse index for keyword searching and ranks results using the PageRank algorithm.
Please create a virtual environment using venv
, as the project is still in alpha testing and in its initial implementations.
python3 -m venv .env
source .env/bin/activate
pip install search-engine-cpp
from search_engine.crawler import Crawler
crawler = Crawler("https://en.wikipedia.org", "/wiki/", "Cat", test_mode=True)
graph = crawler.run(limit=10)
my_dict = graph.compute_page_rank()
top = sorted(my_dict.items(), key=lambda item: item[1], reverse=True)[:3]
print(top)
Before compiling the project, ensure your environment meets the following requirements:
- CMake 3.10 or higher
- Google Test for unit testing
- A C++11 compatible compiler or higher
The project is organized as follows:
src/
: Main implementation of the search engine, including reverse indexing and the PageRank algorithm.tests/
: Unit tests to verify the functionality of the system.CMakeLists.txt
: Configuration file for building the project with CMake.
To compile the project, follow these steps:
-
Create a
build
directory and navigate into it:mkdir build && cd build
-
Run CMake to generate the build files:
cmake ..
-
Compile the project using make:
make
Run unit tests to ensure the correctness of the system.
-
After building the project, navigate to the
build
directory and execute:./tests/unit-tests/LibUnitTests
This will run the tests covering search engine functionality, reverse indexing, and the PageRank algorithm.
The first step is building the project, for this to run:
poetry install
poetry build
After building it, run this command to see the library working:
poetry run python Examples/graph_example.py
- Reverse Indexing: Maps keywords to the documents where they appear.
- PageRank: An algorithm that assigns a relevance score to each document based on its links and structure.
- Querying: Searches for documents related to a keyword and ranks them according to their PageRank score.
This project is licensed under the MIT License - see the LICENSE file for details.
We welcome all contributions to this project! Please make sure to follow the guidelines outlined in the CONTRIBUTING.md file.
Thanks to all contributors
Made with contrib.rocks.
Keep learning,
Pedro;)