Skip to content

Commit

Permalink
google; closes rootsdev#8
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin York committed Jan 29, 2015
1 parent 0ac2090 commit 0f4e73c
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 21 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ var genSearch = require('gen-search');
* [genealogybank](#genealogybank)
* [geneanet.en](#geneanet.en)
* [geni](#geni)
* [google](#google)
* [myheritage](#myheritage)
* [newspapers](#newspapers)
* [openarchives](#openarchives)
Expand Down Expand Up @@ -259,6 +260,14 @@ var url = gensearch('geni', data);

Only `givenName` and `familyName` are used for Geni searches.

### google

https://www.google.com

```javascript
var url = gensearch('google', data);
```

### myheritage

http://www.myheritage.com
Expand Down
64 changes: 43 additions & 21 deletions gensearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var sites = {
'genealogieonline': _dereq_('./sites/genealogieonline.js'),
'genealogybank': _dereq_('./sites/genealogybank.js'),
'geni': _dereq_('./sites/geni.js'),
'google': _dereq_('./sites/google.js'),
'myheritage': _dereq_('./sites/myheritage.js'),
'newspapers': _dereq_('./sites/newspapers.js'),
'openarchives': _dereq_('./sites/openarchives.js'),
Expand Down Expand Up @@ -58,7 +59,7 @@ search.config = function(site, siteConfig){
}
};

},{"./sites/ancestry.js":2,"./sites/archives.js":3,"./sites/billiongraves.js":4,"./sites/chroniclingamerica.js":5,"./sites/familysearch.js":6,"./sites/findagrave.js":7,"./sites/findmypast.co.uk.js":8,"./sites/findmypast.com.js":9,"./sites/fold3.js":11,"./sites/genealogieonline.js":12,"./sites/genealogybank.js":13,"./sites/geneanet.en.js":14,"./sites/geni.js":15,"./sites/myheritage.js":16,"./sites/newspapers.js":17,"./sites/openarchives.js":18,"./sites/usgenweb.js":19,"./sites/werelate.js":20,"./sites/worldvitalrecords.js":21,"./utils.js":22}],2:[function(_dereq_,module,exports){
},{"./sites/ancestry.js":2,"./sites/archives.js":3,"./sites/billiongraves.js":4,"./sites/chroniclingamerica.js":5,"./sites/familysearch.js":6,"./sites/findagrave.js":7,"./sites/findmypast.co.uk.js":8,"./sites/findmypast.com.js":9,"./sites/fold3.js":11,"./sites/genealogieonline.js":12,"./sites/genealogybank.js":13,"./sites/geneanet.en.js":14,"./sites/geni.js":15,"./sites/google.js":16,"./sites/myheritage.js":17,"./sites/newspapers.js":18,"./sites/openarchives.js":19,"./sites/usgenweb.js":20,"./sites/werelate.js":21,"./sites/worldvitalrecords.js":22,"./utils.js":23}],2:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

module.exports = function(config, data){
Expand Down Expand Up @@ -103,7 +104,7 @@ module.exports = function(config, data){

};

},{"../utils.js":22}],3:[function(_dereq_,module,exports){
},{"../utils.js":23}],3:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

var defaultConfig = {
Expand Down Expand Up @@ -137,7 +138,7 @@ module.exports = function(config, data){

};

},{"../utils.js":22}],4:[function(_dereq_,module,exports){
},{"../utils.js":23}],4:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

var defaultConfig = {
Expand Down Expand Up @@ -170,7 +171,7 @@ module.exports = function(config, data){

};

},{"../utils.js":22}],5:[function(_dereq_,module,exports){
},{"../utils.js":23}],5:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

module.exports = function(config, data){
Expand Down Expand Up @@ -200,7 +201,7 @@ module.exports = function(config, data){

};

},{"../utils.js":22}],6:[function(_dereq_,module,exports){
},{"../utils.js":23}],6:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

var defaultConfig = {
Expand Down Expand Up @@ -289,7 +290,7 @@ function addQueryParam(query, queryParam, paramValue) {
}
return query;
};
},{"../utils.js":22}],7:[function(_dereq_,module,exports){
},{"../utils.js":23}],7:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

module.exports = function(config, data){
Expand Down Expand Up @@ -318,7 +319,7 @@ module.exports = function(config, data){

};

},{"../utils.js":22}],8:[function(_dereq_,module,exports){
},{"../utils.js":23}],8:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js'),
fmp = _dereq_('./findmypast.js');

Expand All @@ -332,7 +333,7 @@ module.exports = function(config, data){
config = utils.defaults(config, defaultConfig);
return fmp(config, data, 'co.uk');
};
},{"../utils.js":22,"./findmypast.js":10}],9:[function(_dereq_,module,exports){
},{"../utils.js":23,"./findmypast.js":10}],9:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js'),
fmp = _dereq_('./findmypast.js');

Expand All @@ -346,7 +347,7 @@ module.exports = function(config, data){
config = utils.defaults(config, defaultConfig);
return fmp(config, data, 'com');
};
},{"../utils.js":22,"./findmypast.js":10}],10:[function(_dereq_,module,exports){
},{"../utils.js":23,"./findmypast.js":10}],10:[function(_dereq_,module,exports){
/**
* This is not a site config. It is a common util for
* the findmypast sites that only differ in the TLD.
Expand Down Expand Up @@ -418,7 +419,7 @@ module.exports = function(config, data, tld){
return baseUrl + query;

};
},{"../utils.js":22}],11:[function(_dereq_,module,exports){
},{"../utils.js":23}],11:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

module.exports = function(config, data){
Expand All @@ -444,7 +445,7 @@ module.exports = function(config, data){

};

},{"../utils.js":22}],12:[function(_dereq_,module,exports){
},{"../utils.js":23}],12:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

var defaultConfig = {
Expand Down Expand Up @@ -501,7 +502,7 @@ module.exports = function(config, data){

};

},{"../utils.js":22}],13:[function(_dereq_,module,exports){
},{"../utils.js":23}],13:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

var defaultConfig = {
Expand Down Expand Up @@ -564,7 +565,7 @@ module.exports = function(config, data){

};

},{"../utils.js":22}],14:[function(_dereq_,module,exports){
},{"../utils.js":23}],14:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

var defaultConfig = {
Expand Down Expand Up @@ -605,7 +606,7 @@ module.exports = function(config, data){
return url + query;

};
},{"../utils.js":22}],15:[function(_dereq_,module,exports){
},{"../utils.js":23}],15:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

module.exports = function(config, data){
Expand All @@ -631,7 +632,28 @@ module.exports = function(config, data){

};

},{"../utils.js":22}],16:[function(_dereq_,module,exports){
},{"../utils.js":23}],16:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

module.exports = function(config, data){

var url = 'https://www.google.com/search?q=';

var searchWords = ['~genealogy'];
if(data.givenName) {
searchWords.push(data.givenName);
}
if(data.familyName) {
searchWords.push(data.familyName);
}

if(data.birthPlace) {
searchWords.push(data.birthPlace);
}

return url += encodeURIComponent(searchWords.join(' '));
};
},{"../utils.js":23}],17:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

module.exports = function(config, data){
Expand Down Expand Up @@ -730,7 +752,7 @@ function fixSpace(str){
return str.replace(/ /g, '%2F3');
}

},{"../utils.js":22}],17:[function(_dereq_,module,exports){
},{"../utils.js":23}],18:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

var defaultConfig = {
Expand Down Expand Up @@ -800,7 +822,7 @@ module.exports = function(config, data){

};

},{"../utils.js":22}],18:[function(_dereq_,module,exports){
},{"../utils.js":23}],19:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

module.exports = function(config, data){
Expand All @@ -825,7 +847,7 @@ module.exports = function(config, data){
return url + query;

};
},{"../utils.js":22}],19:[function(_dereq_,module,exports){
},{"../utils.js":23}],20:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

module.exports = function(config, data){
Expand All @@ -847,7 +869,7 @@ module.exports = function(config, data){
return url + query;

};
},{"../utils.js":22}],20:[function(_dereq_,module,exports){
},{"../utils.js":23}],21:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

var defaultConfig = {
Expand Down Expand Up @@ -896,7 +918,7 @@ module.exports = function(config, data){

};

},{"../utils.js":22}],21:[function(_dereq_,module,exports){
},{"../utils.js":23}],22:[function(_dereq_,module,exports){
var utils = _dereq_('../utils.js');

var defaultConfig = {
Expand Down Expand Up @@ -936,7 +958,7 @@ module.exports = function(config, data){

};

},{"../utils.js":22}],22:[function(_dereq_,module,exports){
},{"../utils.js":23}],23:[function(_dereq_,module,exports){
var utils = {};

/**
Expand Down
1 change: 1 addition & 0 deletions src/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var sites = {
'genealogieonline': require('./sites/genealogieonline.js'),
'genealogybank': require('./sites/genealogybank.js'),
'geni': require('./sites/geni.js'),
'google': require('./sites/google.js'),
'myheritage': require('./sites/myheritage.js'),
'newspapers': require('./sites/newspapers.js'),
'openarchives': require('./sites/openarchives.js'),
Expand Down
20 changes: 20 additions & 0 deletions src/sites/google.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var utils = require('../utils.js');

module.exports = function(config, data){

var url = 'https://www.google.com/search?q=';

var searchWords = ['~genealogy'];
if(data.givenName) {
searchWords.push(data.givenName);
}
if(data.familyName) {
searchWords.push(data.familyName);
}

if(data.birthPlace) {
searchWords.push(data.birthPlace);
}

return url += encodeURIComponent(searchWords.join(' '));
};
13 changes: 13 additions & 0 deletions test/sites/google.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var test = require('../tester.js')('google');

describe('google', function(){

it('1', function(){
test(test.data[0], 'https://www.google.com/search?q=~genealogy%20Joe%20William%20Clark');
});

it('2', function(){
test(test.data[1], 'https://www.google.com/search?q=~genealogy%20Joe%20William%20Clark%20Texas');
});

});

0 comments on commit 0f4e73c

Please sign in to comment.