Skip to content

Welcome to the Real-time Search Engine project! This application provides a real-time search experience with insightful analytics on the most frequently searched terms.

Notifications You must be signed in to change notification settings

TekyRey/Realtime-Search-Engine

Repository files navigation

Real-time Search box

Welcome to the Real-time Search Engine project! This application provides a real-time search experience with insightful analytics on the most frequently searched terms.

Overview

This project is realtime search engine built with ruby on rails and in order to manage the realtime page load I implement the Turbo_Frames features linked with Stimulus Js.

Live Link

Live Link

Modules

This project consists of the following modules:

Search

The search module is responsible for providing a real-time search experience to the users. It utilizes the Turbo_Frames feature linked with Stimulus Js to manage the realtime page load. Users can enter search terms and instantly see the results without refreshing the page.

Analytics

The analytics module provides insightful analytics on the most frequently searched terms. It tracks and analyzes user search behavior to identify popular search terms and trends. This information can be used to make data-driven decisions and improve the search functionality of the application.

Built With

  • Ruby on Rails
  • Turbo_frames
  • Postgresql
  • stimulus
  • Rspec

Getting Started

To run this project locally, follow these simple steps:

git clone [email protected]:TekyRey/Realtime-Search-Engine.git
cd Realtime-Search-Engine

Prerequisites

Ensure that the following are installed on your computer:

  • Ruby 3.1.2
  • Rails 7.0.4
  • PostgreSQL (any version)

Setup

Install gems with:

bundle install

Create a .env file at the root of your project to store your database credentials.

touch .env

.env file content

DATABASE_USERNAME=your_username i.e postgres
DATABASE_PASSWORD=your_database_password

Set up the database:

rails db:setup
rails db:migrate
rails db:seed

Start the server

rails s

Open http://localhost:3000/ in your browser.

Run

Execute the following command to run tests:

bundle exec rspec

Author

👤 Rehema Mwaka Baya

🔭 The Pyramid Problem

    In the ArticlesController, the implemented solution focuses on efficient search handling and analytics tracking.
    Here's a concise overview:

    User Session Handling:
    Retrieve or create a user session based on the session ID to track user-specific information.

    Search Query Processing:
    Sanitize and perform a search in the Article model based on the query.

    Determining if the Search Should be Saved:
    Check criteria before saving a search, including query length, difference from the last search, and elapsed time.

    Saving Search After Delay:
    Update session attributes and use a delayed thread to save the search, accommodating users who are still typing.

    Analytics Tracking:
    Create or update Analytic records for words longer than 2 characters to track their occurrence.

    This solution ensures efficient handling of searches, prevents redundant saves, and tracks word occurrences for analytics.

    Note that for similar searches made in different requests, both will be saved, so results similar to those expected from a pyramid problem will be recorded. An example of this can be seen in the image below, where one person has searched for "a passag" and another has searched for "a passage", leading to the recording of very similar results. This could perhaps be an interesting problem to solve in a further development of the solution.

App Images

Local Image Local Image Local Image

🤝 Contributing

Contributions, issues, and feature requests are welcome! Check the issues page for opportunities to contribute.

Acknowledgments

🤝 HelpJuice

📝 License

This project is MIT licensed.

About

Welcome to the Real-time Search Engine project! This application provides a real-time search experience with insightful analytics on the most frequently searched terms.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published