Week 7-8 Report: Markdown Editor and Topic Search | GSoC'24 CircuitVerse
Over the past two weeks, I’ve been focused on enhancing the markdown editor by adding more buttons to the toolbar and implementing a topic search feature for the forum. Here’s a detailed overview of the progress made:
Week 7
PR: https://github.com/CircuitVerse/simple_discussion/pull/27
This PR introduces three new buttons to the toolbar of the Markdown editor. These buttons are responsible for functionality of embedding circuit, embedding video and tagging user respectively.
To achieve this, we extended the markdown syntax for both client-side preview and server-side post rendering. For the client side, we used the marked
library and some regex to extend the markdown syntax, while for the server side, we utilized the redcarpet
gem.
- [@(name)](link_to_user_profile)
- ![Video](youtube_link)
- ![Circuit](circuit_embeded_link)
Final Results:
Week 8
PR: https://github.com/CircuitVerse/simple_discussion/pull/28
This PR is currently in draft status as the implementation details are still being finalized. I was unable to meet with my project mentor, Aboobacker, last week, so we haven’t discussed it yet.
This feature is crucial to prevent users from filling our forum with similar questions and queries, as it will enable them to search across all forum threads. However, we don’t need highly advanced search indexing like ElasticSearch. After researching, we decided to use PostgreSQL’s full-text search capabilities.
Using the pg_search
gem, the implementation is straightforward. The steps include:
- Adding a new column in the
forum_thread
table to storetsvector
- Implementing a search method on the model to allow access like
ForumThread.topic_search
The challenge with this approach is that we are unsure if the host Rails application will use PostgreSQL, SQLite, or another database. To address this, I created two implementations of the topic_search
method: one for Rails applications using PostgreSQL and another for databases like SQLite or MySQL.
Final Results: You can see in the image below, the basic search functionality for the forum thread is now working as intended.
Finally, Thanks for reading this so far and have good day. If you have any question or anything wants to share ping me on twitter!