<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -4,7 +4,7 @@
         &lt;author&gt;Balaji Narayanan&lt;/author&gt;
         &lt;author&gt;Tom Hughes-Croucher&lt;/author&gt;
         &lt;description&gt;Placemaker&lt;/description&gt;
-        &lt;sampleQuery&gt;select * from {table} where documentContent=&quot;I+live+in+Sunnyvale,+CA&quot; and documentType=&quot;text/plain&quot;&lt;/sampleQuery&gt;
+        &lt;sampleQuery&gt;SELECT * FROM {table} WHERE documentContent = &quot;They followed him to deepest Africa and found him there, in Timbuktu&quot; AND documentType=&quot;text/plain&quot; AND appid = &quot;&quot;&lt;/sampleQuery&gt;
         &lt;documentationURL&gt;http://developer.yahoo.com/geo/placemaker/&lt;/documentationURL&gt;
     &lt;/meta&gt;
     &lt;bindings&gt;
@@ -24,6 +24,7 @@
             &lt;/inputs&gt;
             &lt;execute&gt;
             &lt;![CDATA[
+            
             content = &quot;documentURL=&quot; + documentURL + &quot;&amp;documentType=&quot; + documentType + &quot;&amp;appid=&quot; + appid;
     	    if (documentTitle) { content += &quot;&amp;documentTitle=&quot; + documentTitle; }
     	    if (inputLanguage) { content += &quot;&amp;inputLanguage=&quot; + inputLanguage; }
@@ -32,31 +33,44 @@
             
             postResponse = request.accept(&quot;application/xml&quot;).contentType(&quot;application/x-www-form-urlencoded&quot;).post(content).response;    
             
-            default xml namespace = &quot;http://wherein.yahooapis.com/v1/schema&quot;;
-            
-            places = Array();
-            for each (var place in postResponse.document.placeDetails.place) {
-                places.push(place);
-            }
-            
-            references = Array();
-            for each (var reference in postResponse.document.referenceList.reference) {
-                references.push(reference);
-            }
-            
-            default xml namespace = &quot;&quot;;
+            if (postResponse != null) {
+
+                default xml namespace = &quot;http://wherein.yahooapis.com/v1/schema&quot;;
+                
+                matches = Array();
+                
+                for each (var place in postResponse.document.placeDetails.place) {
+                    if (matches[place.woeId]) {
+                        matches[place.woeId].place = place;
+                    } else {
+                        matches[place.woeId] = Array();
+                        matches[place.woeId].place = place;
+                    }
+                }
+                for each (var reference in postResponse.document.referenceList.reference) {
+                    if (matches[reference.woeIds]) {
+                        matches[reference.woeIds].reference = reference;
+                    } else {
+                        matches[reference.woeIds] = Array();
+                        matches[reference.woeIds].reference = reference;
+                    }
+                }
+                default xml namespace = &quot;&quot;;
             
-            var output = &lt;matches&gt;&lt;/matches&gt;;
+                var output = &lt;matches&gt;&lt;/matches&gt;;
 
-            for(var i=0;i&lt;places.length;i++) {
-                match = &lt;match&gt;&lt;/match&gt;;
-                match.node += places[i];
-                match.node += references[i];
+                for each (var match in matches) {
+                    var matchXML = &lt;match&gt;&lt;/match&gt;;
+                    matchXML.node += match.place;
+                    matchXML.node += match.reference;
                 
-                output.node += match;
+                    output.node += matchXML;
+                }
+
+                response.object = output;
+            
             }
 
-            response.object = output;
             ]]&gt;
             &lt;/execute&gt;
         &lt;/select&gt; 
@@ -76,36 +90,52 @@
 	    &lt;/inputs&gt;
             &lt;execute&gt;
             &lt;![CDATA[
+            
             content = &quot;documentContent=&quot; + documentContent + &quot;&amp;documentType=&quot; + documentType + &quot;&amp;appid=&quot; + appid;
             if (documentTitle) { content += &quot;&amp;documentTitle=&quot; + documentTitle; }
     	    if (inputLanguage) { content += &quot;&amp;inputLanguage=&quot; + inputLanguage; }
     	    if (autoDisambiguate) { content += &quot;&amp;autoDisambiguate=&quot; + autoDisambiguate; }
     	    if (focusWoeid) { content += &quot;&amp;focusWoeid=&quot; + focusWoeid; }
-
+            
             postResponse = request.accept(&quot;application/xml&quot;).contentType(&quot;application/x-www-form-urlencoded&quot;).post(content).response;    
             
-            default xml namespace = &quot;http://wherein.yahooapis.com/v1/schema&quot;;
-            places = Array();
-            for each (var place in postResponse.document.placeDetails.place) {
-                places.push(place);
-            }
-            references = Array();
-            for each (var reference in postResponse.document.referenceList.reference) {
-                references.push(reference);
-            }
-            default xml namespace = &quot;&quot;;
+            if (postResponse != null) {
+
+                default xml namespace = &quot;http://wherein.yahooapis.com/v1/schema&quot;;
+                
+                matches = Array();
+                
+                for each (var place in postResponse.document.placeDetails.place) {
+                    if (matches[place.woeId]) {
+                        matches[place.woeId].place = place;
+                    } else {
+                        matches[place.woeId] = Array();
+                        matches[place.woeId].place = place;
+                    }
+                }
+                for each (var reference in postResponse.document.referenceList.reference) {
+                    if (matches[reference.woeIds]) {
+                        matches[reference.woeIds].reference = reference;
+                    } else {
+                        matches[reference.woeIds] = Array();
+                        matches[reference.woeIds].reference = reference;
+                    }
+                }
+                default xml namespace = &quot;&quot;;
             
-            var output = &lt;matches&gt;&lt;/matches&gt;;
+                var output = &lt;matches&gt;&lt;/matches&gt;;
 
-            for(var i=0;i&lt;places.length;i++) {
-                match = &lt;match&gt;&lt;/match&gt;;
-                match.node += places[i];
-                match.node += references[i];
+                for each (var match in matches) {
+                    var matchXML = &lt;match&gt;&lt;/match&gt;;
+                    matchXML.node += match.place;
+                    matchXML.node += match.reference;
                 
-                output.node += match;
-            }
+                    output.node += matchXML;
+                }
 
-            response.object = output;
+                response.object = output;
+            
+            }
             ]]&gt;
             &lt;/execute&gt;
         &lt;/select&gt; </diff>
      <filename>geo/geo.placemaker.xml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>84aa5dd7681daa61d535de9343a649daa413c1af</id>
    </parent>
  </parents>
  <author>
    <name>Tom Hughes-Croucher</name>
    <email>tom_croucher@yahoo.com</email>
  </author>
  <url>http://github.com/spullara/yql-tables/commit/3eb98adb133edf98d09743fed7ea82dd5e0bff51</url>
  <id>3eb98adb133edf98d09743fed7ea82dd5e0bff51</id>
  <committed-date>2009-05-22T00:00:47-07:00</committed-date>
  <authored-date>2009-05-21T16:16:22-07:00</authored-date>
  <message>fixing exceptions when url doesn't parse; fixed misaligned places and references

Signed-off-by: Sam Pullara &lt;spullara@yahoo.com&gt;</message>
  <tree>5ad1edb38fce4dd4ad268f503452aa01c9de61e9</tree>
  <committer>
    <name>Sam Pullara</name>
    <email>spullara@yahoo.com</email>
  </committer>
</commit>
