Lurker News

Comments (155) 49 threads

jasoncwarner5 replies#
This is awesome!

@danfox, sent you an email though commenting here too.
I'm the CTO @ GitHub. Would love to talk to you about this and other things we are building in this area at GitHub.
Feel free to email direct to jason at github.com

sixwing#
hah. you beat me to it, Jason.

@danfox, i'm always down to talk code search as well - rand@github.com

latenightcoding4 replies#
github's code search is notoriously bad, feels like a huge missed opportunity. Nice to see you guys reaching out to other people working in this area.
lucasverra#
I'm not a dev and what i like to to do is go searching for code (a la exact match) to replace whatever variable or text should be changed. Github search in repo kinda worked at some moment, then not.

Then i had to download repo in my local; run VS code (updating first), search there, modify, push. I wish i could do this on Ghub web GUI

erikpukinskis2 replies#
The fact that you can’t search for file names is the funniest part to me.
nickthemagicman3 replies#
You can but only in the repo itself not on a site wide scale.

Continue this thread — 3 replies

WhiteOwlLion#
If you fork a repo, you can't search on the forked repo. Confirmed grep.app behaves the same way as github search.
aantix#
Agree. You can’t even do a literal search with symbols.

I think there were better solutions on the early 2000’s.

glangdale1 reply#
iirc, Github uses (used?) my old project (https://github.com/intel/hyperscan) at Intel. It's probably faster than the alternatives, although if you want to support all types of regex you'll need to use Hyperscan as a prefilter for a richer regex engine like PCRE.

This project looks like it pulls literal factors out of the regex that I type in, maybe to an index a la that Russ Cox blog post a while back about Code Search. It seems to Not Like things that have very open-ended character classes (e.g. \w) unless there is a decent length literal involved somewhere.
It seems to have a very rudimentary literal extraction routine, as it decides to give a partial result set when fed an alternation between two literals that it handles pretty well on their own.

glangdale1 reply#
pattern is, btw: (teakettle\w|abcd)

Either pattern in alternation works fine, but even a simple alternation of the two goes back to the behavior that you might expect to get from awful patterns like \d..\d..\w...\s...\d (i.e. reporting only a partial set of matches).

michaelmior1 reply#
Did you mean either patter in "isolation"?

Continue this thread — 1 reply

sovietmudkipz1 reply#
I do enjoy moments like these on hacker news when someone presents a project for X and the CTO of X shows up and wants to talk. It shows how directly of an impact one can potentially have in this community.

I hope this means we’re getting grep searches for github soon. Cheers.

travbrack1 reply#
If OP's goal was to get a job at Github, I'd say this was very well played.
sdesol1 reply#
It would certainly be an expensive play. When he mentioned a 20 core system, I'm assuming it is some VM system, since I don't know of any 20 core CPUs. I'm guessing he is using DigitalOcean and he has two of them, so he is looking at $1000 a month in hosting cost.

Continue this thread — 1 reply

WhiteOwlLion#
How about the ability to search code on forks? GitLab allows it. At least have feature parity? Thanks.
simonw2 replies#
Impressive! Really fast, full featured code search across a huge corpus.

1. How did you build the index? Did you use a GitHub dump of some sort? How often do you refresh it?
2. Is it Elasticsearch or similar or a completely custom engine?
3. What kind of RAM/CPU are you using to power it?
4. Any plans to open source the code or commercialize the technology?
I could absolutely imagine paying for a private code search engine like this to run against a large internal company codebase spread across many repositories.

danfox3 replies#
Thanks! It's built on top of Solr. It fetches the repos from GitHub - it should pick up any updates to repos within a few days. It's running on a couple servers with 20 cores each, which is not really enough for the traffic it's getting right now.
ngold#
This is so good I imagine you're gonna need more.
rattray#
Have you seen livegrep?

Blazing fast multi-repo regex code search. May be more expensive to run in prod, not sure.

1024#
Cool!I love it.
heipei1 reply#
I'd be curious how you built the step from regex to ElasticSearch. My guess would be an n-gram (3-gram) index in ElasticSearch and then translating the regexes to that, but just curious if you built that custom or used something off-the-shelf. Love the site!
speedplane#
> I'd be curious how you built the step from regex to ElasticSearch. My guess would be an n-gram (3-gram) index in ElasticSearch and then translating the regexes to that, but just curious if you built that custom or used something off-the-shelf. Love the site!

I'm pretty sure Elasticsearch supports regex search, it's just that it's horrendously slow and can blow up the system.

dang1 reply#
I still miss Google Code Search, which was a great way to find examples of anything I wanted to learn about in programming and usually answered my questions better than anything else, including Stack Overflow. Has it really been 8 years... https://news.ycombinator.com/item?id=3112029

If this tool can fill that hole in my world, I'll be stoked. I've bookmarked it.

londons_explore1 reply#
Google code search still exists as long as you want to search Chromium source code.

[1]: https://cs.chromium.org/

londons_explore#
The main difference it has IMO is it indexes a symbolic code graph extracted from halfway through the compilation process. That means when you search, it knows which functions are frequently called. For example, the LOG() macro is defined in hundreds of places, but the one in logging.h is the one everyone calls, so that's the one that comes top of the results.

It also keeps track of back references, so you can search "who calls any function in this file", which is very hard to do with any other search system.
Major disadvantages are it only indexes one build config, so if you're debugging android code in a multi-platform project and the indexing was done on the windows version, you won't find much (apart from dumb text based search which it does in addition).
The difficulty of compiling every project to build a decent index would make this approach hard on a GitHub scale - all it takes is one missing header file from a dependency not in the repo and the build fails and the whole project can't be indexed. Also, have fun with things like JavaScript which are so dynamic you have to solve the halting problem to know which bit of code calls which other.

thanatos_dem5 replies#
Next post from danfox - “how to get 3 job offers in 3 hours”.

Already has been publicly contacted by:
- GitHub CTO
- SerpApi CEO
- SourceGraph CEO
Search is hot right now!

Existenceblinks1 reply#
I'm surprised as well, think why big tech companies didn't have this awesome search already.
thanatos_dem2 replies#
If this were to be offered by an actual company (a first party solution), there are some features that'd be expected that make the problem space a lot harder. Here's an "intro to search" article that's a good read, and I'll use it to highlight some of the things that'd be different in a first party solution - https://medium.com/startup-grind/what-every-software-enginee...

(See the "Theory: the search problem" section)
Size: This is only indexing ~500k public repos. A first party solution would be expected to index all of it, public and private.
Indexing speed: This can take up to a few days to index. A first party solution would be expected to have a much lower index latency - seconds to minutes.
Query language: This can (and does) have its own simple query language. A first party solution would need to have support embedded into and not break backwards compatibility with the current query language.
Context-dependence: A first party solution would be expected to index private repos as well, and now the query context (logged in user) becomes another variable in an already multi-variate problem space.
Latency: Gets harder with scale, and a first party solution would likely provide a SLA/SLO around latency.
Access control: Same issue as context-dependence, with private repos being included.
There's also unknown but likely considerations around compliance and internationalization, which are quite tricky problems.
Note - I don't mean for this to be critical of the author at all. This is an awesome and useful tool, with a fantastic UX. I just want to make it clear that search at scale is a lot harder than it seems at first glance, especially as the feature requirements increase.

sdesol2 replies#
For GitHub, I would have to imagine only being able to search public repos with regexp would be good enough. GitHub has many strategies, but the main one is, they want to maintain, if not, expand their open source mind share.

The more reasons you give people to go to GitHub, the better off they will be in the future. So I do agree with you that as a commercial solution, this may not be viable, but for GitHub's public repos, this can turn into a very positive thing.

Continue this thread — 2 replies

fjania#
Engineering manager for code search at GitHub here... this is an excellent summary of many of the concerns we have as we work on code search at GitHub scale!
sdesol#
It also probably goes without saying he should be careful with what details to share.
swat5354 replies#
Actually, It would more be like: "How I failed at 3 interviews, despite being directly contacted by execs."
runawaybottle#
That would be quite the dystopian interview nightmare.
nickthemagicman2 replies#
Sure you built app on multi 20 core machines with functionality to search hundreds of millions of lines of code almost instantaneously, but are you someone I'd drink a beer with?
tmpz22#
For some of those companies it would be "drink a La Croix with"
yakshaving_jgt6 replies#
This snide remark dismisses the fact that working on software does mean working with other humans, not just unemotional robots devoid of any kind of irrational ideas. Being able to “drink a beer with” (and reasonably substituting the drinking of beer for just about any other social interaction) is an important part of being able to work with someone. Unless of course you believe an office environment consisting of a tyrannical manager barking orders at worker drones is a healthy relationship.

Continue this thread — 6 replies

wolco1 reply#
Couldn't whiteboard a solution without the temp variable.
SlowRobotAhead#
I’m in a field and physical area with a pool so shallow - that it seems like straight up madness to throw questions like that at people and kick them out the door for it.

Continue this thread — 1 more reply

Continue this thread — 1 more reply

Load more comments