Live data from Hacker News

Show HN: Search code in GitHub repos using regular expressions

grep.app

31–40 of 165 posts

Re: Show HN: Search code in GitHub repos using regular expressions

#33

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!

I'm surprised as well, think why big tech companies didn't have this awesome search already.

Re: Show HN: Search code in GitHub repos using regular expressions

#34

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!

It also probably goes without saying he should be careful with what details to share.

Re: Show HN: Search code in GitHub repos using regular expressions

#35
post #6

Amazin, why Microsoft hasn't built this for GitHub yet is beyond me. Can it grep on individual repos?

Why would you want to use this tool to grep individual repos? If you know the repo you're interested in, you can just clone it and then grep it locally...?

Some things can take a while to clone. On the top end, repos like blink, webkit, and gecko can take half an hour or more.

Re: Show HN: Search code in GitHub repos using regular expressions

#36
post #12
post #7

How did you pick the 500k repositories to index out of the 28 million or so which are public?

It was based on the number of stars/forks and the size of the repository.

There must be something else or something wrong, because you indexed one of my small repo (~100 stars, ~20 forks, ~20Mb) and not the bigger ones (~500 stars, ~100/150 forks, ~150Mb)

Re: Show HN: Search code in GitHub repos using regular expressions

#37

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!

I'm surprised as well, think why big tech companies didn't have this awesome search already.

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.

Re: Show HN: Search code in GitHub repos using regular expressions

#38
post #6

Amazin, why Microsoft hasn't built this for GitHub yet is beyond me. Can it grep on individual repos?

Why would you want to use this tool to grep individual repos? If you know the repo you're interested in, you can just clone it and then grep it locally...?

I like to grep a code pattern through out all repos. I use gstreamer, and sometimes i just don't know how to use it to do a specific thing. So i search substrings to find out usage patterns by other people.

Re: Show HN: Search code in GitHub repos using regular expressions

#39
post #18

Why regex still exists? It is unintuitive, requires mastering an obscure syntax, it is very hard to debug, and very difficult to explain to others how it works. It feels like we are trying to write intermediate code by ourselves, while we should have a human readable language that generates regex.

Do it! You will find that it's very easy, but the result will either be extermely verbose or just like regex. Since most regexes (at least for me) are meant as one-time-use, the extra verboseness has no added benefit. If you have complex needs, you should probably be using something other that regex, anyways.

Extremely verbose is right. Here's one such approach in java that I found last year - https://github.com/sgreben/regex-builder.

Yeah, regex can be a bit clunky at times and has a steeper learning curve, but they're pretty industry standard at this point, and portable across languages with a few caveats.

Re: Show HN: Search code in GitHub repos using regular expressions

#40
post #11
post #2

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…

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.

This is so good I imagine you're gonna need more.
Post reply on HN