Ask HN: Has GitHub Search always been broken?

29 points by gtirloni ↗ HN
Very often, I search something and there are zero results. But when I click on different sections (code, repos, etc), some results start to show up.

I think it has been like this forever and I can't remember when it worked properly. Maybe my memory is failing.

With GitHub and Microsoft investing so much in OpenAI, what's stopping them from having the best code search in the industry?

24 comments

[ 4.9 ms ] story [ 67.9 ms ] thread
Are you using the new GitHub search? https://github.com/search

It's still in beta (you have to request access), but it works great for me.

Yeah, I had similar thoughts until I switched to the beta. Still don’t understand why the existing GitHub search is broken, though.
any tips for advanced use of github search? For example I want to find cases of people using openai to parse unstructured text to JSON (I have a version working, but it was painful); or some good implementations of async openai (again, figured it out -- but being able to copypasta would have saved me hours). I have _never_ had much success with github search, including the one you've just linked. Just wondering if other people know something I don't.
Old search was better for global searches, I find the new search great for searching within an org.
It's been squirrely lately. Sometimes if you refresh, you get a different number. I just use the .dev version by pressing `.`
Recently it's failed to find functions by verbatim search name within single project searches. I am pretty sure it used to function better than this.
and also you cannot search by filenames, searching for "test_driver.cc" -> 0 results.
Yes. I wouldn't say it got bad, more like it's been useless since day 1.

Every single time I have used it in the past 5+ years, it hasn't been returning all the results I expected, and now I actively avoid it. Its advanced search filters are far too limited.

If you need to search a repo for a term, you'd be better served by cloning the repo and running ripgrep on it.

(What does OpenAI have to do with anything? Code search is not rocket science.)

> what's stopping them from having the best code search in the industry?

The people who would notice and improve the function probably grep their code.

You're right but the only time i'll make a search on a git UI (don't use github much) is when not knowing which repo something is in. can be especially frustrating with big companies etc
I agree: GitHub's search is important because people build organizations with a hundred tiny repositories and you need to figure out which one actually has the library with the function being called; if I know what repository the code is in, then I would (of course) just use grep.
I like how you think that just slapping on some "AI" will automagically make search better.
(comment deleted)
I believe they must have other higher priority items, esp after takeover /acquisition by MSFT.!

To be honest, I’ve never much had to use their search as much as other functions.

Yes, it's always been broken. You can search for an identifier that exists in code on the main branch and get zero results.
The new Github search beta is actually epic, I highly recommend switching. There's no reason to stay on the old one, they're clearly devoting the dev effort to shipping the new version (which makes sense).
As a GitHub engineer, as far as I know we do this because we want more users so we can flesh out bugs, but we don't want to ship buggy software. If we were to globally ship this (even in a beta) and some really annoying bug was found, users would complain. Or if we let everyone opt in all at once, maybe the feature consumes a ton of resources and causes an unexpected outage. This slow rollout lets us keep a handle on things while still letting our most passionate users try things out.
Maybe a bit off topic but I dislike the recent change that makes searching within a repo the default if you’re in one and you click on the search bar.

I’ll hit “T” if I need to search a repo. The search bar is 100% only used for navigating between repos.

In your opinion, what is the best code search in the industry so far ? Sourcegraph? Mergestat ?
I had this thought today. Searched for "timeout.py" in Cpython. 0 hits.

It's right there in Lib/asyncio for Christ's sake!