ElkArte Community

Elk Development => Feature Discussion => Exterminated Features => Topic started by: Antechinus on February 25, 2013, 07:14:18 pm

Title: Google search as option.
Post by: Antechinus on February 25, 2013, 07:14:18 pm
Something I've just gone and implemented over at the den of iniquity. Quite handy, as it's a lot faster than the SMF search, and is perfectly adequate for most public board content.

Particularly handy for guests IMO, given that they can only see the same content as spiders anyway and will probably appreciate the speed. I've made it their only option, since it will cut load on my server.

Could just be added as another option in the existing select.
Title: Re: Google search as option.
Post by: TestMonkey on February 25, 2013, 07:21:30 pm
Please feel free to make it or PR a proposal, though I believe I'd import it into an addon.
We have to initialize the addons repository with the first. ;)
Title: Re: Google search as option.
Post by: Antechinus on February 25, 2013, 07:24:31 pm
You have to what the thingummy?

/me wants it in CSS. :P

Anyway I'm using that old advanced search mod (the one some bloke updated for 2.0.x ;) ), which just does it as one of the included redirects in Search.php. Bugger all code involved, so not sure it's worth an add-on.

Code: [Select]
function QueryPreProcess ()
{
    global $scripturl;
    
    $Redirects = array(
        'members' => $scripturl . '?action=mlist;sa=search;fields=name,email;search=',
        // Google Site Search
        'entiresite' => 'http://www.google.com/search?domains=' . $_SERVER['HTTP_HOST']. '&sitesearch=' . $_SERVER['HTTP_HOST'] . '&q='
    );

    foreach ($Redirects as $redirect => $url)
        if (isset($_REQUEST['search_selection']) && $_REQUEST['search_selection'] == $redirect)
        {
            header('Location: ' . $url . urlencode($_REQUEST['search']));
            exit;
        }
}

And the selects in the templates:
Code: [Select]
function DropDownQuickSearch ()
{
    global $context, $txt;

    // in order!!
        $Selections = array(
            'entireforum' => 'Forum search',
            'thisbrd' => $txt['search_thisbrd'],
            //'thistopic' => $txt['search_thistopic'],
            // Google site search
            'entiresite' => 'Google search'
            //'members' => $txt['search_members'],
        );
Etc. :)
Title: Re: Google search as option.
Post by: TestMonkey on March 01, 2013, 09:26:04 am
The reason is I would prefer Elk to not integrate Google services. As fast as the search is, and as good as it is, yes, obviously, Google Search is a proprietary service using undocumented search algorithms and additions, to display results based on who is asking, and log their searches. They call the first personalized search. I call it bubble. They call the second assistance in building a profile or stuff. I call it tracking.

Thanks for the code. That reminds me we can haz a little hook in the search menu. I have no time for testing atm, but I may get to it if I remember. I agree there's no need to bother with packaging an edit there, you're right.

I just wouldn't be comfortable to promote it by pushing it to people from our packages.

You're welcome to disagree, although I will note that I don't think I can be easy to convince on stuff of this particular kind, you'd need better arguments, and to convince them other meanies. ;)
Title: Re: Google search as option.
Post by: Antechinus on March 01, 2013, 02:07:28 pm
Yes I know about Google's penchant for snooping, but you can disable that (and I do). I'm willing to bet that every other search engine does tracking too, if you don't deliberately switch it off.

Anyway we can provide it as a tips and tricks thing I suppose, since it's so easy.
Title: Re: Google search as option.
Post by: emanuele on March 01, 2013, 03:13:33 pm
https://github.com/emanuele45/Dialogo/commit/e49abe0366f9b704d60603d0dd507ff6e8208477 ? (Yeah, I know, I already fixed it (https://github.com/emanuele45/Dialogo/commit/47f21dba77980cf16a084f92148b131765d2ff95) :P)
Title: Re: Google search as option.
Post by: Spuds on March 01, 2013, 05:45:57 pm
Yer still not done ... $context['additiona_dropdown_search'] maybe $context['additional_dropdown_search']  :P
Title: Re: Google search as option.
Post by: TestMonkey on March 01, 2013, 07:38:39 pm
Quote from: Antechinus – Yes I know about Google's penchant for snooping, but you can disable that (and I do). I'm willing to bet that every other search engine does tracking too, if you don't deliberately switch it off.
https://duckduckgo.com/
Title: Re: Google search as option.
Post by: Antechinus on March 01, 2013, 09:09:59 pm
I likey. How good is their search base? If it's as good as the big names I'll swap over to them.

ETA: Just checked a few things. It's pretty fn good.
Title: Re: Google search as option.
Post by: TestMonkey on March 01, 2013, 11:42:39 pm
IIRC they actually use them "big namez" undercover, and present the results, but use the results public search makes available, not as they would if they'd have yer user data.
Title: Re: Google search as option.
Post by: emanuele on March 02, 2013, 09:37:12 am
Quote from: Spuds – Yer still not done ... $context['additiona_dropdown_search'] maybe $context['additional_dropdown_search']  :P
Yeah...you know I have to win the competition. :P
Title: Re: Google search as option.
Post by: Antechinus on March 02, 2013, 04:42:04 pm
Ok, so if this new-fangled duckduck does the same job as Google without tracking users, why not provide that as an option? Not only will it be a lot faster than SMF search on any sizable forum, but it wont place any load on the forum's server while searching. This means it will be a good option, particularly for guests who can't see non-public content anyway.
Title: Re: Google search as option.
Post by: emanuele on March 02, 2013, 06:31:22 pm
Only for guests. :P
Title: Re: Google search as option.
Post by: Joshua Dickerson on April 01, 2013, 09:14:32 pm
If you add DuckDuckGo, maybe you can get them to sponsor you later down the road.