Giter Site home page Giter Site logo

s5-prog-searchengine's Introduction

Overview 🔮

Make search over products using natural language [french only].

Screen.Recording.2024-02-27.at.20.45.59.mov

How it works ℹ️

Keywords are extracted from the query, labeled and translated into SQL queries.

Example ⤵️

Query:

top 2 meilleur qualité de légumes et fruit supérieure ou égale à 7 avec un prix entre 3000 et 5000

Keywords extracted: (*key is index of the word in the query)

Adjectives: (1)
    {
        6=Adjective{id=0, name='meilleur', effect='+'}
    }
Categories: (2)
    {
        26=Category{id=1, name='légume'},
        37=Category{id=0, name='fruit'}
    }
Criteria: (2)
    {
        15=Criteria{id=2, name='qualité', label='quality', typeCriteria='numeric', bestValue='+'},
        75=Criteria{id=0, name='prix', label='price', typeCriteria='numeric', bestValue='-'}
    }
Comparators: (3)
    {
        43=Comparator{id=0, name='supérieur', value='>', parameterType='numeric', parameterNumber=1},
        57=Comparator{id=2, name='égal', value='=', parameterType='numeric', parameterNumber=1},
        80=Comparator{id=1, name='entre', value='BETWEEN', parameterType='numeric', parameterNumber=2}
    }
Products: (0){}

SQL Query:

SELECT *, c.name AS category_name, +(+quality / COALESCE(NULLIF(+price,0),1))  as priority FROM product p JOIN category c ON c.id = p.category_id WHERE (category_id = 1 OR category_id = 0) AND quality > 7 OR  (price = 7 AND price BETWEEN 3000 AND 5000) ORDER BY priority DESC LIMIT 2

How to use it 🛠

Required java >= 17 and maven installed

  • After cloning the repository, run the following command to install the required packages:
mvn clean install
  • To run the application, run the following command:
mvn spring-boot:run
  • Insert rows in data.sql into the database
  • The application will be available at the following address:http://localhost:8080/search

s5-prog-searchengine's People

Contributors

mendrika261 avatar

Stargazers

Harena SITRAKINIAVO  avatar  avatar  avatar  avatar  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.