# CHANGES
+* version 3.2.2 - 2022-04-05
+
+ * Fix: On Search page the 'deduplication' checkbox needs to be checked by default
+
* version 3.2.1 - 2021-05-11
* Fix: some npm modules no longer support node version 10
{
"name": "nominatim-ui",
"description": "Debug web interface for Nominatim geocoder",
- "version": "3.2.1",
+ "version": "3.2.2",
"license": "GPL-2.0",
"scripts": {
"build": "rollup -c",
}
function set_dedupe(e) {
- document.querySelector('input[name=dedupe]').value = e.target.checked ? 1 : '';
+ document.querySelector('input[name=dedupe]').value = e.target.checked ? 1 : 0;
}
function set_api_param(e) {
<div class="col-auto">
<button type="submit" class="btn btn-primary btn-sm mx-1">Search</button>
<input type="hidden" name="viewbox" value="{sViewBox || ''}" />
- <input type="hidden" name="dedupe" value="{!api_request_params.dedupe ? '' : 1}" />
+ <input type="hidden" name="dedupe" value="{api_request_params.dedupe === 0 ? 0 : 1}" />
<input type="hidden" name="bounded" value="{api_request_params.bounded ? 1 : ''}" />
<input type="hidden" name="accept-language" value="{api_request_params['accept-language'] || ''}" />
<input type="hidden" name="countrycodes" value="{api_request_params.countrycodes || ''}"
<div class="col-auto">
<button type="submit" class="btn btn-primary btn-sm">Search</button>
<input type="hidden" name="viewbox" value="{sViewBox || ''}" />
- <input type="hidden" name="dedupe" value="{!api_request_params.dedupe ? '' : 1}" />
+ <input type="hidden" name="dedupe" value="{api_request_params.dedupe === 0 ? 0 : 1}" />
<input type="hidden" name="bounded" value="{api_request_params.bounded ? 1 : ''}" />
<input type="hidden" name="accept-language" value="{api_request_params['accept-language'] || ''}" />
<input type="hidden" name="countrycodes" value="{api_request_params.countrycodes || ''}"
<div class="form-check form-check-inline">
<label class="form-check-label" for="option_dedupe">deduplicate results</label>
<input type="checkbox" class="form-check-input api-param-setting"
- id="option_dedupe" checked={!!api_request_params.dedupe} on:change={set_dedupe}>
+ id="option_dedupe" checked={api_request_params.dedupe === 0 ? 0 : 1} on:change={set_dedupe}>
</div>
</li>
if (['checkbox', 'radio'].indexOf(field.type) > -1 && !field.checked) return;
if (typeof field.value === 'undefined' || field.value === '') return;
+ // Default value for /search endpoint
+ if (field.name === 'dedupe' && (field.value === 1 || field.value === '1')) return;
+
params.set(field.name, field.value);
});
}
function generate_nominatim_api_url(endpoint_name, params) {
+ // default value for /search
+ if (params.dedupe === 1) delete params.dedupe;
+
extend_parameters(params, Nominatim_Config.Nominatim_API_Endpoint_Params);
return Nominatim_Config.Nominatim_API_Endpoint + endpoint_name + '.php?'
+ Object.keys(clean_up_parameters(params)).map((k) => {
polygon_geojson: Nominatim_Config.Search_AreaPolygons ? 1 : 0,
viewbox: search_params.get('viewbox'),
bounded: search_params.get('bounded'),
- dedupe: search_params.get('dedupe'),
+ dedupe: (!search_params.has('dedupe') || search_params.get('dedupe') === '1') ? 1 : 0,
'accept-language': search_params.get('accept-language'),
countrycodes: search_params.get('countrycodes'),
limit: search_params.get('limit'),
assert.equal((await page.$$('#map')).length, 1);
});
+ it('should default to dedupe=1', async function () {
+ const checkbox_checked = await page.$eval('#option_dedupe', el => el.checked);
+ assert.equal(checkbox_checked, true);
+
+ const links_href = await page.$$eval('#api-request a', links => links.map(l => l.href));
+ let api_request_url = new URL(links_href[0]);
+ let debug_url = new URL(links_href[1]);
+
+ assert.deepStrictEqual(api_request_url.searchParams.has('dedupe'), false);
+ assert.deepStrictEqual(debug_url.searchParams.has('dedupe'), false);
+ });
+
it('should have polygon and marker in map and minimap', async function () {
assert.strictEqual((await page.$$('#map .leaflet-overlay-pane path')).length, 4);
});