Skip to content

This repository contains the backend for the search trend analytics app

License

Notifications You must be signed in to change notification settings

Bestbynature/realtime-search-analytics

Repository files navigation

Video Demo for the realtime search analytics app

📗 Table of Contents

📖 [RealTime Search]

RealTime Search is a robust Ruby on Rails project designed to provide users with seamless real-time article search capabilities. Leveraging the power of the searchkick gem, this platform harnesses Elasticsearch to index articles, enabling swift and accurate searches.

The searchkick gem offers advanced features like fuzzy search, ensuring search results remain comprehensive even with misspelled queries. Moreover, it facilitates partial search functionality, returning relevant results for queries that are partial matches to article titles.

To optimize performance and database efficiency, the platform handles search queries adeptly. While all search queries are initially logged in the database, only complete queries are permanently stored. This strategy prevents the accumulation of partial queries, avoiding the pyramid problem. The system also maintains a count of how frequently each search query is made.

At the forefront of the user experience is the curated display of the top 10 search queries on the home page. These queries are ranked based on their popularity, which is determined by the frequency of searches. To ensure freshness and relevance, these search queries are updated every 5 minutes.

Behind the scenes, the search query updates are managed via a robust background job mechanism implemented using the Sidekiq gem. Sidekiq enables the asynchronous execution of background jobs and provides built-in mechanisms for job retries upon failure. Additionally, it offers extensive configuration options, including queue latency history management, granularity settings, bucket management, and maximum queue latency history size. This setup ensures the seamless and efficient execution of search query updates while maintaining system reliability and performance.

🛠 Built With

Tech Stack

Server Side
  • RUBY
  • RAILS
Client Side
  • Sidekiq
  • Searchkick
  • Elasticsearch
  • Faker
  • Rspec
  • Rubocop
  • Bootstrap
  • sqlite
  • Docker

Key Features

  • [Elastic search]
  • [Faker Gem]
  • [Search kick]
  • [Docker]

(back to top)

LIVE DEMO

Not available at the moment due to the fact that the project has time constraints and the fact that free tier of heroku has been cancelled. Given more time, Another service can be used to host the project.

However, detailed steps would be gven below showing how to run the project locally.

(back to top)

Prerequisites

In order to run this project you need:

  • To have Git installed on your local machine
  • WSL or linux operating system
  • An editor such as Visual Studio Code linked to your wsl
  • Ruby 3.x.x
  • Rails 7.x.x
  • docker desktop client

(back to top)

Setup ===> The steps must be followed to the letter

  • Install docker desktop client: download and install docker desktop client from here
  • Install WSL or linux operating system: download and install WSL or linux operating system from here
  • Install Ruby 3.x.x: download and install Ruby 3.x.x from here
  • Install Rails 7.x.x: download and install Rails 7.x.x from here
  • Install an editor such as Visual Studio Code linked to your wsl: download and install Visual Studio Code from here
  • Install Git: download and install Git from here

  • open the docker desktop client app open Ubuntu terminal and run the following commands to start the docker container
 docker run -d -p 127.0.0.1:9200:9200 -p 127.0.0.1:9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.17.8
  • open your browser and type "localhost:9200" to view the elasticsearch server

  • Clone this repository to your desired folder in wsl or linux operating system

  • Open the project folder in your editor (VS Code)

  • Run "bundle install" to install all the gems

  • Run "rails db:create" to create the database

  • Run "rails db:migrate" to migrate the database

  • Run "rails db:seed" to seed the database

  • Run "bin/dev" to start the server

  • Open your browser and type "localhost:3000" to view the project

    (back to top)

Install

To install this project, run

bundle install

Run tests

To run tests, run the following command:

Run "rspec" to run tests
Run "rubocop -A" to fix linters

(back to top)

👥 Author

👤 Author: Damilare

(back to top)

🔭 Future Features

  • [A feature for updating search trend every five minutes]

(back to top)

🤝 Contributing

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page.

(back to top)

⭐️ Show your support

If you like this project, you may buy me a coffee.

(back to top)

🙏 Acknowledgments

I would like to use this medium to appreciate Microverse

(back to top)

📝 License

This project is MIT licensed.

(back to top)

About

This repository contains the backend for the search trend analytics app

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published