+ # Find relations with specified name/id.
+ # Returns array of relations, each in same form as getrelation.
+
+ def findrelations(searchterm)
+ rels = []
+ if searchterm.to_i>0 then
+ rel = Relation.find(searchterm.to_i)
+ if rel and rel.visible then
+ rels.push([rel.id, rel.tags, rel.members])
+ end
+ else
+ RelationTag.find(:all, :limit => 11, :conditions => ["match(v) against (?)", searchterm] ).each do |t|
+ if t.relation.visible then
+ rels.push([t.relation.id, t.relation.tags, t.relation.members])
+ end
+ end
+ end
+ rels
+ end
+