[JAVA-2432] Java driver docs search box has incorrect site field for Google search Created: 24/Jan/17  Updated: 30/Jan/17  Resolved: 30/Jan/17

Status: Closed
Project: Java Driver
Component/s: Documentation
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Matt Kalan Assignee: Ross Lawley
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

From this page on the Java driver github docs (likely all of them), the parameters sent to the Google search are incorrect. The site is duplicated in the parameters
http://mongodb.github.io/mongo-java-driver/3.4/driver/tutorials/databases-collections/

In the search box, when I search for authentication, it does a Google search for
authentication site:mongodb.github.iomongodb.github.io/mongo-java-driver/3.4

The site field is not correct



 Comments   
Comment by Githook User [ 30/Jan/17 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: Docs: JS fix for search form (#175)

As the protocol is not part of the window.location.hostname ensure if
the browser caches the form field that the hostname isn't duplicated on
refresh.

JAVA-2432
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/57fd0486944b2bc3520b3aacbd018fc3a67e28c9

Comment by Ross Lawley [ 30/Jan/17 ]

PR: https://github.com/rozza/mongo-java-driver/pull/175

Comment by Ross Lawley [ 26/Jan/17 ]

I'd prefer to reproduce the issue first, but the fix would be checking for the hostname in the input value.

    if (siteInput.val().indexOf(window.location.hostname) < 0) {
        siteInput.attr("value", window.location.hostname + siteInput.val());
    }

Comment by Ross Lawley [ 26/Jan/17 ]

I can't reproduce at all, tested in Chrome, Safari and Firefox and all work as expected.

I also tested against http and https both work as expected.

The code is a simple JS form submission:

    var siteInput = $('#search input[name="site"]');
    if (siteInput.val().substring(0, 4) != "http") {
        siteInput.attr("value", window.location.hostname + siteInput.val());
    }
    jQuery("#search form").submit(function() {
        $('#search input[name="q"]').attr("value", $('#search input[name="searchQuery"]').val() + ' site:' + $('#search input[name="site"]').val());
    });

So the only way I can see the site field getting a value of :mongodb.github.iomongodb.github.io/mongo-java-driver/3.4 is if there is some level of browser caching. However, that doesn't seem to be the case when I tried to reproduce the issue.

Comment by Jeffrey Yemin [ 26/Jan/17 ]

I can't consistently reproduce this, by the way. I got it the first time I followed the link from the description, but not subsequent times.

Comment by Jeffrey Yemin [ 26/Jan/17 ]

rozza can you take a look at this one please?

Generated at Thu Feb 08 08:57:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.