Skip to main content
Google search as option. Started by Antechinus · · Read 12092 times 0 Members and 1 Guest are viewing this topic. previous topic - next topic

Google search as option.

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.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Google search as option.

Reply #1

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. ;)
The best moment for testing your PR is right after you merge it. Can't miss with that one.

Re: Google search as option.

Reply #2

You have to what the thingummy?

 Antechinus 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. :)
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Google search as option.

Reply #3

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. ;)
Last Edit: March 01, 2013, 09:45:24 am by Norv
The best moment for testing your PR is right after you merge it. Can't miss with that one.

Re: Google search as option.

Reply #4

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.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P


Re: Google search as option.

Reply #6

Yer still not done ... $context['additiona_dropdown_search'] maybe $context['additional_dropdown_search']  :P

Re: Google search as option.

Reply #7

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/
The best moment for testing your PR is right after you merge it. Can't miss with that one.

Re: Google search as option.

Reply #8

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.
Last Edit: March 01, 2013, 09:52:38 pm by Antechinus
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Google search as option.

Reply #9

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.
The best moment for testing your PR is right after you merge it. Can't miss with that one.

Re: Google search as option.

Reply #10

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
Bugs creator.
Features destroyer.
Template killer.

Re: Google search as option.

Reply #11

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.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Google search as option.

Reply #12

Only for guests. :P
Bugs creator.
Features destroyer.
Template killer.

Re: Google search as option.

Reply #13

If you add DuckDuckGo, maybe you can get them to sponsor you later down the road.