Skip to content

Commit

Permalink
feat(geosearch): concise search, wildcard search, results limit
Browse files Browse the repository at this point in the history
  • Loading branch information
james-rae committed Apr 1, 2015
1 parent 47e946a commit d94b5c6
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/js/RAMP/Modules/geoSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ define([

var query = "",
defResult = new Deferred(),
listLimit = 10, //TODO should this be defined in the config?
defService;

//search around a point
Expand All @@ -298,13 +299,23 @@ define([
}

if (params.q) {
query += "q=" + escape(params.q) + "&";
//inject wildcards after terms
query += "q=" + escape(params.q.trim().replace('%20', ' ').replace(' ', '* ') + '*') + "&";
}

if (params.prov) {
query += "province=" + params.prov + "&";
}

if (params.concise) {
query += "concise=" + params.concise + "&";
}

if (params.showAll) {
listLimit = 1000; //boost to max allowed by service
}
query += "num=" + listLimit + "&";

console.log("Executing Query: " + query);

//launch the search
Expand Down Expand Up @@ -421,8 +432,10 @@ define([
function geoSearch(input, filters) {
/*
Filters thing
.radius -- size of radius search. default 10
.radius -- size of radius search in km. default 10
.prov -- province code
.concise -- concise type code
.showAll -- show all results or clip to first X. default false
*/
/*
Expand Down

0 comments on commit d94b5c6

Please sign in to comment.