Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Searching content across multiple database tables and columns doesn't have to suck. Thanks to Postgres, rolling your own search isn't difficult. Following an actual feature evolution I worked on for a client, we will start with a search feature that queries a single column with LIKE and build up to a SQL-heavy solution for finding results across multiple columns and tables using database views. We will look at optimizing the query time and why this could be a better solution over introducing extra dependencies which clutter your code and need to be stubbed in tests.
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the video "Multi-Table Full Text Search with Postgres," presented by Caleb Thompson at RailsConf 2016, the focus is on leveraging Postgres to build efficient search functionalities within applications without relying on external search services. The session explores a practical feature evolution that begins with a simple substring search and evolves into a complex full-text search solution, utilizing database views for better organization and performance optimization. **Key Points Discussed:** - **Introduction to Search in Applications:** - Caleb begins by advocating for using the database as the primary search tool rather than external services, highlighting Postgres' capabilities. - **Basic Search Techniques:** - Discusses initial search methods using SQL's LIKE clause for basic substring searches. - Emphasizes the limitations of this approach for users who lack exact search terms or knowledge of casing. - **Introduction of Full Text Search:** - Describes the advantages of full-text search, including natural language processing features that refine search results by removing stop words and recognizing various forms of words (stemming). - **Database Views for Efficient Searches:** - Explains how to create database views that aggregate search queries from multiple tables, simplifying complex searches and enhancing performance. - Demonstrates SQL's CREATE VIEW syntax and its integration with ActiveRecord in Rails. - **Use of Gems for Enhanced Search Capabilities:** - Introduces Textacular, a gem that simplifies full-text search implementation in Rails applications. Claims that it supports a variety of search functionalities, which could be expanded as application needs grow. - **Managing Changes in Views:** - Discusses the importance of managing database views through migrations to keep the application’s data stable and updated. - **Future Feature Expansions:** - Illustrates how to adapt search mechanisms to include comments associated with articles, indicating a continuous evolution of search features. **Conclusions and Takeaways:** - The video reinforces the notion that with the right tools offered by Postgres, developers can implement robust and efficient search functionalities directly within their applications. By encapsulating complex logic in database views and leveraging libraries like Textacular, searching can be more intuitive for users and manageable for developers. This approach minimizes the need for extra dependencies, making maintenance and testing simpler.
Suggest modifications
Cancel