Browse Source

feat(address_search_using_ids): add postcode to variable store if we have it

address_search_using_ids
Peter Johnson 6 years ago
parent
commit
ad507b25d6
  1. 3
      query/address_search_using_ids.js
  2. 2
      test/unit/query/address_search_using_ids.js

3
query/address_search_using_ids.js

@ -112,6 +112,9 @@ function generateQuery( clean, res ){
if( ! _.isEmpty(clean.parsed_text.number) ){
vs.var( 'input:housenumber', clean.parsed_text.number );
}
if( ! _.isEmpty(clean.parsed_text.postalcode) ){
vs.var( 'input:postcode', clean.parsed_text.postalcode );
}
vs.var( 'input:street', clean.parsed_text.street );
// find the first granularity band for which there are results

2
test/unit/query/address_search_using_ids.js

@ -29,6 +29,7 @@ module.exports.tests.base_query = (test, common) => {
const clean = {
parsed_text: {
number: 'housenumber value',
postalcode: 'postcode value',
street: 'street value'
}
};
@ -52,6 +53,7 @@ module.exports.tests.base_query = (test, common) => {
t.equals(generatedQuery.type, 'address_search_using_ids');
t.equals(generatedQuery.body.vs.var('input:housenumber').toString(), 'housenumber value');
t.equals(generatedQuery.body.vs.var('input:postcode').toString(), 'postcode value');
t.equals(generatedQuery.body.vs.var('input:street').toString(), 'street value');
t.notOk(generatedQuery.body.vs.isset('sources'));
t.equals(generatedQuery.body.vs.var('size').toString(), 20);

Loading…
Cancel
Save