News for hackers. Stuff that matters.
Re:Show HN: An experimental code search engine by ackfoo on Friday November 30, 2018 @09:49AM (#18569452)
The thing about search is that it is only useful if it lets you find obscure results. Anyone can find common results; they clog every search engine and suffocate functionality.

For example, if I enter “UDP broadcast” into your search, I find all the usual java and cpp results that I can find anywhere. Ho hum. If I wanted those, I could go use Google or probably just trip over them in my living room.

But I want results in Swift because it is relatively new and obscure. There are only 4 Swift projects on Github that match the term “UDP broadcast” out of 319 total results. I have to do an advanced search on the native Github engine to find them.

I think you might want to start by making your search useful for finding the weird obscure things that people really have to hunt for. Then expand it to everything else while finding a way of not drowning the oddball stuff with the common clay (of the New West).

This is where Google, for example, has gone wrong lately. I almost can’t use it for anything meaningful because any meaningful search (example ‘MacOS gps”) brings back “5 Amazing GPS apps for Mac that you can’t live without!!” and many other links with no actual content.

If you want to make a useful search, you have to return the stuff that is hard to find instead of the easy and useless stuff.

Re:Show HN: An experimental code search engine by brobdingnagians on Friday November 30, 2018 @10:20AM (#18569668)
This would be great, especially if it made it easy to find specific examples of how to do certain things. When I am trying to figure out how to do something I usually find several examples that are decently close of the core idea, then look at the documentation. It helps understand the documentation better, so if I could search for a list of examples, it would be invaluable.

Somewhat related, I put in "std::string" under cpp and it didn't return anything, but "string" returned plenty of instances that included "std::string". Being able to use namespaces would help in finding obscure functions with a name that is common, but has a specific module name to make it unique.

Any and all improvements in context awareness would be nice too, but probably more difficult than they would be worth for any short term implementation.

Re:Show HN: An experimental code search engine by wodenokoto on Saturday December 01, 2018 @06:00AM (#18576261)
You are overestimating the competition.

Just add support for parenthesis and brackets and you've beaten both Google search and GitHub search.

Re:Show HN: An experimental code search engine by sp1982 on Friday November 30, 2018 @01:04PM (#18571011)
Agree, currently there is zero intelligence in ranking. I need to improve both coverage and ranking.
Re:Show HN: An experimental code search engine by nikaspran on Friday November 30, 2018 @02:50AM (#18567472)
It would be great to have a few pre-selected example queries immediately clickable, to see some examples. That would help showcase why this is cool and what you can do with it. And maybe why it's better than other search tools (i.e. built-in github one).
Re:Show HN: An experimental code search engine by sp1982 on Friday November 30, 2018 @03:13AM (#18567545)
Good point, will add.
Re:Show HN: An experimental code search engine by jimijazz on Friday November 30, 2018 @08:07AM (#18568768)
This is fun. Why have you restricted the search to just Identifiers, Variables and Functions? Does this mean that text found in a comment block would not be a match?

I'm already devising how you could incorporate a bag of words algorithm plus an embedding to segment/find similar items.

Re:Show HN: An experimental code search engine by sp1982 on Saturday December 01, 2018 @08:42PM (#18580241)
>> Why have you restricted the search to just Identifiers, Variables and Functions? Does this mean that text found in a comment block would not be a match?

Yes, by default, it matches any but if you specify a filter, you can restrict on available language features.

Re:Show HN: An experimental code search engine by lgessler on Friday November 30, 2018 @09:55AM (#18569483)
If this looks cool you might also be into Google Code Search https://github.com/google/codesearch
Re:Show HN: An experimental code search engine by gilleain on Friday November 30, 2018 @05:46AM (#18568161)
Feature request/idea: Would be nice to be able to 'pipe' the results of one search into another.

Imagine a series of search boxes, with the results of the first fed into the second, and so on. Like:

> codegrep --class "Logger" | codegrep --field "error"

Re:Show HN: An experimental code search engine by aryamaan on Friday November 30, 2018 @09:40PM (#18574735)
This looks good. I wanted to do something similar for Golang when I started learning it.

Like for a package say `sync` I want to see the most common methods first and their documentation.

I find the current godocs lacks in giving welcoming vibes and treat every aspect of a package equally where some method types are more important/useful than others.

Re:Show HN: An experimental code search engine by ssijak on Friday November 30, 2018 @08:46AM (#18569040)
First search revealed some funny test code :) https://github.com/ornicar/lila/blob/master/modules/shutup/s...
Re:Show HN: An experimental code search engine by contravariant on Friday November 30, 2018 @09:26PM (#18574676)
Kind of curious what the story behind the chess-bot stuff is.
Re:Show HN: An experimental code search engine by dzek69 on Friday November 30, 2018 @07:11PM (#18574012)
Well, sh*t stuff needs to be tested too :)
Re:Show HN: An experimental code search engine by boyter on Friday November 30, 2018 @05:52AM (#18568186)
Very nice. I run searchcode.com which I have been neglecting recently. That said I do like to see other code search engines and play around with them. Seems you have disabled the default regex search offered by elastic? I didn’t look into the code much but a search of /.*/ yielded no results?
Re:Show HN: An experimental code search engine by sp1982 on Sunday December 02, 2018 @07:52PM (#18585588)
Yes, currently it is simple term search, regex searches aren't very stable with respect to performance. Something to think about it for next iteration.
Re:Show HN: An experimental code search engine by pard68 on Friday November 30, 2018 @04:29AM (#18567846)
It would be useful if it grouped repositories or had a method of collapsing results. My search returned the same repo for each result. Not sure if it was a function of there only being one repository using my term (doubt it, I used "GCD") or what.
Re:Show HN: An experimental code search engine by oliverx0 on Friday November 30, 2018 @02:45AM (#18567457)
This has a lot of potential. I would love to be able to type quicksort and automatically see a good implementation of it. What is shown right now is not good enough, but the idea is there. Great job! I also tried ray tracing, and timsort, but got no results.
Re:Show HN: An experimental code search engine by kureikain on Friday November 30, 2018 @04:41AM (#18567910)
Amazing. Search is super fast.

How do you think about Elm? I want to do more work with it too, play with it on some toy projects and love it so far.

Re:Show HN: An experimental code search engine by sqrt17 on Friday November 30, 2018 @03:34AM (#18567626)
It seems to highlight matches both within strings and as normal identifiers (e.g. to_csv finds matches within strings)
Re:Show HN: An experimental code search engine by ddorian43 on Friday November 30, 2018 @07:07AM (#18568487)
What's the backend like ?
Re:Show HN: An experimental code search engine by sp1982 on Friday November 30, 2018 @09:15AM (#18569219)
Play framework + Elasticsearch
Re:Show HN: An experimental code search engine by edwinyzh on Friday November 30, 2018 @02:51AM (#18567476)
Do you have a plan to add Pascal/Delphi language support?
Re:Show HN: An experimental code search engine by sp1982 on Friday November 30, 2018 @03:14AM (#18567551)
Adding new languages is fairly easy as long I can write a little helper program to tokenize. I will take a look.
Re:Show HN: An experimental code search engine by azeirah on Friday November 30, 2018 @07:14AM (#18568524)
Take a look at tree-sitter, it's a parser written for the Atom editor, it supports 20+ languages, and is super fast, as it was written to parse in under 1/60th of a second (parse on keypress, should be done before the screen refreshes)

https://github.com/tree-sitter

It has bindings for node, ruby, rust and haskell

Re:Show HN: An experimental code search engine by catchmeifyoucan on Thursday November 29, 2018 @10:11PM (#18566328)
What is experimental?
Re:Show HN: An experimental code search engine by sp1982 on Friday November 30, 2018 @12:36AM (#18566979)
Coverage, only top few thousand open-source repos from github are being indexed as of now. Similarly, only few languages + features are extracted. Probably I should have said alpha :)
Re:Show HN: An experimental code search engine by mandeepj on Friday November 30, 2018 @03:28AM (#18567595)
How this is different than Github's search?
Re:Show HN: An experimental code search engine by sp1982 on Friday November 30, 2018 @03:37AM (#18567639)
A bit more structured, at least when I last hacked on it. The key idea is to be able to search via language features, for example by function implementation (vs usage). Lets say you saw a function name in kernel crash, like https://www.codegrep.com/search?query=ext4_extent_block_csum...
Re:Show HN: An experimental code search engine by mandeepj on Friday November 30, 2018 @09:04AM (#18569152)
Thanks for the insight. You are correct - github is not supporting this type of search.
Re:Show HN: An experimental code search engine by whydoineedthis on Friday November 30, 2018 @06:37AM (#18568362)
Sweet. Now I can find committed AWS super fast.
Re:Show HN: An experimental code search engine by quickthrower2 on Friday November 30, 2018 @02:46AM (#18567463)
Useful. Please keep going!
Re:Show HN: An experimental code search engine by kreetx on Friday November 30, 2018 @05:38AM (#18568127)
Not sure why somone downvoted, here is it back! :)

The search is fast and ui is simple, and works on mobile -- great work, sp1982!

Re:Show HN: An experimental code search engine by piecu on Friday November 30, 2018 @01:58AM (#18567293)
No C#, useless for me.
Re:Show HN: An experimental code search engine by sp1982 on Friday November 30, 2018 @02:09AM (#18567332)
Sorry, will try to add in near future.