isaacs/github

Github search sucks (and how it could be better)

RenaudWasTaken opened this issue Β· 53 comments

Hi !

I'm reporting this as I've noticed for quite a while that github search feature is not the
feature needed by a developer.

I often find myself cloning the repository and using grep recursively or on a specific directory.
Advanced search is just plain confusing and takes too many steps to access.

Example:
1) When searching from the /src directory the search is launched on the whole repo
2) When searching for a common term only 10 results are displayed

Expected behavior:
1) The search is launched on the /src directory
2) The search displays more results with less code around the search term (see first post)

A few suggestions:

  • Enable search on specific directories from the search bar ("This repository" button)
  • Replace the search feature with a UI version of grep ?
  • Display more results and less code around search term (maybe an expand button)
  • Advanced search terms on the search result page

Thanks!

Note, Upvote this on HN: https://news.ycombinator.com/item?id=13935370 :)

πŸ‘

Also it seems silly not to be able to search using syntax like (,).; etc - sometimes you need to be able to narrow down results drastically from 1000 to say 10 by using non alphabetic characters

hbt commented

+1

perfect title : github code search sucks. I have opened a stackoverflow issue on this. http://stackoverflow.com/questions/43096264/github-code-search-on-any-branch

There are around 60 search filters available. Even more if you count filter negation; e.g. -user:Mottie would exclude me in your searches. So to make it easier, I created a GitHub Search Autocomplete userscript which makes these filters easier to use and even includes a few examples in a secondary dropdown.

I was looking for a way to search a code that starts with, for example, instead of angular2, if I search for angular, it should find angularjs, angular2, angular4 and not just angular as it's working atm.

Something like: angular* would be nice, or maybe angular% like SQL.

Perhaps this is the right issue.

Perhaps this is the right issue.

You should use https://github.com/contact to directly contact GitHub with your request. This repo is for us to share and vent our frustrations, I don't think GitHub reads it.

even a basic grep based search would be better.

@pakirby1 It should just be a web interface for git grep in the first instance.

Their current implementation is so pathetic that even an integrated Google Custom Search might outpass them

good thing they focused on adding emojis to posts before fixing their broken-by-design search bar

At most, search results can show two fragments from the same file, but there may be more results within the file.
https://help.github.com/articles/searching-code/

too limited...

I'm finding that three quarters of the things I want to use the search for aren't supported.

And local checkout and search doesn't help with Github wide search.

Here's a biggie:

"Find all repos that contain this string" - pretty basic huh? Instead I get 1000 results for the same repo because that string occurs 1000 times.

I could go on. I find a new one every day.

Maybe now that they have Microsoft resources they could improve the search. I’m not holding my breath....

Try searching for "?callback=" and see how pathetic this search is...

yeah but remember folks, if you don't have an account and a bunch of free work for random projects that will be dead in a year on github.com you're not a real programmer!

One man's garbage can be another man's treasure, so sharing is caring ;-)
Problem is with a bad search you limit discovery and reuse/adaptations of code.

Can we talk about Github search not finding all results? When I do a search I often get less than half the actual results and there's no way to get the other half.

Yes, its very broken... When it can't find all of your repositories.... its junk.

Hello. Has this been looked into? Seriously github search drives me insane. I search for a filename and every mention of that name in other file shows up before that file itself. How is that the right behavior? Also entering the entire path to a file name including the extension (e.g. .tsx) fails completely. Why is including the extension not find the file name?

Maybe it treats the dot specially? Try backslash before the dot. However I guess they only search in the contents

Update: github search still sucks

Searches on my code sometimes returns nothing. Frustrating.

Still sucks.

Here you can see the search is able to determine that 9 results were found for the query within JavasScript files... but when clicking to narrow the search down to see just those 9 JavaScript results... nothing is found (note: the JavaScript results were in the original 59 results... just didn't want to page through them all to find them)

github-no-results

Search will never be fixed.

They might as well link it to google search seeing as to how we end up having to use google to find anything anyway (and google isn't great for code either).

GitHub please it's 2020!

Also the "Most Stars" sort doesn't work properly at all. Pharo as an instance, has 99% SmallTalk as the programming language of its repository and has 500 stars, but when searching the "language:SmallTalk", and choosing the "Most Stars" sort type, the repository that is displayed first has around 120 stars only. :|

I was looking for software related to the NES Sound Format (NSF) and I kept getting results about NSFW, even with the double quotes...please fix this, it'd be better if it just ran plain ack or ag in many cases!

3.5 years later, it still sucks.

October 2020 it still sucks

November 2020, no change

Still sucks after all this time, can't tell you how much this affects my day-to-day..

mu578 commented

Still sucks deep, even blows.

anko commented

I am having this mysterious issue with search. In short: When I'm logged in, I see 0 results for a search that other users see 36 results for. Other users see results, but I have to log out to see them. πŸ’«

I've emailed Github support about it.

(Made a comment instead of a separate issue as advised by #1864 (comment).)

TPS commented

I think https://github.blog/changelog/2020-12-17-changes-to-code-search-indexing/ is announcing a step backwards. Thoughts?

TPS commented

If anyone's interested, please add to the πŸ”₯ by commenting @ https://github.community/t/feedback-on-changes-to-code-search-indexing/150660. Might not hurt to mention other problems (as above) in passing.

I am having this mysterious issue with search. In short: When I'm logged in, I see 0 results for a search that other users see 36 results for. Other users see results, but I have to log out to see them. πŸ’«

I've emailed Github support about it.

(Made a comment instead of a separate issue as advised by #1864 (comment).)

I get 0 results for most searches even when using a string i copied from a file in a repo. It finds the string in Issues and PRs but not in code which is where I need it to search. All our work is less than 1 year old so it shouldn't be that problem...

can we just pipe an <input> into grep?

for heavens sake

It's hilariously bad. I have a repo named libptzf and it can't find it in Youre Repositories searching for ptzf. Did i put a dash after the lib or not? I can never remember. Search should be able to help.

Reminder that this is not the official GitHub feedback repo. Open a discussion there to get GItHub's attention.

Reminder that this is not the official GitHub feedback repo. Open a discussion there to get GItHub's attention.

You don't have to email anyone, just open a new discussion in the official repo above instead of here. GitHub is offering you a way to interact with their staff, which wasn't possible like this before, why ignore it? This repo was made because there wasn't such an option at the time. Now there is.

search is just completely unusable now.