A modern search engine built with Spring Boot and gRPC capabilities and use TF-IDF algorithm to calculate the similarity between search queries and documents.
- JDK 17 or later
- Maven 3.6+
- Docker
- IntelliJ IDEA
-
Project Configuration
- Open IntelliJ IDEA
- Go to
File -> Project Structure - Ensure SDK is set to JDK 17+
- Set language level to "17 - Sealed types, always-strict floating-point semantics"
-
Spring Boot Configuration
- Enable annotation processing:
Settings -> Build, Execution, Deployment -> Compiler -> Annotation Processors - Check "Enable annotation processing"
- Set the processor path to "Module content root"
- Enable annotation processing:
-
Run Configurations in IntelliJ
- Click "Edit Configurations..."
- Create new Spring Boot configuration
- Name:
search-engine-leader - Main class:
ds.searchengine.SearchEngineApplication - Program arguments:
--grpc.server.port=9090 --spring.profiles.active=leader - Environment variables:
ROLE=leaderLEADER_PORT=9090
- Create another Spring Boot configuration
- Name:
search-engine-worker - Main class:
ds.searchengine.SearchEngineApplication - Program arguments:
--grpc.server.port=9091 --spring.profiles.active=worker - Environment variables:
ROLE=workerLEADER_HOST=localhostLEADER_PORT=9090
Multiple worker configurations can be created by incrementing the ports:
- worker 1: grpc.server.port=9091
- worker 2: grpc.server.port=9092
- Start the leader node first using the
search-engine-leaderconfiguration - Start one or more worker nodes using the
search-engine-workerconfigurations
- gRPC Ports:
- leader: 9090
- workers: 9091, 9092, ...
./mvnw spring-boot:run