|
|
@ -30,14 +30,14 @@ function generate( params ){ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if (params.parsed_input) { |
|
|
|
if (params.parsed_input) { |
|
|
|
addParsedMatch(query, input, params.parsed_input); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// update input
|
|
|
|
// update input
|
|
|
|
if (params.parsed_input.number && params.parsed_input.street) { |
|
|
|
if (params.parsed_input.number && params.parsed_input.street) { |
|
|
|
input = params.parsed_input.number + ' ' + params.parsed_input.street; |
|
|
|
input = params.parsed_input.number + ' ' + params.parsed_input.street; |
|
|
|
} else if (params.parsed_input.admin_parts) { |
|
|
|
} else if (params.parsed_input.admin_parts) { |
|
|
|
input = params.parsed_input.name; |
|
|
|
input = params.parsed_input.name; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addParsedMatch(query, input, params.parsed_input); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// add search condition to distance query
|
|
|
|
// add search condition to distance query
|
|
|
@ -122,11 +122,13 @@ function addUnmatchedAdminFieldsToQuery(query, unmatchedAdminFields, parsedInput |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
leftovers = leftovers.join(' '); |
|
|
|
|
|
|
|
|
|
|
|
// if there are additional regions/admin_parts found
|
|
|
|
// if there are additional regions/admin_parts found
|
|
|
|
if (leftovers !== defaultInput) { |
|
|
|
if (leftovers !== defaultInput) { |
|
|
|
unmatchedAdminFields.forEach(function (key) { |
|
|
|
unmatchedAdminFields.forEach(function (key) { |
|
|
|
// combine all the leftover parts into one string
|
|
|
|
// combine all the leftover parts into one string
|
|
|
|
addMatch(query, [], key, leftovers.join(' ')); |
|
|
|
addMatch(query, [], key, leftovers); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|