News for hackers. Stuff that matters.
Re:Code Search Is Hard by morgante on Wednesday April 10, 2024 @05:48PM (#39996066)
I've been surprised at how far you can get without indexing.

Ex. I always assume we'll need to add an index to speed up GritQL (https://github.com/getgrit/gritql), but we've gotten pretty far with doing search entirely on the fly.

Re:Code Search Is Hard by worldsayshi on Wednesday April 10, 2024 @06:08PM (#39996213)
What does 'on the fly' entail here?
Re:Code Search Is Hard by simonw on Wednesday April 10, 2024 @06:16PM (#39996278)
I'm going to guess brute force - scan everything for the search term, rather than trying to use an index.

I'm always amazed at how fast ripgrep (rg) can brute force it's way through hundreds of MBs of source code.

Re:Code Search Is Hard by morgante on Wednesday April 10, 2024 @06:39PM (#39996446)
Yes, exactly. When doing a search, we parse and search every file without any indexing.

Of course, it could still be sped up considerably with an index but brute force is surprisingly effective (we use some of the same techniques/crates as ripgrep).