Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGN search string length must be between 3 and 200 chars #4840

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions assets/src/modules/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,11 @@ export default class Search {

// Format answers to highlight searched keywords
var labrex = this._getHighlightRegEx();
const searchQuery = document.getElementById('search-query').value;
switch (searchConfig.service) {
case 'nominatim':
$.get(service
, { "query": $('#search-query').val(), "bbox": extent.toBBOX() }
, { "query": searchQuery, "bbox": extent.toBBOX() }
, data => {
var text = '';
var count = 0;
Expand Down Expand Up @@ -220,8 +221,12 @@ export default class Search {
}, 'json');
break;
case 'ign':
if (searchQuery.length < 3 || searchQuery.length > 200) {
lizMap.addMessage(lizDict['externalsearch.ignlimit'], 'warning', true);
break;
}
let mapExtent4326 = transformExtent(mainLizmap.map.getView().calculateExtent(), mainLizmap.projection, 'EPSG:4326');
let queryParam = '?text=' + $('#search-query').val() + '&type=StreetAddress&maximumResponses=10&bbox=' + mapExtent4326
let queryParam = '?text=' + searchQuery + '&type=StreetAddress&maximumResponses=10&bbox=' + mapExtent4326
$.getJSON(encodeURI(service + queryParam), data => {
let text = '';
let count = 0;
Expand All @@ -238,7 +243,7 @@ export default class Search {
break;
case 'google':
service.geocode({
'address': $('#search-query').val(),
'address': searchQuery,
'bounds': new google.maps.LatLngBounds(
new google.maps.LatLng(extent.top, extent.left),
new google.maps.LatLng(extent.bottom, extent.right)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ externalsearch.search=Searching
externalsearch.notfound=No results
externalsearch.mapdata=Map data
externalsearch.noquery=Search query is empty
externalsearch.ignlimit=IGN search must contain between 3 and 200 characters

timemanager.toolbar.play=Play
timemanager.toolbar.pause=Pause
Expand Down
Loading