Giter Site home page Giter Site logo

text-finder's Introduction

text-finder

The app provides the opportunity for searching texts in the database on the server using Elasticsearch. You can receive first 10 matching results from the database ordered by the date of creation.

CI status

Python CI

Links

This project was built using these tools:

Tool Description
FastAPI "Web framework for building APIs with Python"
PostgreSQL "An open source object-relational database system"
Elasticsearch "Elasticsearch is a distributed, RESTful search and analytics engine capable of addressing a growing number of use cases."
Logstash "is a free and open server-side data processing pipeline that ingests data from a multitude of sources, transforms it, and then sends it to "stash"
poetry "Python dependency management and packaging made easy"

Installation and usage

Introductory information

We have a database called 'texts' with a table 'db_texts'. The fields of the table: 'id', 'text', 'created_date', 'rubrics'. First, we need to put to the Elasticsearch index fields 'id', 'text'. Then our app will search requested text in the Elasticsearch index, collect related information (ids) about the objects and search them in our database.

Tools

You need to have Elasticsearch and Logstash installed to use the app. If you don't, please, visit:

Elasticsearch

Logstash

Example Logstash configuration file:

input {
    jdbc {
        jdbc_connection_string => "jdbc:postgresql://localhost:5432/texts"
        jdbc_user => "your_username_here"
        jdbc_password => "your_password_here"
        jdbc_validate_connection => true
        jdbc_driver_library => "/path-to/postgresql-42.5.1.jar"
        jdbc_driver_class => "org.postgresql.Driver"
        statement => "SELECT id, text FROM db_texts"
    }
}
filter {
    date {
        match => [ "event_date" ,"yyyy-MM-dd HH:mm:ss"]
        timezone => "Europe/Paris"
        target => "@timestamp"
    }
}
output {
    elasticsearch {
        index => "texts"
        hosts => "localhost:9200"
    }
}

Copy a project

$ git clone [email protected]:Dddarknight/text-finder.git
$ cd text-finder 

Set up environment variables

$ touch .env

# You have to fill .env file. See .env.example.
# You will have to fill username and password fields for PostgreSQL.

Launch

$ make run

Example of usage

$ curl -X GET 'http://localhost:8000/texts?text_to_find=like'

text-finder's People

Contributors

dddarknight avatar

Watchers

 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.