q: search_params.get('q'),
polygon_geojson: search_params.get('polygon_geojson') ? 1 : 0,
viewbox: search_params.get('viewbox'),
+ exclude_place_ids: search_params.get('exclude_place_ids'),
format: 'jsonv2'
};
// aSearchResults: aResults,
sQuery: api_request_params.q,
sViewBox: search_params.get('viewbox'),
- env: Nominatim_Config,
- sMoreURL: ''
+ env: Nominatim_Config
+ // sMoreURL: 'x'
};
if (api_request_params.q) {
context.aSearchResults = aResults;
+ if (aResults.length >= 10) {
+ var aExcludePlaceIds = [];
+ if (search_params.has('exclude_place_ids')) {
+ aExcludePlaceIds.search_params.get('exclude_place_ids').split(',');
+ }
+ for (var i = 0; i < aResults.length; i += 1) {
+ aExcludePlaceIds.push(aResults[i].place_id);
+ }
+
+ var parsed_url = new URLSearchParams(window.location.search);
+ parsed_url.set('exclude_place_ids', aExcludePlaceIds.join(','));
+ context.sMoreURL = '?' + parsed_url.toString();
+ }
+
render_template($('main'), 'searchpage-template', context);
update_html_title('Result for ' + api_request_params.q);