Index: doc/options.txt
===================================================================
--- doc/options.txt	(revision 4872)
+++ doc/options.txt	(working copy)
@@ -227,14 +227,11 @@
 :	Use this option if your style adds strings to the labels of roads which you
 want to see in the map but which should not appear in the result list
 of a road name / address search.
-When creating the index, words in the given list are removed from the end of road labels.
-Any word not found in the given list is considerered to be a valid label; words
-before the last valid label are not removed.
-If the label consists of a single word in the given list, or all the words in the
-label are contained in the given list, then the label is omitted from the index.
+When creating the index, words in the given list are searched in road labels.
+If any word is found then the label is omitted from the index.
 The comparison is case insensitive and words are separated by a space.
 :	Example: Assume your style adds surface attributes like 'pav.' or 'unp.' to a road
-label. You can use --mdr7-del="pav.,unp." to remove these suffixes from the index.
+label. You can use --mdr7-del="pav.,unp." to remove these labels from the index.
 
 ;--poi-excl-index=poi[-poi][,poi[-poi]...]
 :	By default, mkgmap indexes the following POI types with a non-empty label:
Index: resources/help/en/options
===================================================================
--- resources/help/en/options	(revision 4872)
+++ resources/help/en/options	(working copy)
@@ -226,14 +226,11 @@
     Use this option if your style adds strings to the labels of roads which you
     want to see in the map but which should not appear in the result list of a
     road name / address search. When creating the index, words in the given
-    list are removed from the end of road labels. Any word not found in the
-    given list is considerered to be a valid label; words before the last valid
-    label are not removed. If the label consists of a single word in the given
-    list, or all the words in the label are contained in the given list, then
-    the label is omitted from the index. The comparison is case insensitive and
-    words are separated by a space.
+    list are searched in road labels. If any word is found then the label is
+    omitted from the index. The comparison is case insensitive and words are
+    separated by a space.
     Example: Assume your style adds surface attributes like 'pav.' or 'unp.' to
-    a road label. You can use --mdr7-del="pav.,unp." to remove these suffixes
+    a road label. You can use --mdr7-del="pav.,unp." to remove these labels
     from the index.
 
 --poi-excl-index=poi[-poi][,poi[-poi]...]
Index: src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java
===================================================================
--- src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java	(revision 4872)
+++ src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java	(working copy)
@@ -239,40 +239,38 @@
 			if (lab == null)
 				break;
 
-			if (lab.getOffset() == 0)
-				continue;
-			
-			String name = lab.getText();
-			if (!mdr7Del.isEmpty()) {
-				String[] parts = name.split(" ");
-				int pos = parts.length;
-				for (int i = parts.length - 1; i >= 0; i--) {
-					if (!mdr7Del.contains(parts[i])) {
-						break;
+			String name = filterLabel(lab);
+			if (name != null) {
+				int strOff = createString(name);
+
+				// We sort on the dirty name (ie with the Garmin shield codes) although those codes do not
+				// affect the sort order. The string for mdr15 does not include the shield codes.
+				mdr7.addStreet(currentMap, name, lab.getOffset(), strOff, mdrCity);
+			}
+		}
+	}
+
+	private String filterLabel(Label lab) {
+		if (lab.getOffset() == 0)
+			return null;
+		
+		String name = lab.getText();
+		if (name == null || name.isEmpty())
+			return null;
+		if (!mdr7Del.isEmpty()) {
+			String[] parts = name.split(" ");
+			for (int i = parts.length - 1; i >= 0; i--) {
+				if (mdr7Del.contains(parts[i])) {
+					if (Logger.defaultLogger.isDebugEnabled()) {
+						Logger.defaultLogger.debug("label is ignored:", name);
 					}
-					pos = i;
+					return null;
 				}
-				if (pos == 0)
-					continue;
-				if (pos < parts.length) {
-					StringBuilder sb = new StringBuilder();
-					for (int i = 0; i + 1 < pos; i++) {
-						sb.append(parts[i]);
-						sb.append(" ");
-					}
-					sb.append(parts[pos - 1]);
-					name = sb.toString(); // XXX maybe add -intern()
-				}
 			}
-			
-			int strOff = createString(name);
-
-			// We sort on the dirty name (ie with the Garmin shield codes) although those codes do not
-			// affect the sort order. The string for mdr15 does not include the shield codes.
-			mdr7.addStreet(currentMap, name, lab.getOffset(), strOff, mdrCity);
 		}
+		return name;
 	}
-
+	
 	public void write() {
 		mdr15.release();
 		
Index: src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
===================================================================
--- src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java	(revision 4872)
+++ src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java	(working copy)
@@ -1882,6 +1882,8 @@
 		elementSetup(line, cw.getGType(), way);
 		line.setPoints(points);
 		MapRoad road = new MapRoad(nextRoadId++, way.getId(), line);
+		fixLabelForAddressSearch(road);
+
 		if (!routable) {
 			road.skipAddToNOD(true);
 		}
@@ -1993,6 +1995,47 @@
 	}
 
 	/**
+	 * Make sure that road has a label that matches the value from mkgmap:street. If
+	 * such a label is missing it is added. Without this the street/address search
+	 * doesn't work well.
+	 * 
+	 * @param road the road to fix
+	 */
+	private static void fixLabelForAddressSearch(MapRoad road) {
+		final String[] labels = road.getLabels();
+		final String street = road.getStreet();
+		if (street == null || street.isEmpty())
+			return;
+		for (String label : labels) {
+			if (label == null)
+				break;
+			if (street.equals(label))
+				return;
+		}
+		if (labels[0] == null) {
+			// add empty label so that the address search name doesn't appear in the map
+			// when the original road did not have any label
+			labels[0] = "";
+		}
+		for (int i = 1; i < labels.length; i++) {
+			if (labels[i] == null) {
+				labels[i] = street;
+				log.info("added label", street, "for", road, "Labels are now:", Arrays.toString(labels));
+				return;
+			}
+		}
+		int last = labels.length - 1;
+		String droppedLabel = labels[last];
+		labels[last] = street;
+		if (droppedLabel != null) {
+			if (log.isInfoEnabled())
+				log.info("dropped label", droppedLabel, "for", road,
+						"in preference to correct address search. Labels are now:", Arrays.toString(labels));
+		}
+	}
+
+
+	/**
 	 * split a Way at the specified point and return the new Way (the
 	 * original Way is truncated, both ways will contain the split point)
 	 * @param way the way to split
Index: src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberRoad.java
===================================================================
--- src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberRoad.java	(revision 4872)
+++ src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberRoad.java	(working copy)
@@ -521,37 +521,6 @@
 			return;
 		}
 		String[] labels = road.getLabels();
-		boolean found = false;
-		for (String label : labels){
-			if (label == null)
-				break;
-			if (streetName.equals(label))
-				found = true;
-		}
-		if (!found){
-			if (labels[0] == null){
-				// add empty label so that the address search name doesn't appear in the map
-				// when the original road did not have any label
-				labels[0] = "";
-			}
-			for (int i = 1; i < labels.length; i++){
-				if (labels[i] == null){
-					labels[i] = streetName;
-					log.info("added label",streetName,"for",road,"Labels are now:",Arrays.toString(labels));
-					found = true;
-					break;
-				}
-			}
-		}
-		if (!found){
-			int last = labels.length-1;
-			String droppedLabel = labels[last];
-			labels[last] = streetName;
-			if (droppedLabel != null){
-				if (log.isInfoEnabled())
-					log.info("dropped label",droppedLabel,"for",road,"in preference to correct address search. Labels are now:",Arrays.toString(labels));
-			}
-		}
 		
 		if (furtherNames != null){
 			boolean changed = false;
