Live data from Hacker News

The technology behind GitHub’s new code search

github.blog

121–130 of 187 posts

Re: The technology behind GitHub’s new code search

#121
post #113

Will this allow for a happy closure of this question about searching partial words? [0] Like searching for "OPTION" and getting "-DOPTION=TRUE" among the results. Very commonly needed to find all usages of a flag, even instances where the flag is being passed to (at least, that I know of) CMake and Meson. [0]: https://stackoverflow.com/questions/43891605/search-partial-...

Yes. You can also use regular expressions to limit your search. Details: https://docs.github.com/en/search-github/github-code-search/...

Re: The technology behind GitHub’s new code search

#122
post #3

I use their new code search a lot to grok how people use certain features, or implement certain things. But I do wish there was a way to filter out forks. Sometimes I search a string and just get a bunch of forks all with the same result. For example, searching a common class in a Rails app often just shows a bunch of rails/rails forks, which is a lot of noise to sift through when you're trying to see how devs common…

Similar to this, there are some generated files it would be nice to rank very low, or even completely ignore, as they probably weren't intended to be committed in the first place. Some search results are dominated by files in paths like ".npm/_cacache/...", ".apm/...", ".svn/...".

Re: The technology behind GitHub’s new code search

#123
post #3

I use their new code search a lot to grok how people use certain features, or implement certain things. But I do wish there was a way to filter out forks. Sometimes I search a string and just get a bunch of forks all with the same result. For example, searching a common class in a Rails app often just shows a bunch of rails/rails forks, which is a lot of noise to sift through when you're trying to see how devs common…

I’m glad to see some folks in the comments section here using this. My first thought on seeing the headline was, “why not just use grep?”, which the article addressed. My second was, “who in earth wants to search all of GitHub?” I’m happy someone does.

Re: The technology behind GitHub’s new code search

#125
post #3

I use their new code search a lot to grok how people use certain features, or implement certain things. But I do wish there was a way to filter out forks. Sometimes I search a string and just get a bunch of forks all with the same result. For example, searching a common class in a Rails app often just shows a bunch of rails/rails forks, which is a lot of noise to sift through when you're trying to see how devs common…

When trying out some C++ I was surprised by how many projects bundled the library source code, essentially finding any actual client code a pain.

I have this issue with GitHub code search very often. I'll search up a function to see some examples of how to use it, and the first 20 or so pages of results are just copies of the source where its defined.

Re: The technology behind GitHub’s new code search

#126
post #23
post #3

I use their new code search a lot to grok how people use certain features, or implement certain things. But I do wish there was a way to filter out forks. Sometimes I search a string and just get a bunch of forks all with the same result. For example, searching a common class in a Rails app often just shows a bunch of rails/rails forks, which is a lot of noise to sift through when you're trying to see how devs common…

As an open source library maintainer I've been using it for that too - it's fantastic for answering questions like "is anyone using this API method I wrote?" and "how much of a mess would it likely cause people if I deprecated this function?"

Would be nice to make a tool automating this and printing the "coverage" statistics.

Re: The technology behind GitHub’s new code search

#127
The biggest problems I have with their code search are basic usability features, not the search itself. I need a way to exclude private repositories in the result so I’m not clogged by internal instances of what I’m looking for. I need the UI to improve so I don’t have to go to advanced search for every filter I want to do.

Re: The technology behind GitHub’s new code search

#129
post #121
post #113

Will this allow for a happy closure of this question about searching partial words? [0] Like searching for "OPTION" and getting "-DOPTION=TRUE" among the results. Very commonly needed to find all usages of a flag, even instances where the flag is being passed to (at least, that I know of) CMake and Meson. [0]: https://stackoverflow.com/questions/43891605/search-partial-...

Yes. You can also use regular expressions to limit your search. Details: https://docs.github.com/en/search-github/github-code-search/...

Great to know! I'll check the docs and see to try it out soon

Re: The technology behind GitHub’s new code search

#130
Interesting stuff, was curious how they search repeated letters through ngram index? I understand their example search with the string “limits” (find intersection of “lim”, “imi”, “mit” and “its”. However, if the user wants to search the string “aaaaa” how would they go about searching that?
Post reply on HN