13 ms·
Improving GitHub Code Search
- latenightcoding 5y agoI always though Github's bad search functionality was a business decision. It was so bad for so long. Even if basic improvements are significantly harder at their scale, I just can't comprehend how Microsoft left something so potentially useful be so bad for so long.
- deleted 5y ago[deleted]
- v1g1l4nt3 5y agoYeah, I'd bet on https://about.sourcegraph.com https://about.sourcegraph.com. Fully focused on code search and are still light years ahead.
- ju-st 5y agoIs there any good reason why the search doesn't find file names? Or does it now with the new search?
- colin353 5y agoThe new search does find filenames! :D
- jkelleyrtp 5y agoSeems to be that Rust's killer app is burntsushi's mind and ripgrep. :-)
- mandeepj 5y agoRelated, I believe or at least worth sharing - https://news.ycombinator.com/item?id=22396824 https://news.ycombinator.com/item?id=22396824
- hemantv 5y agoThey should just buy sourcegraph I always have sourcegraph externsion installed it so much better than GitHub search.
- arthur6667 5y agoThank f for this. Github search has been complete garbage for years tbh. Being able to search, for instance, for 'def method' and not finding EVERY other def first is gonna be kinda nice
- oezi 5y agoAny idea how to get further ahead on the waitlist for co-pilot?
- deleted 5y ago[deleted]
- beached_whale 5y agoI just want to say about time. A lot of the time when using libraries with inadequate documentation, being able to find usages of a method or class gives really good insight into the library. But the current code search's stemming removes all the context needed to find that and then gives alternate spellings too.
- Falell 5y ago> Search for an exact string, with support for substring matches and special characters, or use regular expressions (enclosed in / separators). Finally! Search-for-literal is so important when you have technical users working on non-prose text. They say this is going in a dedicated search page 'to start with', if "<literally any text>" doesn't work in the top bar eventually this is still going to be miserable.
- colin353 5y agoI'm from the team that developed this at GitHub - if you are in the technology preview, then you can jump into cs.github.com from searches done at the top bar.
- gavinray 5y agoThank you I use Github's UI for exploring and searching codebases more often than my own environment, since I do a lot of curious browsing. No offense, but the search is so bad for anything worse than a single word, that I've developed a sort of intuition for how to phrase things -- and then still spend a lot of time crawling pages of results haha. This was sorely needed
- colin353 5y agoCouldn't agree more - that's why we built it! Please give the new search a shot, I think you'll like it :D
- AbdallahMansour 5y agohow to get access to the new search :)
- dstaheli 5y agoHi Abdallah. If you haven't signed up yet, you can do so here: https://github.com/features/code-search/signup https://github.com/features/code-search/signup. People on the waitlist are getting access as quickly as the team can support it.
- cosentiyes 5y agoThe addition of exact match search is so exciting that I haven’t internalized any of the other new features. I’ve abandoned an ungodly number of semi-common-word searches after getting 30 pages of results in a monorepo
- philsnow 5y agoI didn't even see this in the feature list before doing the signup. One of the signup questions is "how do you usually search?" or so, I wrote in the blank "I want to search for symbols, not substrings, so if I'm searching for `bar` I don't want `foo_bar` to show up as a match". I usually do this with word boundaries in regexes, but I pretty much have to have the repo downloaded, so it's useless for searching on github.com this way.
- Petesta 5y agoGlad to see GitHub’s search has improved. I hope GitHub finally improves the search functionality on gists. You can’t search your own gists by name.
- tyingq 5y agoAh, great. GitHub throwing out special characters in searches was infuriating for languages with sigils and patterns, like $somevar or %sql% and so on.
- jimsimmons 5y agoSlight tangent: The video has a guy describing the tool and he includes the fact that it’s written in rust when introducing it. I’ve always found this sort of name dropping in rust projects/devs baffling. Is there anything that I’m expected to infer from it? Is it that it’s backend is memory safe? I can’t think of anything else. Now it may very well be very memory safe but why include that highly specific detail when talking about a very high level thing that is the UX of search. What if it was written in Haskell or C#? Would it still be brought up? It’s almost as if being written in rust is a feature in itself these days. As a technical guy I can’t help but take the person less seriously, especially when it’s as unwarranted as this.
- qaq 5y agoIt's obviously personal preference but as a technical guy I am always curious what lang. a project is using.
- t3rabytes 5y agoGo had this issue for a while, too, it's finally started to calm down as Go hits a mainstream that is (imo) much farther than Rust is currently. I think much is just people trying to add validity to Rust for large-scale production workloads, in the same way that Kubernetes was "a compute scheduler written in Go" or Terraform was "infrastructure as code written in Go" (maybe those are bad examples, but I know I've seen the "X written in Go" thing going on).
- gscho 5y agoThis is exactly how I see it as well. Rust used to be an obscure language with a compiler written in OCAML. If something was written in D or zig, it’s noteworthy so you mention it. I think rust has come into the mainstream enough that we can drop the “written in rust” line imo.
- eyelidlessness 5y agoI think depending on where the audience is coming from—for example people who primarily work in scripting/interpreted languages—Rust can also be a positive signal for performance.
- nerdkid93 5y agoI wonder if it is the followup to this conversation from last year when https://grep.app https://grep.app was released: https://news.ycombinator.com/item?id=22397728 https://news.ycombinator.com/item?id=22397728
- judge2020 5y agoProbably not, they've been looking at/working on improved Code Search since 2019: https://youtu.be/9EoNqyxtSRM?t=1726 https://youtu.be/9EoNqyxtSRM?t=1726
- francislavoie 5y agoIt really looks like they took a lot of inspiration from https://sourcegraph.com/search https://sourcegraph.com/search with this. Not a bad thing at all. I hope SourceGraph doesn't get obsoleted by this though, they're great people.
- lancemurdock 5y agohad a pretty awful interview experience there a while back. Can't say I experienced great people
- sqs 5y agoSourcegraph CEO here. I'm really sorry about that. We work really hard on making our interviews good for everyone, including documenting it publicly at https://handbook.sourcegraph.com/talent/interview_process https://handbook.sourcegraph.com/talent/interview_process. Could you please email me at sqs@sourcegraph.com so I could find out what happened?
- gavinray 5y agoI've met two of their devs randomly in different Discord servers. Both were great people (Noah, Olaf) and are very active in OSS communities. Perhaps not coincidentally, both worked on Language Server related stuff. Ólafur is responsible for a lot of Scala tooling and some pretty neat original ideas. Sourcegraph also came up with LSIF, which is useful format for building tooling for language servers: https://lsif.dev https://lsif.dev If you want to build this sort of stuff, the work Sourcegraph has done with LSIF + SemanticDB is probably your easiest bet. N=2 isn't great, but there's my experiences if we're tossing them out there.
- mholt 5y agoI'm surprised... I absolutely loved my interview with Sourcegraph. I kind of wish every tech company interviewed like they do.
- anandchowdhary 5y agoI interviewed for Sourcegraph and it was one of the best. Super transparent process, open source handbook, fun coding tasks -- really nothing to complaint about. Would be curious to know what made you have such a different experience.
- remram 5y agoMeanwhile on GitLab, you can't even search in issue comments (only the title/description from the author).
- john_cogs 5y agoGitLab team member here. Comment (and code) search is available for projects in all GitLab tiers: https://docs.gitlab.com/ee/user/search/#basic-search https://docs.gitlab.com/ee/user/search/#basic-search Premium and Ultimate users have access to Advanced Search: https://docs.gitlab.com/ee/user/search/advanced_search.html https://docs.gitlab.com/ee/user/search/advanced_search.html
- remram 5y agoThere is a way to search for comments using the "global search", but no way to search for text over issues and their comments. In particular, no way to search from the issue tab, no way to search over comments only in issues (or only in merge requests), no way to combine a text search with label/milestone/status filters, etc. So it's a workaround, but a bad one. Here's the ticket (2015): https://gitlab.com/gitlab-org/gitlab/-/issues/13891 https://gitlab.com/gitlab-org/gitlab/-/issues/13891. The fact that it has so many duplicates in your own project's issue tracker is a good indicator of how bad your issue search is.
- boleary-gl 5y agoGitLab team member here. > no way to combine a text search with label/milestone/status filters, etc. You can combine text search with field search (like label/milestone/status. Here’s an example: https://gitlab.com/gitlab-org/gitlab/-/issues?search=Visualization&sort=created_date&state=opened&label_name%5B%5D=Category:Code+Testing+and+Coverage https://gitlab.com/gitlab-org/gitlab/-/issues?search=Visuali...
- remram 5y agoThis doesn't search over comments.
- jrochkind1 5y agoI love how the Microsoft acquisition continues to result in increased investment in github with microsoft's resources, and real vision; not always how an acquisition goes.
- adamnemecek 5y agoMicrosoft has always been a dev tool company.
- NmAmDa 5y agoI doubt that before WSL this would be something. I mean developing on windows was always far lot difficult than Linux or MacOS.
- adamnemecek 5y agoIt depends on what you were developing.
- johannes1234321 5y agoWin32 API isn't nice, but Microsoft was always relatively good with documentation etc. and don't forget all the developer support within Excel, VBA, Visual basic etc. Bill Gates early on understood the premise of building a platform and not breaking it. Even if that meant win32 API became ugly over time. Old windows programs still work on newer releases.
- einpoklum 5y agoYou wouldn't know it looking at MS Visual Studio though.
- bigyikes 5y agoWhat makes you say that? I love to hate on Microsoft, wouldn’t touch Windows with a 100ft pole, but I always give credit to Microsoft for VS, VS Code (and my favorite languages, TS and C#). I admittedly haven’t used Visual Studio in a while (though I use VS Code daily) but I remember it as my favorite IDE. Certainly better than XCode, and I even preferred it to IntelliJ.
- leaded_syrinx 5y agoThis is great, specified search on GitHub has previously been very hit or miss. Generally I use the search feature for learning / trying to see if something I'm trying to do already exists. I personally think vsCode has the best code search implementation, in terms of "exact", "partial" and "regex" matching. The UI is clear, non-technical team members can navigate their way around it and it's relatively fast assuming you don't have too many extraneous plugins installed.
- murat124 5y agoNot sure if it's good enough to replace https://grep.app/ https://grep.app/
- 100k 5y ago(I worked on this.) Give it a shot and let us know what you think! Where can we improve it?
- beltsazar 5y agoWhat kind of indexes do you use to provide regex searches?
- johndough 5y agoToday I wanted to search for "strstr[a-z]+?_r" but got the error message "This is a partial result set. The search was stopped early because it would take too long to check every file for this regular expression.". However, I got results for the less restrictive regex "strstr.+?_r" which is weird since I'd expect that it would be easier to return results for more restrictive regular expressions. Not sure if there is a perfect solution for this, but in many cases, you could probably search for the less restrictive version and filter the results with the more restrictive one after that. Also it would be great if more repositories were indexed. How do things work behind the scenes? Maybe it is possible to build a more memory-efficient index just for exact string search, which probably make up most searches. Anyway, this website is amazing and I use it quite often. Thank you a lot for working on this!
- 100k 5y agoThanks for the feedback, we're working on some changes to improve regular expression performance. We're also working hard to increase the number of repositories indexed. :)
- olafurpg 5y agoYou can search for that regular expression on Sourcegraph (disclaimer: I work there) https://sourcegraph.com/search?q=context:global+strstr%5Ba-z%5D%2B%3F_r&patternType=regexp&case=yes https://sourcegraph.com/search?q=context:global+strstr%5Ba-z...
- oever 5y agoCode search on GitHub is only available to people that log in with Microsoft. Clicking on 'Code' redirects to the login page. It is not a friendly site. Open source projects would do better to use an open source code forge like <https://sr.ht/ https://sr.ht/>.
- adamnemecek 5y agoI hope they add deduplication. I can’t count the number of times when I get 100 pages of results where 95 pages is from the same included library.
- 100k 5y ago(I worked on this.) This is on our radar! We de-duplicate exact matches now, but we'd like to do the same for near-similar documents.
- elliottcarlson 5y agoDe-duping exact matches is a game changed -- search has been miserable to use because of the dupes for so long. I can live with near-similar documents. Very excited to test this out.
- colin353 5y agoAnother GitHub Code Search developer here - to add more to this, we rank all the search results, and try to bring the most relevant results to the top. Ideally, if you have 10 pages of results, you shouldn't have to leave page 1 to find what you're looking for :D
- sumtechguy 5y agoThat would be a tough problem. As de-dup you probably want to show/point towards the 'original' tree. But which one is the source? Or even worse someone abandons a project but someone else forked it and kept going should it show that one instead? Or should it show the one it was forked from depending on the version number. Which one is the 'true' repo now? Most certainly an interesting problem.
- adamnemecek 5y agoI kind of don't care about correctness. Just hide results that seem to be duplicate.
- bsagdiyev 5y agoNow can they fix doing a language search for “Visual Basic”? If you filter a users repos or stars on that language it just shows all their repos or stars. Code search for language “Visual Basic” returns all repositories and does not limit by language like it should.
- dvirsky 5y agoAre there any open source powerful code search engines out there? As a Googler the internal code search we have here is one of the most incredible things I've ever seen, it's so fast and powerful I'm amazed by it daily. Is there anything near that quality out there?
- toomuchtodo 5y agoIf you don’t mind me asking, any insight into why it hasn’t been open sourced?
- dvirsky 5y agoThere is some older version that's open source, I haven't tried it and I don't know how much of today's code search is based on it. https://github.com/google/codesearch https://github.com/google/codesearch
- profquail 5y agoHoogle is pretty neat — you can search by type signature and it’ll find matching APIs from hackage packages: https://hoogle.haskell.org/ https://hoogle.haskell.org/ Source: https://github.com/ndmitchell/hoogle https://github.com/ndmitchell/hoogle
- beliu 5y agoWe built Sourcegraph taking inspiration from Google Code Search (https://about.sourcegraph.com/blog/ex-googler-guide-dev-tools https://about.sourcegraph.com/blog/ex-googler-guide-dev-tool...) to bring the power of code search—and precise code intelligence that just works—to every dev. Try it out here: https://sourcegraph.com https://sourcegraph.com. A super common thing we see is people leaving Google, missing code search, and then bringing Sourcegraph into their new org. We'd love to hear your feedback!
- beliu 5y agoSourcegraph is open-core, with a dual licensing approach. You can run the open-source version here: https://github.com/sourcegraph/sourcegraph#sourcegraph-oss https://github.com/sourcegraph/sourcegraph#sourcegraph-oss, and we have an enterprise offering for companies that want to adopt for their teams. Similar to GitLab, both our enterprise and OSS code is publicly available.
- kevinsundar 5y agoSecurity researchers are gonna love this :) Time to go secrets and url hunting.
- jayflux 5y agoYou could already do this, grep.app for example has existed for a while. This is just bringing those features in-house.
- kevinsundar 5y agogrep.app doesn't index all repositories on GitHub though. I was doing some research a few months ago and couldn't find anything that would search all of github quickly.
- majso 5y agoThis is great! As a project manager I am using github search everyday when I am searching for specific methods or part of the code in order to find logical issues or bugs in a code.
- adamnemecek 5y agoI use github search a lot and this would be an insane productivity boost. I signed up for the waitlist. Does anyone working at Github want to bump me in the queue? This is my profile https://github.com/adamnemecek/ https://github.com/adamnemecek/
- v1g1l4nt3 5y agoYou can skip the wait and use https://sourcegraph.com/search https://sourcegraph.com/search instead.
- adamnemecek 5y agoI just got access to it. I'm not sure if someone here helped but if yes, then thank you very much.
- trinovantes 5y agoStill waiting for the ability to search in other branches. It's a pain when some codebases have stable releases on the next/dev branch but keep their main branch to the previous release.
- namrog84 5y agoAbsolutely. I get they don't want to index every branch but at least set some heuristics like it it has a certain amount of activity or something per repo. Or even allow repo to opt into 1 to 2 other branches besides main. Especially for bigger projects That'd cover 95% of repo I've seen.
- tex0 5y agoThat will blow up the size of the index a lot. Need to be clever about this.
- v1g1l4nt3 5y agoYou can do that with Sourcegraph: https://srcgr.ph/search-branches https://srcgr.ph/search-branches
- MrStonedOne 5y agoI can't use source graph to search a public repo I work on without granting them read access to every private repo I have. Attempting to deny just that permission causes it to error out. So I'll summarize that no, you can not do that on source graph, given that doing so would require everybody violating their ndas.
- beliu 5y agoAppreciate the feedback here (Sourcegraph CTO). I agree that's annoying. Kicking off a conversation on our end to figure out how to fix that. In the meantime, the workaround would be to create a separate GH login, which can be used to add any public repo to our index. Or what's the URL of the repo(s) you'd like to index and we'll get those added to our index.
- 5y ago
- savanpatel 5y agoWhy does it matter to speak they built in rust in demo video? It should not matter to customers.
- W0lf 5y agoGreat. I'm using grep.app[1] usually as for me the GitHub search is mostly useless. Your mileage may vary though. That being said there are many other great search interfaces that I am using often when I'm trying to find solutions to common problems or specific design patterns. Chromium search[2] comes to mind, Mozilla's Firefox[3], Android[4] or of course Google[5] [1] https://grep.app/ https://grep.app/ [2] https://cs.chromium.org/ https://cs.chromium.org/ [3] https://dxr.mozilla.org/mozilla-central/source/ https://dxr.mozilla.org/mozilla-central/source/ [4] https://cs.android.com/ https://cs.android.com/ [5] https://cs.opensource.google/ https://cs.opensource.google/
- AtNightWeCode 5y agoOf all the tools I use on a daily basis Github is probably the worst. I mean the "Find a repository..." input field on the start page can not even filter out named repositories I have access to in all my organizations. It works for some repos but not all. Search improvements? It is impossible to create a worse search experience than Github. Just clone and use git grep instead in most cases. Edit: ...and the 425% price increase for SSO..
- oubliette 5y agoTry constraining your search in Google/DDG with: site:github.com query
- post-it 5y agoCould be worse, could be Reddit search. (Granted, this is largely due to a culture of titles like "Check out this thing" that provide zero searchable metadata + no tag system.)
- v1g1l4nt3 5y agoNo need to clone if you just use https://sourcegraph.com/search https://sourcegraph.com/search.
- l0b0 5y agoNow, can we please get GitHub issues back into third party search engines? Now, whenever I search for something I know is in an issue I only ever get results from those crappy GitHub scraper sites. This is happening on both Google and DuckDuckGo.
- valtism 5y agoI don't think Github has any control over this without changing their content license.
- patrickdevivo 5y agothis looks awesome! two things I've always wanted and haven't found satisfying solutions for in code search (in an editor) 1) an ability to easily express higher level concepts in a search that's aware of code semantics ("match only function names", "find call sites of a method") etc. Maybe this is possible with existing tools (probably is?) but I tend to get lazy about learning DSLs - would love to see this in a UI if it's possible 2) ability to save searches I do frequently - after a certain level of complexity in a query (I've added ignore rules, I crafted the right regex, etc), I want to be able to save the "context" of a search so that I can easily return to it later
- colin353 5y agoGitHub Code Search developer here: > would love to see this in a UI if it's possible We do have code navigation via the UI, so in a way it's possible! > ability to save searches I do frequently Absolutely! This is possible using "custom scopes". If you're in the technology preview, click on the scope dropdown, scroll to the bottom, and choose "custom scopes". You can make a custom scope to search a set of respositories, a particular language, within a directory, or any combination with boolean operators!
- Serow225 5y agoI wonder if “custom scopes” is going to be a recognizable term for people?
- pianoben 5y agoI've been in the preview for a bit. 1) This doesn't seem to exist in quite that way, but you can prefix a literal with "def:" and the engine will return only definitions of that thing (so far as it can tell). It's not quite what you (or I!) want, but close. 2) This exists and is called "scopes". On the landing page, to the left of the search bar, click the grey pill that says "All repos". At the bottom there is a "custom scopes" option.
- colin353 5y agoMight also be worth checking out the syntax guide: https://cs.github.com/about/syntax#symbol https://cs.github.com/about/syntax#symbol
- deleted 5y ago[deleted]
- deft 5y agoI always thought the search was purposely bad and overly limited to prevent scraping for credentials.
- questiondev 5y agoi was actually really surprised that this did not exist when i went to search github for the first time. you would think that an open source giant would have this ability but i guess there is a ton of computational load to achieve search in general. i’ll probably get downvoted for bringing up a whacky idea, but imagine having some type of referencing system that is done through multi node p2p, so searching certain systems using shared resources. i guess the major problem would be if devs would actually spare some of their personal computational resources to help the community find things and not rely on special interest groups. i get it, i am old school as well. i started out on pascal and BASIC. but still think using creative solutions is fun. but you know, napster was cool back in the day prior to their lawsuits. and p2p was starting to pick up speed
- throwamon 5y agoThere was a recent post on search engines where I believe a P2P solution was mentioned (but maybe it was on some related post within a few days of this one): https://news.ycombinator.com/item?id=29417061 https://news.ycombinator.com/item?id=29417061
- heipei 5y agoCurious if this is something completely bespoke or simply a beefy ElasticSearch cluster which uses the (relatively) new "wildcard" field for enabling regex search on select fields. The search syntax certainly maps 1:1 to the ElasticSearch Query String syntax, including phrase search, boolean operations, grouping, regex search, etc.
- 100k 5y ago(I worked on this and the prior version of code search that uses Elasticsearch.) It is a custom search engine, built from the ground up for code. We'll be sharing more details about it on the GitHub blog soon.
- AbdallahMansour 5y agoI use github search a lot and this would be an insane productivity boost. I signed up for the waitlist. can you please nudge me in the queue? This is my profile https://github.com/abdallahmansour6 https://github.com/abdallahmansour6
- beltsazar 5y agoDoes anyone know (or guess) what kind of index they use to provide regex searches? I'm really curious.
- 100k 5y agoWe'll be sharing more details soon on the GitHub blog.
- zxienin 5y agoI have 10 different git + github instances across my org. (~50k strong workforce, pre github repos, m&a etc). Does this cs offer aggregated searches across all those distributed repos?
- dstaheli 5y agoHi zxienin. I'm a GitHub product manager. May I assume the GitHub instances you're describing are GitHub Enterprise Server instances? We plan to bring advanced code search features to all GitHub plans including Enterprise Server once we've stabilized the UX and feature set. But it sounds like your situation goes beyond that, where the search needs to include code from Git repositories outside of GitHub Enterprise Server. That makes good sense, and we'll definitely consider it. If you want to keep in touch about it, please feel free to post in our feedback forum: https://github.com/github/feedback/discussions/categories/code-search-feedback https://github.com/github/feedback/discussions/categories/co.... Thank you!
- jpgvm 5y agoGiven the shoutouts to Burntsushi and Lemire this is almost certainly a bitmap trigram index based engine similar to https://github.com/google/zoekt https://github.com/google/zoekt The index is likely based on Roaring bitmaps, presumably https://github.com/RoaringBitmap/roaring-rs https://github.com/RoaringBitmap/roaring-rs in this case. Nice architecture, exactly how I would have done it also.
- rurban 5y agoNope, I would have used an existing search solution, like xapian. It does so much more, and much faster. You need to support a proper query syntax, with tags, rankings, stopwords, stemming. Then you need to have a proper db backend (reverse indices). Trigrams dont help for regex. Then a templated representation. Google codesearch would do only the 2nd of 3. ElasticSearch is commercial, and only java. Doing that from scratch is a bit silly.
- preseinger 5y agoCode search typically does not need many (most?) full-text search features like TF-IDF, stopwords, stemming, tagging, etc. It's a categorically different domain.
- tanoku 5y agoOh OK, you have clearly spent more time thinking about this problem than the team of engineers at GitHub who've been researching code search at scale for more than four years. I bet they feel real silly right now knowing they could have shipped this search engine in a couple weeks taping together off-the-shelf libraries if they only had your talent for software architecture.
- rurban 5y agoSure, I did. I've implemented a proper search for a very big companies document and knowledge base. Similar to gmane, which also used xapian. Much better than what I see there. Or with the old google code search
- 5y ago
- ElectronShak 5y agoReminds me of https://grep.app https://grep.app, Search across a half million git repos [1] 1. https://news.ycombinator.com/item?id=22396824 https://news.ycombinator.com/item?id=22396824
- tuananh 5y agoi still dont understand why it can be so far, haha
- einpoklum 5y agoThey haven't implemented wildcard search for... well, ever: https://github.com/isaacs/github/issues/402 https://github.com/isaacs/github/issues/402 I don't even care it's very fast. Just make it work. I just hope this isn't snake oil. Weird that they claim regex support but no wildcard support.
- samueldr 5y agoOnly thing missing is indexing of branches and forks. My main use case for GitHub search is identifying provenance of misc. changes in vendor source code tarballs for e.g. Android kernel releases. It's hard, but sometimes possible to rehydrate most of the existing commits through cherry-picks and careful rebases. The biggest problem with the lack of indexing branches and forks is that sometimes vendors makes releases through branches, or that sometimes repos of interests are forks of e.g. `torvalds/linux`. Hopefully we can see those being indexed in the future. I'm also curious: has the plan to drop "less active" repos from the index gone through? Has anything changed?
- alufers 5y ago> I'm also curious: has the plan to drop "less active" repos from the index gone through? Has anything changed? Whaaat? I hope it doesn't go through. I use GitHub code search for clues when reverse engineering cheap Chinese IoT crap. Usually I can find some headers / SDKs accidentally uploaded and set to public by a random Chinese guy. Those repos usually have one commit and zero traffic, but they contain invaluable information about proprietary MCUs.
- ihnorton 5y agoI would personally like to see less indexing of duplicate files! There are many things I’ve searched for which return 100s of results from independent checkin-uploads of big libraries like the Android SDK. It would be great if results were filtered by file similarity regardless of git history (if that is in fact the issue).
- dstaheli 5y agoNice idea, ihnorton. Thanks for the feedback.
- jshier 5y agoGot into the preview, can finally search for actual code! One thing I'd like to see, though, is the ability to mark directories to be ignored in the search results. No one needs to search the raw HTML of my generated documentation, yet it shows up in every search for project symbols. And since HTML is considered "source", I can't filter it out unless I select a particular language. Also the search text field is bit messed up in Safari when the text gets longer than the field.
- colin353 5y agoGitHub Code Search developer here - try creating a custom scope to filter out that stuff! Click on the scopes dropdown and scroll to the bottom. You can filter out HTML by using a query like: NOT language:html
- jshier 5y agoAh, I was trying language:!html. Would still be great to ignore my docs directory.
- p0 5y agoYou could do this with `-path:docs/` (or `NOT path:docs/`).
- esprehn 5y agoIt would be great if this used the same filter format as sourcegraph and other internal code search tools. ex. -file:.html is enough to filter away files ending in html in the main search box. Having to use dropdowns and multiple input fields is more cumbersome than the filter language of repo:, file:, lang: etc.
- dstaheli 5y agoHere are the details of that syntax: https://cs.github.com/about/syntax https://cs.github.com/about/syntax
- beached_whale 5y agoGot an opportunity to try it a few minutes ago and it's awesome so far. I was able to look for my code in repos I don't own, e.g `not org:user foo::bar`
- yashap 5y agoWow, HUGE feature, congrats to the team working on it! GH code search is a feature with such massive potential utility, but the old implementation was so weak it was basically useless. Looking forward to this, will use it constantly if it’s good.
- mintplant 5y agoIf anyone from GitHub is listening, being able to exclude test code with a few clicks would be an absolute game-changer. By far the biggest source of noise in my GH code search results, and I use the tool (and similar tools like Searchfox) super super heavily. Either way, stoked to try this out.
- Koffiepoeder 5y agoAnd inversely, searching specifically for test code can also be useful. For example if searching for an implementation example.
- 100k 5y agoThanks for the feedback! We downrank test files with a heuristic, though we'll definitely be looking to make this more sophisticated. You can also exclude results using a regular expression, like `foo NOT path:/_test\.go$/`.
- dcreager 5y agoAnd also note that if you often need to add this kind of qualifier to many searches, you can create a "custom scope" that includes it for you transparently.
- halayli 5y agoExactly this. It will also reduce unnecessary requests on their servers.
- anarazel 5y agoSome logic to exclude duplicate results would be useful. I often search to see how many external users there are of some API in postgres. But there's hundreds of separate repos with similar contents showing up in the search results...
- dstaheli 5y agoWe hear you, anarazel. Thanks for the feedback.
- ryanseys 5y agoI'd love some shorter keywords here for searching so this was quickly composable into something useful. E.g. p: or f: instead of path: for filenames l: instead of language: -f: to exclude specific filenames (makes it easy to filter out tests) You get the idea.
- dstaheli 5y agoGreat idea, ryanseys. Thanks for the suggestion. - GitHub PM
- svnpenn 5y agoHas the "Last indexed" been fixed? whenever I search for code, it will say something like "Last indexed on Apr 2", but if you go to the actual file, the date will say 5 years ago or something. So currently the "Last indexed" listed date is completely useless, and you have to basically click through to every result.
- 100k 5y ago(I worked on that system and the new one.) Yes, sadly, that is literally when the file was _indexed_. So it's not particularly useful. It's a difficult problem to solve, but I'll bring up your feedback to the team.
- kristopolous 5y agoA way to exclude seeing the exact same line of code in each of the 400 forks of some project on the next 40 pages would be just great. The results are just so full of repetition
- jhokanson 5y agoYes please! I like to search for examples of how to use libraries and often times the results are all the same exact call in forks or copies of the same code in multiple places. Perhaps deduplication could be optional when searching?
- dstaheli 5y agoWe hear you, jhokanson. Thanks for this feedback.
- londons_explore 5y agoIt looks like this doesn't really understand the code... If I have a bunch of functions in different files all called "print", it won't be able to determine exactly which one is linked in and called at runtime. Googles codesearch tool[1] actually compiles the code and uses the compilers parse tree to make the search index. The only time it doesn't work is if you are looking for code that has been "#ifdef 0"'d, when it falls back to regular string matching, and the difference is night and day. Please github... please try to make a search index by compiling everyones files. Plenty of projects have CI buildbots which have all the info to automatically compile millions of projects, and at the same time generate the necessary parse trees. Even for interpreted languages like javascript/npm, python/pip, you can use heuristics to make a cross-module function call graph accurately most of the time. [1]: Example URL from it: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/html_element.cc;drc=eb5094ebb2c2a4128d36d27806b286d288965746;bpv=1;bpt=1;l=1659?q=html_ele https://source.chromium.org/chromium/chromium/src/+/main:thi...
- dcreager 5y agoWe’ve been working on a framework called “stack graphs” that lets us extract exactly this kind of information without having to build anything. More details in my Strange Loop talk from October: https://dcreager.net/talks/2021-strange-loop/ https://dcreager.net/talks/2021-strange-loop/ Stay tuned for more!
- setheron 5y agoI find when I do code-search, similar code that is copy and pasted into multiple repositories (vendor code) is always a problem too. Skipping well known vendoring directories would be cool too.
- msoad 5y agoAny plans to integrate Copilot goodness into this? All I want is to search for "the function that concatenate multiple items with an Oxford comma" and get to that bad boy!
- civilized 5y agoHow about searching for keywords in file names? Believe it or not, GitHub search doesn't do this unless you prefix with filename:
- p0 5y agoCheck out https://cs.github.com/about/syntax https://cs.github.com/about/syntax -- indeed, by default terms are searched in both content and paths. You can restrict to one or the other with `content:` or `path:`.
- civilized 5y agoThen their documentation is wrong. I learned the hard way that GitHub code search didn't search file names in my case. I searched for a short bare string with some alphabet letters and one underscore, and it failed to find the file with that exact string in the file name, costing me a lot of time missing what I was looking for. Unfortunately I can't reproduce the problem publicly because it happened while searching a private repo.
- bostonvaulter2 5y agoWill it be possible to see all the search results within each file? The lack of that feature is why I almost never use GitHub's code search for my repositories. Instead I'll download the repository locally and search there.
- arrakeen 5y agohopefully i'll be able to search for usages of a library's function without getting 30 pages of that library's source code cloned in vendor directories
- Lhiw 5y agoDid they fix how you can't search for a file name yet?
- TkTech 5y agoOne feature I would absolutely kill for is a setting that lets you hide issues and PRs from bot users in the global search. I've been lucky enough to have a few projects that others have found useful, and so they've ended up in Conda forge, Gentoo, and other package repos. After I make a release, the Github-wide search is just absolutely flooded with dependabot PRs, Snyk PRs, and dozens of other bots. Literally thousands (and sometimes tens of thousands for CVEs) of automated PRs and issues that make it impossible for me to see how others are using or discussing my packages (usually to see if I've just horribly broken something).
- est31 5y agoHah, reminds me of this issue where 90% of the content is spam: https://github.com/chronotope/chrono/issues/499 https://github.com/chronotope/chrono/issues/499
- fhaldridge7 5y agoIt would be great if the search could exclude forks. I often search something and the result are the same code but in different repos (forks)
- dstaheli 5y agoThanks for the feedback, fhaldridge7. - GitHub PM
- imron 5y ago> Here are some things to look out for: No mention of case-sensitive search...
- catsarebetter 5y agoThank goodness
- danielyaa5 5y agothis is awesome but i dont know why we needed faster search, seems like time wouldve been better spent on more search features. I guess this is class programmer pointless optimization
- trungdq88 5y agoI’ve been using grep.app for exact match search for a while. Exciting to see GitHub now has this too.
- southerntofu 5y agoJust in case people from Github are listening to feedback here, please stop blocking search for logged out users? I mean, you're not exactly as terrible as your main competitor gitlab.com which entirely blocks Tor users from cloning repos (unless you add ".git" at the end of URI), but having to login every time i'm looking for a string eg. across an org is the worst. I understand i have to login to publish code and engage in discussions, but login for read-only content is bad UX. PS: How do you feel about being bought by Microsoft? Maybe some of you feel it's a good time to implement s2s inter-forge federation to plant a nail in the coffin? Sounds like Gitea is on a good way to support it based on ActivityPub/forgefed and it would be sad if Github was relegated to a for-profit walled garden.
- jjrob13 5y agoI wish they would fix the advanced search feature. Searches that have multiple filters don't show any of the matches (has been broken for over a year - they acknowledged it as a known issue). Example search "camera -filename:camera.css -filename:depend.make" will say there is 100 million matches, but won't show any of them. Super useful feature when it's working
- dstaheli 5y agoThanks for the feedback, jjrob13. We'll definitely want to make sure this works well in the new search service. - GitHub PM
- niros_valtos 5y agoDid anyone run the log4j RCE search?
- eduardosasso 5y agoDoes it remove dupes from results?