lib/Models/GnafApi.js
function convertLuceneHit(locational, item) {
  var jsonInfo = JSON.parse(item.json);

  return {
    score: item.score,
    locational: locational,
    name: item.d61Address
      .slice(0, 3)
      .filter(function(string) {
        return string.length > 0;
      })
      .join(", "),
    flatNumber: sanitiseAddressNumber(jsonInfo.flat.number),
    level: sanitiseAddressNumber(jsonInfo.level.number),
    numberFirst: sanitiseAddressNumber(jsonInfo.numberFirst.number),
    numberLast: sanitiseAddressNumber(jsonInfo.numberLast.number),
    street: jsonInfo.street,
    localityName: jsonInfo.localityName,
    localityVariantNames: jsonInfo.localityVariant.map(function(locality) {
      return locality.localityName;
    }),
    state: {
      abbreviation: jsonInfo.stateAbbreviation,
      name: jsonInfo.stateName
    },
    postCode: jsonInfo.postcode,
    location: {
      latitude: jsonInfo.location.lat,
      longitude: jsonInfo.location.lon
    }
  };
}
function convertLuceneHit(locational, item) {
  var jsonInfo = JSON.parse(item.json);

  return {
    score: item.score,
    locational: locational,
    name: item.d61Address
      .slice(0, 3)
      .filter(function(string) {
        return string.length > 0;
      })
      .join(", "),
    flatNumber: sanitiseAddressNumber(jsonInfo.flat.number),
    level: sanitiseAddressNumber(jsonInfo.level.number),
    numberFirst: sanitiseAddressNumber(jsonInfo.numberFirst.number),
    numberLast: sanitiseAddressNumber(jsonInfo.numberLast.number),
    street: jsonInfo.street,
    localityName: jsonInfo.localityName,
    localityVariantNames: jsonInfo.localityVariant.map(function(locality) {
      return locality.localityName;
    }),
    state: {
      abbreviation: jsonInfo.stateAbbreviation,
      name: jsonInfo.stateName
    },
    postCode: jsonInfo.postcode,
    location: {
      latitude: jsonInfo.location.lat,
      longitude: jsonInfo.location.lon
    }
  };
}
function convertLuceneHit ( locational , item ) { var jsonInfo = JSON . parse ( item . json ) ; return { score : item . score , locational : locational , name : item . d61Address . slice ( 0 , 3 ) . filter ( function ( string ) { return string . length > 0 ; } ) . join ( ", " ) , flatNumber : sanitiseAddressNumber ( jsonInfo . flat . number ) , level : sanitiseAddressNumber ( jsonInfo . level . number ) , numberFirst : sanitiseAddressNumber ( jsonInfo . numberFirst . number ) , numberLast : sanitiseAddressNumber ( jsonInfo . numberLast . number ) , street : jsonInfo . street , localityName : jsonInfo . localityName , localityVariantNames : jsonInfo . localityVariant . map ( function ( locality ) { return locality . localityName ; } ) , state : { abbreviation : jsonInfo . stateAbbreviation , name : jsonInfo . stateName } , postCode : jsonInfo . postcode , location : { latitude : jsonInfo . location . lat , longitude : jsonInfo . location . lon } } ; }
Converts from the Lucene schema to a neater one better suited to addresses.

@param {boolean} locational Whether to set locational to true - this is set for results that came up within the bounding box
passed to {@link #geoCode}.
@param {object} item The lucene schema object to convert.
Converts from the Lucene schema to a neater one better suited to addresses .