Index: trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 8883)
+++ trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 8884)
@@ -419,7 +419,9 @@
                 .addKeyword("child <i>expr</i>", "child ", tr("all children of objects matching the expression"), "child building")
                 .addKeyword("parent <i>expr</i>", "parent ", tr("all parents of objects matching the expression"), "parent bus_stop")
-                .addKeyword("nth:<i>7</i>", "nth: ",
+                .addKeyword("hasRole:<i>stop</i>", "hasRole:", tr("relation containing a member of role <i>stop</i>"))
+                .addKeyword("isRole:<i>stop</i>", "isRole:", tr("objects being part of a relation as role <i>stop</i>"))
+                .addKeyword("nth:<i>7</i>", "nth:",
                         tr("n-th member of relation and/or n-th node of way"), "nth:5 (child type:relation)", "nth:-1")
-                .addKeyword("nth%:<i>7</i>", "nth%: ",
+                .addKeyword("nth%:<i>7</i>", "nth%:",
                         tr("every n-th member of relation and/or every n-th node of way"), "nth%:100 (child waterway)"),
                 GBC.eol());
Index: trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java	(revision 8883)
+++ trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java	(revision 8884)
@@ -109,5 +109,5 @@
                 "changeset", "nodes", "ways", "tags", "areasize", "waylength", "modified", "selected",
                 "incomplete", "untagged", "closed", "new", "indownloadedarea",
-                "allindownloadedarea", "inview", "allinview", "timestamp", "nth", "nth%");
+                "allindownloadedarea", "inview", "allinview", "timestamp", "nth", "nth%", "hasRole", "isRole");
 
         @Override
@@ -157,4 +157,8 @@
                     case "nth%":
                         return new Nth(tokenizer, true);
+                    case "hasRole":
+                        return new HasRole(tokenizer);
+                    case "isRole":
+                        return new IsRole(tokenizer);
                     case "timestamp":
                         // add leading/trailing space in order to get expected split (e.g. "a--" => {"a", ""})
@@ -1124,4 +1128,46 @@
         protected String getString() {
             return "timestamp";
+        }
+    }
+
+    /**
+     * Matches relations with a member of the given role
+     */
+    private static class HasRole extends Match {
+        private final String role;
+
+        HasRole(PushbackTokenizer tokenizer) {
+            role = tokenizer.readTextOrNumber();
+        }
+
+        @Override
+        public boolean match(OsmPrimitive osm) {
+            return osm instanceof Relation && ((Relation) osm).getMemberRoles().contains(role);
+        }
+    }
+
+    /**
+     * Matches object which are part of a relation with the given role
+     */
+    private static class IsRole extends Match {
+        private final String role;
+
+        IsRole(PushbackTokenizer tokenizer) {
+            role = tokenizer.readTextOrNumber();
+        }
+
+        @Override
+        public boolean match(final OsmPrimitive osm) {
+            for (final OsmPrimitive ref : osm.getReferrers()) {
+                if (ref instanceof Relation && Utils.exists(((Relation) ref).getMembers(), new Predicate<RelationMember>() {
+                    @Override
+                    public boolean evaluate(RelationMember object) {
+                        return osm.equals(object.getMember()) && role.equals(object.getRole());
+                    }
+                })) {
+                    return true;
+                }
+            }
+            return false;
         }
     }
