Skip to content

Commit

Permalink
Search specific fs, ancestry dbs
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin York committed Apr 28, 2014
1 parent 6461659 commit bc6d32d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
16 changes: 14 additions & 2 deletions gensearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ module.exports = function(config, data){
query = utils.addQueryParam(query, 'msddy', utils.getYear(data.deathDate));
query = utils.addQueryParam(query, 'msgdy', utils.getYear(data.marriageDate));

return ancestryURL + query + '&gl=allgs';
if(config.db){
query = utils.addQueryParam(query, 'db', config.db);
} else {
query = utils.addQueryParam(query, 'gl', 'allgs');
}

return ancestryURL + query;

};

Expand Down Expand Up @@ -192,7 +198,13 @@ module.exports = function(config, data){
}
}

return fsURL + encodeURIComponent(query);
query = encodeURIComponent(query);

if(config.collectionId){
query = utils.addQueryParam(query, 'collection_id', config.collectionId);
}

return fsURL + query;

};

Expand Down
8 changes: 7 additions & 1 deletion src/sites/ancestry.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ module.exports = function(config, data){
query = utils.addQueryParam(query, 'msddy', utils.getYear(data.deathDate));
query = utils.addQueryParam(query, 'msgdy', utils.getYear(data.marriageDate));

return ancestryURL + query + '&gl=allgs';
if(config.db){
query = utils.addQueryParam(query, 'db', config.db);
} else {
query = utils.addQueryParam(query, 'gl', 'allgs');
}

return ancestryURL + query;

};
8 changes: 7 additions & 1 deletion src/sites/familysearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ module.exports = function(config, data){
}
}

return fsURL + encodeURIComponent(query);
query = encodeURIComponent(query);

if(config.collectionId){
query = utils.addQueryParam(query, 'collection_id', config.collectionId);
}

return fsURL + query;

};

Expand Down
4 changes: 4 additions & 0 deletions test/sites/ancestry.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ describe('ancestry', function(){
it('2', function(){
test(test.data[1], 'http://search.ancestry.com/cgi-bin/sse.dll?rank=1&gsfn=Joe%20William&gsln=Clark&msbpn__ftp=Texas&msdpn__ftp=Springfield%2C%20Illinois&msfng0=Dale&msfns0=Clark&msmng0=Susan&msmns0=Anthony&mssng0=Jennifer&mssns0=Thomas&msgpn__ftp=St%20Louis%2C%20MO&msbdy=1835&msddy=1889&msgdy=1858&gl=allgs');
});

it('db', function(){
test(test.data[0], 'http://search.ancestry.com/cgi-bin/sse.dll?rank=1&gsfn=Joe%20William&gsln=Clark&db=bivri_EnglandBirth', {db: 'bivri_EnglandBirth'});
});

});
4 changes: 4 additions & 0 deletions test/sites/familysearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ describe('familysearch', function(){
it('config', function(){
test(test.data[1], 'https://familysearch.org/search/record/results#count=20&query=%2Bgivenname%3A%22Joe%20William%22~%20%2Bsurname%3AClark~%20%2Bbirth_place%3ATexas~%20%2Bdeath_place%3A%22Springfield%2C%20Illinois%22~%20%2Bfather_givenname%3ADale~%20%2Bfather_surname%3AClark~%20%2Bmother_givenname%3ASusan~%20%2Bmother_surname%3AAnthony~%20%2Bspouse_givenname%3AJennifer~%20%2Bspouse_surname%3AThomas~%20%2Bmarriage_place%3A%22St%20Louis%2C%20MO%22~%20%2Bbirth_year%3A1830-1840~%20%2Bdeath_year%3A1884-1894~%20%2Bmarriage_year%3A1853-1863~', {FS_YEAR_PLUS_MINUS: 5});
});

it('collection', function(){
test(test.data[0], 'https://familysearch.org/search/record/results#count=20&query=%2Bgivenname%3A%22Joe%20William%22~%20%2Bsurname%3AClark~&collection_id=1473014', {collectionId: 1473014});
});

});

0 comments on commit bc6d32d

Please sign in to comment.