public void TestWeighting() { var city = new PlaceName {PlaceType = "c"}; var town = new PlaceName { PlaceType = "t" }; var other = new PlaceName { PlaceType = "o" }; Assert.IsTrue(city.PlaceTypeWeighting > town.PlaceTypeWeighting); Assert.IsTrue(town.PlaceTypeWeighting > other.PlaceTypeWeighting); }
private void IndexPlaceName(PlaceName placename, IndexWriter writer) { Document doc = new Document(); AddAnalysedField(doc, FieldNames.PlaceName, placename.Name.ToLower()); AddNameFormatted(placename.Name, doc); AddCounty(GetCounty(placename), doc); AddParentAreaCodes(placename.PostcodeParentAreas, doc); AddPlaceTypeWeighting(placename.PlaceTypeWeighting, doc); AddEastingAndNorthing(doc, placename.Easting, placename.Northing); writer.AddDocument(doc); }
private string GetCounty(PlaceName placeName) { return parentAreaCodeToName[placeName.PostcodeParentAreas.AreaCode102]; }