Browse Source

Fix bug introduced by moving leftovers.join into the if() statement

pull/192/head
Diana Shkolnikov 10 years ago
parent
commit
d7871747e1
  1. 8
      query/search.js

8
query/search.js

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

Loading…
Cancel
Save