|
|
@ -32,7 +32,6 @@ function generateQuery( clean ){ |
|
|
|
|
|
|
|
|
|
|
|
const vs = new peliasQuery.Vars( defaults ); |
|
|
|
const vs = new peliasQuery.Vars( defaults ); |
|
|
|
|
|
|
|
|
|
|
|
let logStr = '[query:search] [parser:libpostal] '; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// input text
|
|
|
|
// input text
|
|
|
|
vs.var( 'input:name', clean.text ); |
|
|
|
vs.var( 'input:name', clean.text ); |
|
|
@ -40,25 +39,21 @@ function generateQuery( clean ){ |
|
|
|
// sources
|
|
|
|
// sources
|
|
|
|
if( check.array(clean.sources) && clean.sources.length ) { |
|
|
|
if( check.array(clean.sources) && clean.sources.length ) { |
|
|
|
vs.var( 'sources', clean.sources); |
|
|
|
vs.var( 'sources', clean.sources); |
|
|
|
logStr += '[param:sources] '; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// layers
|
|
|
|
// layers
|
|
|
|
if( check.array(clean.layers) && clean.layers.length ) { |
|
|
|
if( check.array(clean.layers) && clean.layers.length ) { |
|
|
|
vs.var('layers', clean.layers); |
|
|
|
vs.var('layers', clean.layers); |
|
|
|
logStr += '[param:layers] '; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// categories
|
|
|
|
// categories
|
|
|
|
if (clean.categories) { |
|
|
|
if (clean.categories) { |
|
|
|
vs.var('input:categories', clean.categories); |
|
|
|
vs.var('input:categories', clean.categories); |
|
|
|
logStr += '[param:categories] '; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// size
|
|
|
|
// size
|
|
|
|
if( clean.querySize ) { |
|
|
|
if( clean.querySize ) { |
|
|
|
vs.var( 'size', clean.querySize ); |
|
|
|
vs.var( 'size', clean.querySize ); |
|
|
|
logStr += '[param:querySize] '; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// focus point
|
|
|
|
// focus point
|
|
|
@ -68,7 +63,6 @@ function generateQuery( clean ){ |
|
|
|
'focus:point:lat': clean['focus.point.lat'], |
|
|
|
'focus:point:lat': clean['focus.point.lat'], |
|
|
|
'focus:point:lon': clean['focus.point.lon'] |
|
|
|
'focus:point:lon': clean['focus.point.lon'] |
|
|
|
}); |
|
|
|
}); |
|
|
|
logStr += '[param:focus_point] '; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// boundary rect
|
|
|
|
// boundary rect
|
|
|
@ -82,7 +76,6 @@ function generateQuery( clean ){ |
|
|
|
'boundary:rect:bottom': clean['boundary.rect.min_lat'], |
|
|
|
'boundary:rect:bottom': clean['boundary.rect.min_lat'], |
|
|
|
'boundary:rect:left': clean['boundary.rect.min_lon'] |
|
|
|
'boundary:rect:left': clean['boundary.rect.min_lon'] |
|
|
|
}); |
|
|
|
}); |
|
|
|
logStr += '[param:boundary_rect] '; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// boundary circle
|
|
|
|
// boundary circle
|
|
|
@ -99,7 +92,6 @@ function generateQuery( clean ){ |
|
|
|
'boundary:circle:radius': Math.round( clean['boundary.circle.radius'] ) + 'km' |
|
|
|
'boundary:circle:radius': Math.round( clean['boundary.circle.radius'] ) + 'km' |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
logStr += '[param:boundary_circle] '; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// boundary country
|
|
|
|
// boundary country
|
|
|
@ -107,7 +99,6 @@ function generateQuery( clean ){ |
|
|
|
vs.set({ |
|
|
|
vs.set({ |
|
|
|
'boundary:country': clean['boundary.country'] |
|
|
|
'boundary:country': clean['boundary.country'] |
|
|
|
}); |
|
|
|
}); |
|
|
|
logStr += '[param:boundary_country] '; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// run the address parser
|
|
|
|
// run the address parser
|
|
|
@ -119,13 +110,6 @@ function generateQuery( clean ){ |
|
|
|
|
|
|
|
|
|
|
|
//console.log(JSON.stringify(q, null, 2));
|
|
|
|
//console.log(JSON.stringify(q, null, 2));
|
|
|
|
|
|
|
|
|
|
|
|
if (q !== undefined) { |
|
|
|
|
|
|
|
logger.debug(logStr); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
logger.debug('[parser:libpostal] query type not supported'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return q; |
|
|
|
return q; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|