TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to build a search engine with Ruby on Rails

196 pointsby alokraiover 3 years ago

7 comments

gschoover 3 years ago
This is a bit off topic but I wanted to say I’m really glad there are still people out there hacking on some ruby + Postgres projects and writing about it. I feel that ruby is an excellent language and dread the demise of it.
评论 #28560388 未加载
评论 #28560607 未加载
评论 #28561713 未加载
评论 #28560641 未加载
评论 #28561728 未加载
评论 #28561276 未加载
gouda-goudaover 3 years ago
Ruby is alive and well. We don’t use Rails specifically (Hanami + ROM.rb + DRY.rb), but absolutely love Ruby as a language and the ecosystem surrounding it. It’s productive, and as powerful as you need it to be.<p>When it comes to building feature-rich web applications quickly and sanely, Ruby is still hard to beat IMO.
评论 #28562683 未加载
pqdbrover 3 years ago
Great article. By the way, ActiveRecord&#x27;s #merge is golden, and I&#x27;m under the impression it&#x27;s not as mainstream as it should be.<p>I use it extensively to avoid duplicating scope code.<p>For instance:<p>class Listing<p><pre><code> scope :active, -&gt; { where(&quot;expired_at &gt; ?&quot;, Date.current).where.not(suspended: true) } </code></pre> end<p>class User<p><pre><code> has_many :listings </code></pre> end<p>So instead of doing this (which is terrible):<p>user.joins(:listings).distinct.where(&quot;listings.expired_at &gt; ? AND listings.suspended != FALSE&quot;, Date.current)<p>You can simply:<p>user.joins(:listings).distinct.merge(Listing.active)<p>Rails docs are amazing, but #merge doesn&#x27;t get enough love. Maybe I&#x27;ll issue a pull request to improve it with some examples like this and the ones from the article.
评论 #28567110 未加载
Toutouxcover 3 years ago
I love the section about getting rid of Active Record only to discover that the handwritten SQL equivalent is unmaintainable and slower.<p>Also if you&#x27;re on the fat-models team and you have lots of behaviors and business logic on your models, it&#x27;s often easier to just go with Active Record, because the second you wander off the beaten path (e.g. handwritten joins) you start dealing with weird franken-models that contain attributes from multiple tables, but not their behaviors (methods, callbacks).
gsinkinover 3 years ago
Great post at the perfect time. I am currently wrestling with some gnarly, expensive queries in postgres and this gives me some great leads to try out.<p>Also, I appreciate the Rails love.<p>I know this is not a Who Is Hiring post, but if you are into Rails&#x2F;Postgres and in the market (between UTC-4 and UTC-8 timezones), feel free to send me a note: gabe at instrumentl.com. We are doing some &quot;biggish&quot; data work helping nonprofits find grants and other fundraising opportunities.
elesbaoover 3 years ago
Good post, well written, taught me a couple of things I didn&#x27;t knew and uses Ruby in a clean way. I don&#x27;t think it meant to be uber scalable but last time I had to build search in ruby I had to use Ferret (a great lib) and it was not this straightforward.
moffkalastover 3 years ago
Everyone asks how to build a search engine with Ruby on Rails, but nobody asks why build a search engine with Ruby on Rails...