Browse Source

commented out deprecated AddressIt code

pull/666/head
Stephen Hess 9 years ago
parent
commit
ab9b1dbafa
  1. 72
      query/text_parser.js

72
query/text_parser.js

@ -19,22 +19,22 @@ var adminFields = placeTypes.concat([
function addParsedVariablesToQueryVariables( parsed_text, vs ){ function addParsedVariablesToQueryVariables( parsed_text, vs ){
// is it a street address? // is it a street address?
var isStreetAddress = parsed_text.hasOwnProperty('number') && parsed_text.hasOwnProperty('street'); // var isStreetAddress = parsed_text.hasOwnProperty('number') && parsed_text.hasOwnProperty('street');
if( isStreetAddress ){ // if( isStreetAddress ){
vs.var( 'input:name', parsed_text.number + ' ' + parsed_text.street ); // vs.var( 'input:name', parsed_text.number + ' ' + parsed_text.street );
} // }
//
// ? // // ?
else if( parsed_text.admin_parts ) { // else if( parsed_text.admin_parts ) {
vs.var( 'input:name', parsed_text.name ); // vs.var( 'input:name', parsed_text.name );
} // }
//
// ? // // ?
else { // else {
logger.warn( 'chaos monkey asks: what happens now?' ); // logger.warn( 'chaos monkey asks: what happens now?' );
logger.warn( parsed_text ); // logger.warn( parsed_text );
try{ throw new Error(); } catch(e){ logger.warn( e.stack ); } // print a stack trace // try{ throw new Error(); } catch(e){ logger.warn( e.stack ); } // print a stack trace
} // }
// ==== add parsed matches [address components] ==== // ==== add parsed matches [address components] ====
@ -74,26 +74,26 @@ function addParsedVariablesToQueryVariables( parsed_text, vs ){
// @todo: clean up this code // @todo: clean up this code
// a concept called 'leftovers' which is just 'admin_parts' /or 'regions'. // a concept called 'leftovers' which is just 'admin_parts' /or 'regions'.
var leftoversString = ''; // var leftoversString = '';
if( parsed_text.hasOwnProperty('admin_parts') ){ // if( parsed_text.hasOwnProperty('admin_parts') ){
leftoversString = parsed_text.admin_parts; // leftoversString = parsed_text.admin_parts;
} // }
else if( parsed_text.hasOwnProperty('regions') ){ // else if( parsed_text.hasOwnProperty('regions') ){
leftoversString = parsed_text.regions.join(' '); // leftoversString = parsed_text.regions.join(' ');
} // }
//
// if we have 'leftovers' then assign them to any fields which // // if we have 'leftovers' then assign them to any fields which
// currently don't have a value assigned. // // currently don't have a value assigned.
if( leftoversString.length ){ // if( leftoversString.length ){
//
// cycle through fields and set fields which // // cycle through fields and set fields which
// are still currently unset // // are still currently unset
adminFields.forEach( function( key ){ // adminFields.forEach( function( key ){
if( !vs.isset( 'input:' + key ) ){ // if( !vs.isset( 'input:' + key ) ){
vs.var( 'input:' + key, leftoversString ); // vs.var( 'input:' + key, leftoversString );
} // }
}); // });
} // }
} }
module.exports = addParsedVariablesToQueryVariables; module.exports = addParsedVariablesToQueryVariables;

Loading…
Cancel
Save