Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to /core/DataFiles/SearchEngines.php #916

Closed
anonymous-matomo-user opened this issue Aug 10, 2009 · 6 comments
Closed

Changes to /core/DataFiles/SearchEngines.php #916

anonymous-matomo-user opened this issue Aug 10, 2009 · 6 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@anonymous-matomo-user
Copy link

Attached is a patch against /core/DataFiles/SearchEngines.php with the following changes:

a) Added Google Zimbabwe (www.google.co.zw)
b) Updated URL of Metager (meta.rrz.uni-hannover.de). The old URL does not work anymore, so I think it's safe to replace it.
c) Added parameters as_q and as_epq for everything Google. These parameters are used by search appliances (instead of the usual q) and I've seen them for some, but not all Google sites. It seems wise to add them for all Google sites, though.

@anonymous-matomo-user
Copy link
Author

Attachment: Patch against /core/DataFiles/SearchEngines.php
piwik-se.patch

@robocoder
Copy link
Contributor

Is this level of duplication necessary? If so, I'd prefer a code patch to eliminate the need for such duplication.

@anonymous-matomo-user
Copy link
Author

Well, as I said, I've seen the as_* strings only for some Google sites. That I don't see them for all of Google doesn't mean that they are not in use at most of Google, though. I have no idea how much performance it costs to have an array instead of a string as the parameter, so you have to decide what to do here (or maybe you can give some insight into it?).
Fact is, that you miss a lot of search requests, if you do not include these additional parameters at all (depending on where your search requests come from of course), so the minimum policy should be, that they will be included, if we know that they are in use (i.e. we've seen them).

I'll upload two new patches later today. Both with less code duplication and one with the additional parameters applied only to those Google sites where I've actually seen as_*.

@robocoder
Copy link
Contributor

To clarify... I would prefer to see less duplication of the keyword string (or array) in core/DataFiles/SearchEngines.php. Can we make it optional (either undefined or set to false), similar to the path (3rd array element). So, in core/Common.php, we could use something like this: (untested)

Index: Common.php
===================================================================
--- Common.php  (revision 1384)
+++ Common.php  (working copy)
@@ -773,6 +773,11 @@
        }
        $searchEngineName = $GLOBALS['Piwik_SearchEngines'][$refererHost][0];
        $variableNames = $GLOBALS['Piwik_SearchEngines'][$refererHost][1];
+       if(!isset($variableNames) || $variableNames === false)
+       {
+           $url = $GLOBALS['Piwik_SearchEngines_NameToUrl'][$searchEngineName];
+           $variableNames = $GLOBALS['Piwik_SearchEngines'][$url][1];
+       }
        if(!is_array($variableNames))
        {
            $variableNames = array($variableNames);

@robocoder
Copy link
Contributor

In [1404], refs #916 - optional query parameters

In [1403], fixes #916 - add www.google.co.zw and update Metager

@robocoder
Copy link
Contributor

Deferring the addition of as_q and as_epq as these can both appear in query at the same time; doing this right means coding some Google-specific URL parser. (Could possibly also address as_oq and as_eq at that time...)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

2 participants