Hacker News new | ask | show | jobs
by rococode 2832 days ago
This might just be me, but does anyone else feel that GitHub's code search has other points that could be improved first?

My biggest gripe is that the other results show in seems to be totally random. For example, if I have a Java class called A and I search "class A" in code search, the actual A.java doesn't tend to show up anywhere near the front. I just tried this in a repo and the actual A.java file was on the last page of results when I searched "class A". The vast majority of the results before it didn't even have the words "class" and "A" next to each other, which A.java does...

Maybe I'm doing something wrong (I'd welcome any input on how to use code search correctly!), but it just feels like they're jumping the gun on trying to make their code search more advanced when the basic functionality doesn't work that well.

2 comments

Yes, GH search leaves so much to be desired. And this post doesn't actually seem to address the weaknesses.

The search appears to be configured for natural language documents, not code. The stopwords are not right and search appears to strip all sigils. They could get pretty far just by parsing documents and changing their lucene/elasticsearch configuration.

We are very aware of the problem. I think you are going to really love what we are working on.
Is it some search algorithm that is so new, unusual and groundbreaking you can't talk about until it patented, or what?
I really hope you are right and have your priorities straight when it comes to search. I'd love for a way to search for usages of a class::method, or for strings that contain the text "hello" or for variables named foo. And if you integrate that into the code itself, Ctrl+click a class method to find all usages, maybe even usages in other repositories, so I can see how other people use a certain library.

And of course good old regex search.

Sourcegraph does this quite well if you need.
They are tagging so much code with text, that i'm sure they have something groundbreaking.