isaacs / github

Just a place to track issues and feature requests that I have for github
2.21k stars 129 forks source link

Code search for wildcard characters #402

Open jcrben opened 9 years ago

jcrben commented 9 years ago

My message was approximately as follows (I realize that cloning down and grepping is always an alternative):

Searching code states explicitly that "You can't use the following wildcard characters as part of your search query: . , : ; / \ ` ' " = * ! ? # $ & + ^ | ~ < > ( ) { } [ ]. The search will simply ignore these symbols". Is it in any way possible to get around that in code search? If not, I recommend that this be placed in the backlog.

Response from James Dennes:

Thanks for the feedback on GitHub Search. It's not currently possible, but I'll add a +1 to this suggestion on our internal Feature Request List. We can't promise if we may add something like this, but we appreciate the feedback.

ChristopherKing42 commented 8 years ago

:+1:

mattdiamond commented 8 years ago

I'm surprised this isn't already available... it seems like code search, of all things, would need the ability to search for special characters, as they're often a major portion of the query.

EthanRutherford commented 8 years ago

This is really infuriating

ghost commented 6 years ago

Bump, this would be one of the best features to come to github since code versioning.

Shaun-Griffith-Hive commented 6 years ago

"You can't use the following wildcard characters as part of your search query: . , : ; / \ ` ' " = * ! ? # $ & + ^ | ~ < > ( ) { } [ ]. The search will simply ignore these symbols"

I'd also change the wording, as those aren't just wildcard characters.

alisonjoseph commented 6 years ago

Any progress on this? This is super frustrating.

zxj5470 commented 6 years ago

Any progress on this? @ char is not in

. , : ; / \ ` ' " = * ! ? # $ & + ^ | ~ < > ( ) { } [ ]

So how can I search something like @param @return

huehnerlady commented 5 years ago

Any progress on this?

gsugambit commented 5 years ago

hopefully this will be done soon, this is one of the biggest painpoints for a "code search"

cianfoley-nearform commented 5 years ago

this would be great e.g. if searching for a function allowing a search with functionName( would yield better results

rowandavies commented 5 years ago

Underscore also seems to be missing here.

ryanstull commented 5 years ago

This is very much needed

kemmis commented 5 years ago

good lord please implement this.

kelleyperry commented 5 years ago

4 years later, still nothing.

oomek commented 5 years ago

A platform for storing code without an ability to search for code. This is laughable. I can't even search for as basic thing as a class method declaration, or static method call "class::method" without getting tens of thousands of irrelevant hits.

ScruffR commented 5 years ago

Lots of calls for the feature but no commitment whatsoever!

It's also annoying that you can't do a partial search but only full-word. Without wildcards and full-word search lots of results won't be found.

Anutrix commented 5 years ago

Will we ever get this feature(more like necessity)? It's been more than 4 years.

eyalroz commented 4 years ago

What, you can't escape the wildcard characters? Incredible... isn't that a 1-hour fix? Certainly not years...

kemmis commented 4 years ago

The word on the street is that this feature is being saved until the big reveal when azure devops becomes github, and Microsoft announces its own cryptocurrency “cloudcoin”

You didn’t hear this from me.

On Mon, Oct 14, 2019 at 5:25 PM Eyal Rozenberg notifications@github.com wrote:

What, you can't escape these? Incredible...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/isaacs/github/issues/402?email_source=notifications&email_token=AAE6C6PSWARNNBATONQ24ELQOTPVTA5CNFSM4BE2XNRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBGTMLQ#issuecomment-541931054, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE6C6IWCQMSCGZ63QDQ73TQOTPVTANCNFSM4BE2XNRA .

mukunku commented 4 years ago

It's 2020 and still we don't have this feature?

kemmis commented 4 years ago

Yes, your eyesight is spot on. I am seeing what you are seeing.

On Thu, Jan 9, 2020 at 1:01 PM Sal notifications@github.com wrote:

It's 2020 and still we don't have this feature?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/isaacs/github/issues/402?email_source=notifications&email_token=AAE6C6JMZ3ZO3ERYZJ6PXQTQ45Q7ZA5CNFSM4BE2XNRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIRGR4A#issuecomment-572680432, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE6C6L4VMEWZVKAA5P2243Q45Q7ZANCNFSM4BE2XNRA .

PawelAdamczuk commented 4 years ago

This makes the code search feature barely usable for me.

Anutrix commented 4 years ago

The last time I checked even Google almost ignores most symbols in search term. It could be a similar reason. There could be some design choice that exponentially increases performance for text only search.

kemmis commented 4 years ago

Agreed. But this logic isn’t a good reason to not implement a feature like this. This just means that it isn’t as easy as you expect to implement the feature. Likely, they need to add new database indexes and possibly increase system resources to accommodate the index storage and management.

On Thu, Feb 27, 2020 at 7:49 AM Numan Zaheer Ahmed notifications@github.com wrote:

The last time I checked even Google almost ignores most symbols in search term. It could be a similar reason. There could be some design choice that exponentially increases performance for text only search.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/isaacs/github/issues/402?email_source=notifications&email_token=AAE6C6JYG5OUSU74RZ4SC53RE6ZEBA5CNFSM4BE2XNRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENEH43Q#issuecomment-591953518, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE6C6PJAFBIVRXZYTU5KFTRE6ZEBANCNFSM4BE2XNRA .

Anutrix commented 4 years ago

I agree. I was just trying to guess the reason for not implementing it yet.

ScruffR commented 4 years ago

Google search is definetly not a good comparison as it is primarily meant to find natural language expressions but GitHub is foremost targeted at programming languages and hence should focus on searching and finding code expressions.

oomek commented 4 years ago

The lack of response from devs is becoming more and more infuriating with each passing day. They should at least tell it can't be done, or anything.

eyalroz commented 4 years ago

@oomek : Indeed. Even a negative response is a response.

Anutrix commented 4 years ago

Official devs won't reply here because this is just an unofficial issue or feature request tracking repository. In case, someone hadn't noticed.

zhichaoleo commented 4 years ago

Any progress on this? @ char is not in

. , : ; / \ ` ' " = * ! ? # $ & + ^ | ~ < > ( ) { } [ ]

So how can I search something like @param @return

same question

vp777 commented 4 years ago

So it looks like this is a challenging task. A not so bad alternative would be to map all those special characters to a single, symbolic character (to avoid increasing the cost of indexing) and define a character that would be used to search that symbolic character.

For example to search "int foo(char bar){" Assuming ? is used to search the symbolic character: "int foo?char bar??"

The number of false positives is expected to be quite low

eyalroz commented 4 years ago

@vp777 : that's certainly an improvement; but not as an alternative. Perhaps that could be implemented as a temporary measure.

vp777 commented 4 years ago

nothing more permanent than temporary Especially true if it works good enough, which i think the above would.

Now with regards to implementing the full feature, that's the ideal, but after 4 years, I would say the probability is pretty slim...

isaiahshiner commented 4 years ago

If you're desperate, I just had success doing this manually in Google. I realize this is not equivalent to a native solution, but it did work for my situation.

"<|" site::https://github.com

This showed me "<|" anywhere Google had indexed. I used this to search for a lot of odd character combos, just to see what languages use them, and for that, it actually worked great. It will not properly show every instance in raw source code. You can try searching only raw.github, or for a specific blob, but with mixed results.

"return true;" site::https://github.com/nodejs/node/blob/master/

Yea, idk... This is a very janky solution, but it might help you. Doesn't appear that GitHub is going to.

JosNun commented 4 years ago

For what it's worth, the solution @isaiahshiner proposed above doesn't seem to work for * :/

adrianhallnhsd commented 3 years ago

Without being able to use wildcards in a search, the search is pretty much pointless. Sad panda.

fuetgeo commented 3 years ago

why is @ ignored? can't search for annotations in java code...

titan1978 commented 3 years ago

This one is just a pain - cant believe its almost 2021 and we can't search for something like periods or @ - there's no way we can download our entire orgs repo to do a grep search. Its incalculably large..

have-a-boy commented 3 years ago

I get that adding wildcard search functionality for a project like GitHub isn't easy, but who decided that just ignoring those characters in a search query was a good alternative? I can't even search for method calls or annotations because '.' and '@' will get ignored and there isn't even a way to escape them. This makes code search next to useless for me, so I have resorted to querying google for GitHub results, which is frankly embarassing.

fgeorgatos commented 3 years ago

could there be a definition for literal expressions, like :: literal, which basically does fgrep-like search on literal string? That should be economical and precise to run, unless the underlying generated indexes are lossy anyway...

ghost commented 3 years ago

Please the issue at https://github.com/github/feedback/discussions/4581 to get this some staff attention

eyalroz commented 3 years ago

@4086606 : Maybe you should post this link to HackerNews or somewhere on reddit.

ghost commented 3 years ago

Done, Hackernews

TPS commented 3 years ago

@4086606 Thanks for opening discussion & linking back here. 🙇🏾‍♂️

eyalroz commented 3 years ago

@4086606 Haven't seen it on HN. Did they reject it? If not, can you link there?

ghost commented 3 years ago

https://news.ycombinator.com/item?id=27785079

slimsag commented 3 years ago

Disclaimer: I work at Sourcegraph, but I'm not commenting here on behalf of them. My coworkers may frown a bit upon my negative tone here, so that's how you know I am speaking truth :) I'm commenting because I love code search, and I research it in my spare time.

I really do not understand how GitHub hasn't improved this yet. Can't they just offer search within a single repository by e.g. shelling out to git grep or ripgrep? People would go crazy over that.

Sourcegraph has had that from day one - for the 6+ years I've worked there, on millions of repositories, as the component for searching historical Git commits. It's even one of our interview questions ("how would you scale a dumb little code search tool built on top of git grep for a small team?")

It's truly dumbfounding to me just how long GitHub has neglected this issue. We aren't asking for anything crazy: even if it doesn't have regexp/structural search over every repository, it'd at least be a step up from what we have today. It's okay if it doesn't have semantic understanding of code: we literally just want a search for Foobar( to turn up a function call and not match complete garbage without any care in the world for punctuation.

Meanwhile, we're given ML-based solutions like Natural Language Semantic Code Search and Copilot which just miss the mark completely IMO. People just want the slightest hint of tools they're used to in their IDE on GitHub. If you can run CI / Actions with arbitrary code for all repositories, surely you could shell out to git grep and give us the results back in an HTML page somewhere?

Back when I joined Sourcegraph, I had already seen this issue a handful of times. I thought GitHub would have to improve this soon. If you had told me they wouldn't even try to compete with us on code search in the next 6 years, I would've called you crazy. Here we are today, in 2021 - six years later - and literally nothing has improved with GitHub search.

@4086606 @eyalroz this is what you'll need to post to HN if you want to get GitHub's management attention. But I'm not holding my breath, developers deserve better.

For anyone who wants decent code search, here is a list of tools that are easily 100x better than what you get from GitHub: