The results are returned in gnutella messages. Each message can carry up to 10 results, and each result has an xml fragment associated with it. More info is available at the wiki:
http://www.the-gdf.org
You can certainly extend that xml to carry some directory information. IIRC Gregorio had such patch submitted some time ago.