Code Monkey home page Code Monkey logo

search_engine's Introduction

Mini Search Engine with Kafka and Flink

Development Dependencies

  • Scala
  • Play Framework
  • Sbt
  • Kafka
  • Flink
  • PostgreSQL

Running Search API

In PostgreSQL create database and user:

postgres=# CREATE DATABASE crawler;
CREATE DATABASE
postgres=# CREATE USER crawler WITH PASSWORD '123';
CREATE ROLE
postgres=# ALTER USER crawler WITH SUPERUSER;
ALTER ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE crawler TO crawler;
GRANT

Run Search API

sbt runSearchApi

After successfully starting the service. Request the URL http://localhost:9000/ from your browser and click the "Apply this script now!"

Start ZooKeeper:

./bin/zookeeper-server-start.sh config/zookeeper.properties

Start Kafka:

./bin/kafka-server-start.sh ./config/server.properties

Create topic

./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test-topic

Send messages to topic

./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test-topic

And send following messages to topic:

>Сэр
>Джонс
>Ваша
>карта
>бита
>привет
>как жизнь
>

Running Crawler Engine

This command starts the crawler service to read messages from the Kafka topic via Flink and writes the messages to PostgreSQL.

sbt "runCrawler --topic test-topic --group_id test --zookeeper_connect localhost:2181 --bootstrap_servers localhost:9092 --postgres_host localhost:5432 --postgres_database crawler --postgres_user crawler --postgres_password 123"

Usage Search API

This service returns the first 10 similar words stored by the crawler, in descending order. Query:

curl http://localhost:9000/?word=джакарта

Response:

карта
джонс
бита

search_engine's People

Contributors

azimboy avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.