private string GetCounty(PostcodeParentAreas postcode)
 {
     return parentAreaCodeToName[postcode.AreaCode102];
 }
 private void IndexPostcode(PostcodeParentAreas postcode, IndexWriter writer)
 {
     Document doc = new Document();
     AddAnalysedField(doc, FieldNames.Postcode, postcode.Postcode.ToLower());
     AddCounty(GetCounty(postcode), doc);
     AddParentAreaCodes(postcode, doc);
     AddPlaceTypeWeighting(postcode.PlaceTypeWeighting, doc);
     AddEastingAndNorthing(doc, postcode.Easting, postcode.Northing);
     writer.AddDocument(doc);
 }
 private void AddParentAreaCodes(PostcodeParentAreas parentAreas, Document doc)
 {
     AddParentAreaMapping(doc, AreaTypeIds.GoRegion, parentAreas.AreaCode6);
     AddParentAreaMapping(doc, AreaTypeIds.CountyAndUnitaryAuthority, parentAreas.AreaCode102);
     AddParentAreaMapping(doc, AreaTypeIds.DistrictAndUnitaryAuthority, parentAreas.AreaCode101);
     AddParentAreaMapping(doc, AreaTypeIds.Ccg, parentAreas.AreaCode19);
     AddParentAreaMapping(doc, AreaTypeIds.Subregion, parentAreas.AreaCode46);
     AddParentAreaMapping(doc, AreaTypeIds.PheCentresFrom2013To2015, parentAreas.AreaCode103);
     AddParentAreaMapping(doc, AreaTypeIds.PheCentresFrom2015, parentAreas.AreaCode104);
 }