News for hackers. Stuff that matters.
Re:Search for PHP by dbingham on Sunday October 24, 2010 @10:53PM (#1828266)
Don't forget to have it search http://stackoverflow.com in the various php tags. Also, having it search the various framework site's articles, question sites, documentation, etc would be very useful as well.
Re:Search for PHP by philfreo on Monday October 25, 2010 @01:26AM (#1828672)
Bonus points if it ranks by textual relevance + # of upvotes on SO
Re:Search for PHP by boyter on Monday October 25, 2010 @01:29AM (#1828680)
Consider it in the pipeline. I am adding this as a must to do.
Re:Search for PHP by boyter on Sunday October 24, 2010 @10:59PM (#1828280)
Thanks!

I add those soonish. I am still sourcing places to crawl and index at this point. That would be an excellent start.

Re:Search for PHP by jasonlotito on Monday October 25, 2010 @08:59AM (#1829586)
Not sure if your indexing my forums, but DevNetwork.net might also be a good resource to index. =)
Re:Search for PHP by groaner on Sunday October 24, 2010 @10:12PM (#1828146)
Am I doing something wrong, or should this query return more results?

http://www.searchforphp.com/?s=needle+haystack

EDIT - For those who can't get the page to load, here are my results:

    * grapheme_strstr
      (PHP 5 >= 5.3.0, PECL intl >= 1.0.0) grapheme_strstr — Returns part of haystack string from the first occurrence of needle to the end of haystack.
      string grapheme_strstr( string $haystack, string $needle[, bool $before_needle = false] )

    * grapheme_stristr
      (PHP 5 >= 5.3.0, PECL intl >= 1.0.0) grapheme_stristr — Returns part of haystack string from the first occurrence of case-insensitive needle to the end of haystack.
      string grapheme_stristr( string $haystack, string $needle[, bool $before_needle = false] )

    * iconv_strrpos
      (PHP 5) iconv_strrpos — Finds the last occurrence of a needle within a haystack
      int iconv_strrpos( string $haystack, string $needle[, string $charset = ini_set("iconv.internal_encoding")] )

    * iconv_strpos
      (PHP 5) iconv_strpos — Finds position of first occurrence of a needle within a haystack
      int iconv_strpos( string $haystack, string $needle[, int $offset = 0[, string $charset = ini_set("iconv.internal_encoding")]] )
Re:Search for PHP by boyter on Sunday October 24, 2010 @10:17PM (#1828162)
Hi!

It probably should. Could you let me know what you would be expected it to display? I can then figure out its doing wrong.

Re:Search for PHP by groaner on Sunday October 24, 2010 @10:20PM (#1828169)
It's not fair to compare you to Google, but if you're returning results from php.net, I thought I'd see some of the more higher-profile pages:

http://www.google.com/search?q=site%3Aphp.net+needle+haystac...

http://duckduckgo.com/?q=site%3Aphp.net+needle+haystack

Re:Search for PHP by boyter on Sunday October 24, 2010 @10:24PM (#1828185)
Looks like the score isn't calculating as well as I would have expected. I will tweak my relevance algorithms to fix this.

Thanks for the feedback!

Re:Search for PHP by happybuy on Monday October 25, 2010 @04:23AM (#1829026)
Very nice fade in effect when results are shown - soothing and not too jarring.

I'd suggest that when no results are found that a message is displayed to that affect. There is currently no feedback to tell if the system is still loading, broken or has found no results at the moment.

Re:Search for PHP by owenD on Monday October 25, 2010 @11:55AM (#1830291)
Agreed on both points! That fade is a nice little touch and the system needs to provide users with feedback on what it's doing.
Re:Search for PHP by boyter on Monday October 25, 2010 @04:55AM (#1829078)
I will do that! Added to my list of things to implement. Cheers!
Re:Search for PHP by jayphelps on Sunday October 24, 2010 @11:00PM (#1828281)
Neato! Worked snappy for me. Kudos.

Suggestion: It appears that the searches sometimes stacked up in queue if I typed fast. (i.e. if I typed a long sentence quick the results continued to flash different content many times, playing catch-up. Looked through the JS quick and I see you are trying to prevent this with runningRequest1/2 so maybe it's the short delay in the .fadeTo() after the GET callback. Try moving the runningRequest = false into the fadeTo callback.

Also, .fadeTo() has a default queue of it's own. You could also add .stop() like this:

    $('#function').html(data).stop().fadeTo('fast',1);
Otherwise, really cool! I use "site:php.net foobar" most of the time but this would be a great little widget.
Re:Search for PHP by boyter on Sunday October 24, 2010 @11:07PM (#1828298)
Thanks! This is my first real play with jQuery. I have added this to my bug queue and will be fixing it in a few hours. Cheers for the tip!
Re:Search for PHP by jayphelps on Sunday October 24, 2010 @11:24PM (#1828351)
Here's another: you're searching on any keyup which creates lots of overhead. Google's implementation is more complex. It appears they search immediately as you type the first few characters on each keyup/down then if the word goes over a few characters it switches to querying every couple seconds, or until you hit the spacebar. It also seems like they have another timer if you pause after a second or two.

If it's just you using this, I would say don't give a crap. But if you plan to allow others to use it and it gains a userbase at all you might consider a similar approach for obvious reasons.

Cheers!

Re:Search for PHP by boyter on Sunday October 24, 2010 @11:27PM (#1828359)
I was looking into this but havent yet been able to make it work smoothly. Since you have raised it I will focus on getting it working.

I have quite a list of things to improve now.

Re:Search for PHP by castis on Monday October 25, 2010 @09:05AM (#1829609)
You may want to put in something that only searches if they havn't pressed a key after so many seconds.

I would assume that most of us type at a fairly constant rate so maybe check each keystroke to see how long its been since the last one and maybe if 500 ms have passed, then go ahead and fire off some search results.

Re:Search for PHP by moeffju on Monday October 25, 2010 @04:50AM (#1829069)
Try using http://code.google.com/p/jquery-debounce/ - it creates a throttle/debounce function for you, so the submit would only be called at most every X ms, no matter how often the event fires. It's super useful.
Re:Search for PHP by jayphelps on Monday October 25, 2010 @05:10PM (#1831604)
+1
Re:Search for PHP by techbio on Sunday October 24, 2010 @09:21PM (#1827990)
Fast. I wanted to do something like this for code-completion, but with tagclouds. Still do in fact.

In searchforphp.com, function names are search-completed alphabetically. Could you sort them by their usage? Such as token frequency in a corpus of actual PHP source code?

Re:Search for PHP by boyter on Sunday October 24, 2010 @09:23PM (#1828001)
Thanks!

Actually I was looking into doing that. I just need to get a large enough corpus to crunch on. I will probably download a few of the larger CMS's and frameworks and do this.

Re:Search for PHP by techbio on Sunday October 24, 2010 @09:28PM (#1828012)
Want some help? There is a contact page on the website listed in my profile. I have side projects. Maybe we could trade tasks.
Re:Search for PHP by boyter on Sunday October 24, 2010 @09:57PM (#1828096)
I might take you up on the offer! Cheers!
Re:Search for PHP by cowboyhero on Sunday October 24, 2010 @09:44PM (#1828052)
Very cool and extremely useful.

First thoughts:

The site is slow for me.

There's no feedback indicating the system has captured user input.

On my first visit, I immediately started typing random function names into the search box ('strlen', 'htmlentities', 'func_get_args', etc).

I had no idea anything was going on and assumed that my search returned no results.

It's only when I tabbed out for a few moments and tabbed back that I saw the site worked at all.

When I saw the results, though, my reaction was something like "Wow, that's awesome."

Re:Search for PHP by boyter on Sunday October 24, 2010 @09:55PM (#1828087)
Yes its something I need to fix. Im thinking for the very first search ill display a "loading" image, because after that the results fade out a little when you start searching again.

The speed is probably due to the site being hammered. Its only a small VPS and probably not coping very well. Thanks for the feedback though!

Re:Search for PHP by boyter on Sunday October 24, 2010 @10:19PM (#1828164)
Sorry everyone about the problems with load. It should be somewhat more responsive now. It was down to me leaving KeepAlive on in the httpd.conf for Apache.

Turned it off and everything is responsive again.

Re:Search for PHP by nowarninglabel on Sunday October 24, 2010 @10:22PM (#1828179)
Neat idea, especially to a fellow non-IDE using full-time PHP coder such as myself. That said, I tried the first search that came to mind "cast to string" And didn't really get any useful results. First result was for JSON, and the link from php.net was for stripos.

The result I expected, and which I got as the first result in Google was: http://php.net/manual/en/language.types.type-juggling.php

Re:Search for PHP by boyter on Sunday October 24, 2010 @10:28PM (#1828199)
Ah I know the problem. I actually haven't indexed the whole of the PHP manual. I was just going for MVP.

I will index that and ensure the search results appear as they should.

Re:Search for PHP by abraham on Monday October 25, 2010 @01:54AM (#1828734)
Inclusion of GitHub results would be awesome. They have a search API so it should be fairly easy.
Re:Search for PHP by boyter on Monday October 25, 2010 @07:40AM (#1829375)
I actually did this with Google code for a while, but removed it due to speed issues. I will have a look at the github api though and see if it is any faster.
Re:Search for PHP by kingkawn on Sunday October 24, 2010 @10:06PM (#1828124)
10/24/10, 10:05pm EST, took minutes to load page initially.
Re:Search for PHP by boyter on Sunday October 24, 2010 @10:10PM (#1828140)
Sorry about that.... its hosted on a Westhost VPS and is probably a little oversold. Its struggling at the moment.
Re:Search for PHP by kingkawn on Monday October 25, 2010 @10:38AM (#1829952)
naw, no sorries, just thought I'd try to give you something more concrete than "Iz not work."
Re:Search for PHP by Ancient on Monday October 25, 2010 @03:54AM (#1828966)
Here's a list of Firefox's Ubiquity to search for PHP functions, etc ... https://wiki.mozilla.org/Labs/Ubiquity/Commands_In_The_Wild#...
Re:Search for PHP by epynonymous on Sunday October 24, 2010 @09:48PM (#1828068)
this is simple and much like google.com which i like, no advertisements or wordy introductions, and the main function is bright and center. the ui could use a bit of a makeover, but i think you've got something functional and should keep expanding the functionality before investing time on the ui part since it seems that you're the only developer at the moment.

what storage solution do you use for indexing?

and perhaps i'm getting penalized by the latency since i'm in shanghai, but it seems that the response time is pretty slow.

Re:Search for PHP by boyter on Sunday October 24, 2010 @09:53PM (#1828085)
Thanks! UI is not my strength, but thats all I could come up with.

The indexing is very much a hybrid consisting of sphinx, mysql fulltext, and a custom solution of python and php.

As for the speed, the site is being hammered... since its only on a little VPS its not coping too well at the moment. I am located in Sydney Australia and its a little slow for me at the moment too. Usually its not too bad though.

Re:Search for PHP by techbio on Sunday October 24, 2010 @11:24PM (#1828353)
OK, clearly you are on a running horse...but have you considered a version for Python?
Re:Search for PHP by boyter on Sunday October 24, 2010 @11:34PM (#1828396)
Yes I have. Most of the people I work with are asking for a dotnet one so I am planning on doing that first, but yes Python is on the radar, and mostly done.
Re:Search for PHP by neeleshs on Monday October 25, 2010 @02:18AM (#1828784)
+1 for python.
Re:Search for PHP by boyter on Monday October 25, 2010 @03:15AM (#1828898)
http://www.searchforpython.com/

Will update it soonish!

Re:Search for PHP by sukuriant on Monday October 25, 2010 @02:57AM (#1828868)
+1 for .NET, too!
Re:Search for PHP by boyter on Monday October 25, 2010 @03:14AM (#1828897)
http://www.searchfordotnet.com/

Will update it soonish!

Re:Search for PHP by sukuriant on Monday October 25, 2010 @04:01AM (#1828990)
link doesn't work
Re:Search for PHP by boyter on Monday October 25, 2010 @04:48AM (#1829065)
Errr thats because I just registered it :)
Re:Search for PHP by Tomek_ on Monday October 25, 2010 @10:16AM (#1829861)
Having it working around PHP's inconsistency in function naming would be great, e.g. if I look for "str_pos" the first result should be "strpos".
Re:Search for PHP by pinchyfingers on Sunday October 24, 2010 @10:22PM (#1828176)
This looks really nice, great job. I like it and I'm going to try and use it over the next couple weeks, I'll let you know how it goes.
Re:Search for PHP by boyter on Sunday October 24, 2010 @11:34PM (#1828392)
Thanks! Would really appreciate feedback as I improve things. Im pushing almost daily updates at this point, just need to know if they are useful or not.
Re:Search for PHP by empire29 on Monday October 25, 2010 @01:51PM (#1830787)
very cool site!

Can i ask how you are "getting" the data? Are you compiling the data locally (i would assume via scraping/APIs) and putting it in a full text search engine or are you hitting various services for every search (via APIs?) for every search?

love the site -- its simplicity and bareness have a certain charm.

Re:Search for PHP by boyter on Monday October 25, 2010 @05:16PM (#1831631)
At the moment through the following,

Web Crawler (custom) RSS crawler (custom) Grep/Parsing of various API references and the like. API's of certain services.

Pretty much everything is hosted locally on the machine though.

Re:Search for PHP by photon_off on Sunday October 24, 2010 @11:51PM (#1828433)
I tried a few queries, and honestly I find Google's Auto Suggest to be of more use when searching for PHP functions.
Re:Search for PHP by boyter on Sunday October 24, 2010 @11:54PM (#1828442)
Fair enough. I will be aiming to improve relevance for functions since that seems to be the main feedback.

One of those cases where the way I search for functions is not the way everyone else does. I now have a lot of data to allow me to really improve things. The function relevance is very high on the list now.

Re:Search for PHP by photon_off on Tuesday October 26, 2010 @07:13AM (#1833748)
Awesome. I'm looking forward to seeing what you come up with.
Re:Search for PHP by mikeytown2 on Monday October 25, 2010 @02:49AM (#1828851)
where's the foreach loop? http://php.net/foreach
Re:Search for PHP by boyter on Monday October 25, 2010 @03:07AM (#1828883)
I haven't actually added control structures yet. I just went with functions.

In short its on the to do list, but I figured this was enough to get me started.

Re:Search for PHP by smutticus on Monday October 25, 2010 @12:16PM (#1830383)
Why should I use this instead of php.net?
Re:Search for PHP by iconfinder on Monday October 25, 2010 @06:01AM (#1829192)
Great job!
Re:Search for PHP by ucentric on Monday October 25, 2010 @07:14AM (#1829323)
Nice!

No blowhard, just a cool service.

Want some work?

[email protected]

Re:Search for PHP by 9ec4c12949a4f3 on Monday October 25, 2010 @01:53PM (#1830793)
Found no results for <?=