

Search for PHP - boyter
http://www.searchforphp.com/

======
dbingham
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.

~~~
philfreo
Bonus points if it ranks by textual relevance + # of upvotes on SO

~~~
boyter
Consider it in the pipeline. I am adding this as a must to do.

------
groaner
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")]] )

~~~
boyter
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.

~~~
groaner
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://www.google.com/search?q=site%3Aphp.net+needle+haystack)

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

~~~
boyter
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!

------
happybuy
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.

~~~
owenD
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.

------
jayphelps
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.

~~~
boyter
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!

~~~
jayphelps
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!

~~~
boyter
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.

------
techbio
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?

~~~
boyter
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.

~~~
techbio
Want some help? There is a contact page on the website listed in my profile. I
have side projects. Maybe we could trade tasks.

~~~
boyter
I might take you up on the offer! Cheers!

------
cowboyhero
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."

~~~
boyter
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!

------
boyter
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.

------
nowarninglabel
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>

~~~
boyter
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.

------
abraham
Inclusion of GitHub results would be awesome. They have a search API so it
should be fairly easy.

~~~
boyter
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.

------
kingkawn
10/24/10, 10:05pm EST, took minutes to load page initially.

~~~
boyter
Sorry about that.... its hosted on a Westhost VPS and is probably a little
oversold. Its struggling at the moment.

~~~
kingkawn
naw, no sorries, just thought I'd try to give you something more concrete than
"Iz not work."

------
Ancient
Here's a list of Firefox's Ubiquity to search for PHP functions, etc ...
[https://wiki.mozilla.org/Labs/Ubiquity/Commands_In_The_Wild#...](https://wiki.mozilla.org/Labs/Ubiquity/Commands_In_The_Wild#PHP)

------
epynonymous
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.

~~~
boyter
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.

~~~
techbio
OK, clearly you are on a running horse...but have you considered a version for
Python?

~~~
boyter
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.

~~~
neeleshs
+1 for python.

~~~
boyter
<http://www.searchforpython.com/>

Will update it soonish!

------
Tomek_
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".

------
pinchyfingers
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.

~~~
boyter
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.

------
empire29
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.

~~~
boyter
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.

------
photon_off
I tried a few queries, and honestly I find Google's Auto Suggest to be of more
use when searching for PHP functions.

~~~
boyter
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.

~~~
photon_off
Awesome. I'm looking forward to seeing what you come up with.

------
mikeytown2
where's the foreach loop? <http://php.net/foreach>

~~~
boyter
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.

------
smutticus
Why should I use this instead of php.net?

------
iconfinder
Great job!

------
ucentric
Nice!

No blowhard, just a cool service.

Want some work?

richardlauren@me.com

------
9ec4c12949a4f3
Found no results for <?=

