Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sendQuery(searchString, kingdom, limit = 50) {
let formatted = searchString.replace(/(-| )/g, '*');
let titleized = titleize(searchString.replace(/(-)/g, '#')).replace(/( |#)/g, '*');
let titleized2 = titleize(searchString).replace(/( )/g, '*');
let url = proxy +
`&rows=${limit}&q=` +
`(vernacular:*${formatted}*~0.5%20OR%20vernacular:*${titleized}*~0.5%20OR%20vernacular:*${titleized2}*~0.5` +
`%20OR%20nameWOInd:${formatted}*~0.5%20OR%20nameWOInd:*${titleized}*~0.5` +
`%20OR%20tsn:${formatted})` +
(kingdom ? `%20AND%20kingdom:${kingdom}&` : '');
return this.ajax.request(
url, {
method: 'GET'
}).catch(error => {
if(isNotFoundError(error)) {
// handle 404 errors here
console.log(error);
this.flashMessages
sendQuery(searchString, kingdom, limit = 50) {
let formatted = searchString.replace(/(-| )/g, '*');
let titleized = titleize(searchString.replace(/(-)/g, '#')).replace(/( |#)/g, '*');
let titleized2 = titleize(searchString).replace(/( )/g, '*');
let url = proxy +
`&rows=${limit}&q=` +
`(vernacular:*${formatted}*~0.5%20OR%20vernacular:*${titleized}*~0.5%20OR%20vernacular:*${titleized2}*~0.5` +
`%20OR%20nameWOInd:${formatted}*~0.5%20OR%20nameWOInd:*${titleized}*~0.5` +
`%20OR%20tsn:${formatted})` +
(kingdom ? `%20AND%20kingdom:${kingdom}&` : '');
return this.ajax.request(
url, {
method: 'GET'
}).catch(error => {
if(isNotFoundError(error)) {
// handle 404 errors here
console.log(error);
this.flashMessages
.warning('No taxa object found.');