Skip to content

Instantly share code, notes, and snippets.

@hkrishna
Last active August 29, 2015 14:19
Show Gist options
  • Save hkrishna/fa0f3ae433fa143d3dc2 to your computer and use it in GitHub Desktop.
Save hkrishna/fa0f3ae433fa143d3dc2 to your computer and use it in GitHub Desktop.
[Pelias Regressions] Explanations for a few search queries

Regression Test cases Explained.

[Test Case 1] 3107 Hyde, Oakland

http://pelias.stage.mapzen.com/search?input=3107%20Hyde,%20Oakland

why are 3107 Longview/Hedgewood matching before 3107 Hyde Street?

These are the actual results from ES for the query -

{
   "took": 19,
   "timed_out": false,
   "_shards": {
      "total": 40,
      "successful": 40,
      "failed": 0
   },
   "hits": {
      "total": 17981,
      "max_score": 0.7705004,
      "hits": [
         {
            "_index": "pelias",
            "_type": "openaddresses",
            "_id": "507f2b14991344b9acc0f890d2556833",
            "_score": 0.7705004,
            "_source": {
               "name": {
                  "default": "3107 Longview Avenue"
               },
               "address": {
                  "number": "3107",
                  "street": "Longview Avenue"
               },
               "center_point": {
                  "lon": -83.098956,
                  "lat": 42.634721
               },
               "category": [],
               "alpha3": "USA",
               "admin1_abbr": "MI",
               "admin0": "United States",
               "admin1": "Michigan",
               "admin2": "Oakland County",
               "local_admin": "Rochester Hills",
               "locality": "Rochester Hills",
               "neighborhood": "Brookland",
               "suggest": {
                  "input": [
                     "3107 longview avenue"
                  ],
                  "output": "openaddresses:507f2b14991344b9acc0f890d2556833"
               }
            },
            "sort": [
               0.7705004,
               0,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "openaddresses",
            "_id": "7b7289379b3f4bffb7715c07261aeee4",
            "_score": 0.75886273,
            "_source": {
               "name": {
                  "default": "3107 Hedgewood Lane"
               },
               "address": {
                  "number": "3107",
                  "street": "Hedgewood Lane"
               },
               "center_point": {
                  "lon": -83.195448,
                  "lat": 42.648042
               },
               "category": [],
               "alpha3": "USA",
               "admin1_abbr": "MI",
               "admin0": "United States",
               "admin1": "Michigan",
               "admin2": "Oakland County",
               "local_admin": "Rochester Hills",
               "locality": "Rochester Hills",
               "neighborhood": "Auburn",
               "suggest": {
                  "input": [
                     "3107 hedgewood lane"
                  ],
                  "output": "openaddresses:7b7289379b3f4bffb7715c07261aeee4"
               }
            },
            "sort": [
               0.75886273,
               0,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "openaddresses",
            "_id": "d9d9f11baaf341679aa06d8d889b846b",
            "_score": 0.52572334,
            "_source": {
               "name": {
                  "default": "3107 Hyde Park Drive"
               },
               "address": {
                  "number": "3107",
                  "street": "Hyde Park Drive",
                  "zip": "33761"
               },
               "center_point": {
                  "lon": -82.722463,
                  "lat": 28.034052
               },
               "category": [],
               "alpha3": "USA",
               "admin1_abbr": "FL",
               "admin0": "United States",
               "admin1": "Florida",
               "admin2": "Pinellas County",
               "locality": "Clearwater",
               "neighborhood": "Westchester Lake",
               "suggest": {
                  "input": [
                     "3107 hyde park drive"
                  ],
                  "output": "openaddresses:d9d9f11baaf341679aa06d8d889b846b"
               }
            },
            "sort": [
               0.52572334,
               0,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "openaddresses",
            "_id": "094f4ca4b46d42a594f2060036e11b9c",
            "_score": 0.51931,
            "_source": {
               "name": {
                  "default": "3107 Hyde Street"
               },
               "address": {
                  "number": "3107",
                  "street": "Hyde Street",
                  "zip": "94601"
               },
               "center_point": {
                  "lon": -122.221472,
                  "lat": 37.788592
               },
               "category": [],
               "alpha3": "USA",
               "admin1_abbr": "CA",
               "admin0": "United States",
               "admin1": "California",
               "admin2": "Alameda County",
               "locality": "Oakland",
               "neighborhood": "Patten",
               "suggest": {
                  "input": [
                     "3107 hyde street"
                  ],
                  "output": "openaddresses:094f4ca4b46d42a594f2060036e11b9c"
               }
            },
            "sort": [
               0.51931,
               0,
               0,
               0
            ]
         }
      ]
   }
}

Notice how _score for the top two results are higher than the rest? This is because we match Oakland against admin0, admin1, admin_abbr, admin2 and alpha3 - and the first two results match Oakland County with admin2 - Now, for the desired result here, we should probably extend the query to match all admin fields including locality. There is an issue open for this already. :)


[Test Case 2] 318 19th Street

http://pelias.stage.mapzen.com/search?input=318%2019th%20street

why are 318 19th Street Northeast and 318 West 19th Street coming up before the 318 19th Street in Brooklyn?

{
   "took": 350,
   "timed_out": false,
   "_shards": {
      "total": 40,
      "successful": 40,
      "failed": 0
   },
   "hits": {
      "total": 12644271,
      "max_score": 6.681519,
      "hits": [
         {
            "_index": "pelias",
            "_type": "openaddresses",
            "_id": "2d57e52e5f04466797f6c97a81d54948",
            "_score": 6.681519,
            "_source": {
               "name": {
                  "default": "318 19th Street"
               },
               "address": {
                  "number": "318",
                  "street": "19th Street"
               },
               "center_point": {
                  "lon": -119.769046,
                  "lat": 39.531692
               },
               "category": [],
               "alpha3": "USA",
               "admin1_abbr": "NV",
               "admin0": "United States",
               "admin1": "Nevada",
               "admin2": "Washoe County",
               "locality": "Sparks",
               "neighborhood": "North Valley",
               "suggest": {
                  "input": [
                     "318 19th street"
                  ],
                  "output": "openaddresses:2d57e52e5f04466797f6c97a81d54948"
               }
            },
            "sort": [
               6.681519,
               6,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "osmaddress",
            "_id": "address-osmway-264629154",
            "_score": 6.681519,
            "_source": {
               "name": {
                  "default": "318 West 19th Street"
               },
               "address": {
                  "number": "318",
                  "zip": "10011",
                  "street": "West 19th Street"
               },
               "center_point": {
                  "lon": -74.001273,
                  "lat": 40.743087
               },
               "category": [],
               "alpha3": "USA",
               "admin0": "United States",
               "admin1": "New York",
               "admin1_abbr": "NY",
               "admin2": "New York County",
               "local_admin": "Manhattan",
               "locality": "New York",
               "neighborhood": "Chelsea",
               "suggest": {
                  "input": [
                     "318 west 19th street"
                  ],
                  "output": "osmaddress:address-osmway-264629154"
               }
            },
            "sort": [
               6.681519,
               6,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "openaddresses",
            "_id": "fbdae248a7ad4ea3a5d0eee83401a29c",
            "_score": 6.681519,
            "_source": {
               "name": {
                  "default": "318 19th Street Northeast"
               },
               "address": {
                  "number": "318",
                  "street": "19th Street Northeast",
                  "zip": "20002.0"
               },
               "center_point": {
                  "lon": -76.977469,
                  "lat": 38.893976
               },
               "category": [],
               "alpha3": "USA",
               "admin1_abbr": "DC",
               "admin0": "United States",
               "admin1": "District of Columbia",
               "admin2": "District of Columbia",
               "locality": "Washington",
               "neighborhood": "Isherwood",
               "suggest": {
                  "input": [
                     "318 19th street northeast"
                  ],
                  "output": "openaddresses:fbdae248a7ad4ea3a5d0eee83401a29c"
               }
            },
            "sort": [
               6.681519,
               6,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "openaddresses",
            "_id": "6ada1bee15074db2bf80466415d5b47b",
            "_score": 6.681519,
            "_source": {
               "name": {
                  "default": "318 19th Street"
               },
               "address": {
                  "number": "318",
                  "street": "19th Street",
                  "zip": "28083"
               },
               "center_point": {
                  "lon": -80.609203,
                  "lat": 35.52017
               },
               "category": [],
               "alpha3": "USA",
               "admin1_abbr": "NC",
               "admin0": "United States",
               "admin1": "North Carolina",
               "admin2": "Rowan County",
               "locality": "Kannapolis",
               "suggest": {
                  "input": [
                     "318 19th street"
                  ],
                  "output": "openaddresses:6ada1bee15074db2bf80466415d5b47b"
               }
            },
            "sort": [
               6.681519,
               6,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "osmaddress",
            "_id": "address-osmway-248170365",
            "_score": 6.681519,
            "_source": {
               "name": {
                  "default": "318 19th Street"
               },
               "address": {
                  "number": "318",
                  "zip": "11215",
                  "street": "19th Street"
               },
               "center_point": {
                  "lon": -73.989475,
                  "lat": 40.660571
               },
               "category": [],
               "alpha3": "USA",
               "admin0": "United States",
               "admin1": "New York",
               "admin1_abbr": "NY",
               "admin2": "Kings County",
               "local_admin": "Brooklyn",
               "locality": "New York",
               "neighborhood": "Windsor Teraace",
               "suggest": {
                  "input": [
                     "318 19th street"
                  ],
                  "output": "osmaddress:address-osmway-248170365"
               }
            },
            "sort": [
               6.681519,
               6,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "openaddresses",
            "_id": "9f61e0ed94a544948301c354d9765bb1",
            "_score": 6.681519,
            "_source": {
               "name": {
                  "default": "318 19th Street Northwest"
               },
               "address": {
                  "number": "318",
                  "street": "19th Street Northwest"
               },
               "center_point": {
                  "lon": -106.667399,
                  "lat": 35.09436
               },
               "category": [],
               "alpha3": "USA",
               "admin1_abbr": "NM",
               "admin0": "United States",
               "admin1": "New Mexico",
               "admin2": "Bernalillo County",
               "locality": "Albuquerque",
               "neighborhood": "Old Town",
               "suggest": {
                  "input": [
                     "318 19th street northwest"
                  ],
                  "output": "openaddresses:9f61e0ed94a544948301c354d9765bb1"
               }
            },
            "sort": [
               6.681519,
               6,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "openaddresses",
            "_id": "0c60ef99dc8e4a6c95bb6037fa77bed9",
            "_score": 6.681519,
            "_source": {
               "name": {
                  "default": "318 19th Street"
               },
               "address": {
                  "number": "318",
                  "street": "19th Street",
                  "zip": "44646"
               },
               "center_point": {
                  "lon": -81.499526,
                  "lat": 40.801296
               },
               "category": [],
               "alpha3": "USA",
               "admin1_abbr": "OH",
               "admin0": "United States",
               "admin1": "Ohio",
               "admin2": "Stark County",
               "local_admin": "Massillon",
               "locality": "Massillon",
               "suggest": {
                  "input": [
                     "318 19th street"
                  ],
                  "output": "openaddresses:0c60ef99dc8e4a6c95bb6037fa77bed9"
               }
            },
            "sort": [
               6.681519,
               6,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "osmaddress",
            "_id": "address-osmway-220815413",
            "_score": 6.681519,
            "_source": {
               "name": {
                  "default": "318 East 19th Street"
               },
               "address": {
                  "number": "318",
                  "street": "East 19th Street"
               },
               "center_point": {
                  "lon": -95.231862,
                  "lat": 38.950299
               },
               "category": [],
               "alpha3": "USA",
               "admin0": "United States",
               "admin1": "Kansas",
               "admin1_abbr": "KS",
               "admin2": "Douglas County",
               "local_admin": "Lawrence",
               "locality": "Lawrence",
               "suggest": {
                  "input": [
                     "318 east 19th street"
                  ],
                  "output": "osmaddress:address-osmway-220815413"
               }
            },
            "sort": [
               6.681519,
               6,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "openaddresses",
            "_id": "18cf6b54d9284806b132711f6cf931de",
            "_score": 6.681519,
            "_source": {
               "name": {
                  "default": "318 North 19th Street"
               },
               "address": {
                  "number": "318",
                  "street": "North 19th Street",
                  "zip": "72901"
               },
               "center_point": {
                  "lon": -94.410452,
                  "lat": 35.382084
               },
               "category": [],
               "alpha3": "USA",
               "admin1_abbr": "AR",
               "admin0": "United States",
               "admin1": "Arkansas",
               "admin2": "Sebastian County",
               "locality": "Fort Smith",
               "suggest": {
                  "input": [
                     "318 north 19th street"
                  ],
                  "output": "openaddresses:18cf6b54d9284806b132711f6cf931de"
               }
            },
            "sort": [
               6.681519,
               6,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "openaddresses",
            "_id": "fe3d6ccbdf9a4a848e691a2e9c8968b1",
            "_score": 6.681519,
            "_source": {
               "name": {
                  "default": "318 South 19th Street"
               },
               "address": {
                  "number": "318",
                  "street": "South 19th Street",
                  "zip": "72301"
               },
               "center_point": {
                  "lon": -90.161502,
                  "lat": 35.142549
               },
               "category": [],
               "alpha3": "USA",
               "admin1_abbr": "AR",
               "admin0": "United States",
               "admin1": "Arkansas",
               "admin2": "Crittenden County",
               "locality": "West Memphis",
               "suggest": {
                  "input": [
                     "318 south 19th street"
                  ],
                  "output": "openaddresses:fe3d6ccbdf9a4a848e691a2e9c8968b1"
               }
            },
            "sort": [
               6.681519,
               6,
               0,
               0
            ]
         }
      ]
   }
}

As you can see, all the above results are tied perfectly and since we dont have a popularity boost in place for admin values - brooklyn, New York doesnt get to the top or beat Sparks, Nevada


[Test Case 3] 568 Broadway New York

http://pelias.stage.mapzen.com/search?input=568%20Broadway%20New%20York

so, New York can't be identified as an admin-value here. Just curious, have you thought about any ways to solve this?

This will be solved with the address parser in place.


[Test Case 4] 479 grand st

http://pelias.mapzen.com/search?input=479%20grand%20st

this would be solved by synonym expansion in address parsing, right?

Right.


[Test Case 5] 1710 Drew, Houston

Yes, we are just getting lucky with the order here. As you can see the top two results are tied with a _score of 0.4362831

{
   "took": 10,
   "timed_out": false,
   "_shards": {
      "total": 40,
      "successful": 40,
      "failed": 0
   },
   "hits": {
      "total": 21431,
      "max_score": 0.4362831,
      "hits": [
         {
            "_index": "pelias",
            "_type": "openaddresses",
            "_id": "3ce4d4a419474830b90cfca971770519",
            "_score": 0.4362831,
            "_source": {
               "name": {
                  "default": "1710 Drew Street"
               },
               "address": {
                  "number": "1710",
                  "street": "Drew Street"
               },
               "center_point": {
                  "lon": -95.368726,
                  "lat": 29.740123
               },
               "category": [],
               "alpha3": "USA",
               "admin1_abbr": "TX",
               "admin0": "United States",
               "admin1": "Texas",
               "admin2": "Harris County",
               "locality": "Houston",
               "neighborhood": "Midtown",
               "suggest": {
                  "input": [
                     "1710 drew street"
                  ],
                  "output": "openaddresses:3ce4d4a419474830b90cfca971770519"
               }
            },
            "sort": [
               0.4362831,
               0,
               0,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "openaddresses",
            "_id": "7d3bd301e1bf4b1697e30c852ef97692",
            "_score": 0.4362831,
            "_source": {
               "name": {
                  "default": "1710 Drew Place"
               },
               "address": {
                  "number": "1710",
                  "street": "Drew Place",
                  "zip": "91711"
               },
               "center_point": {
                  "lon": -117.740736,
                  "lat": 34.115042
               },
               "category": [],
               "alpha3": "USA",
               "admin1_abbr": "CA",
               "admin0": "United States",
               "admin1": "California",
               "admin2": "Los Angeles County",
               "locality": "Claremont",
               "neighborhood": "Foothill Corridor",
               "suggest": {
                  "input": [
                     "1710 drew place"
                  ],
                  "output": "openaddresses:7d3bd301e1bf4b1697e30c852ef97692"
               }
            },
            "sort": [
               0.4362831,
               0,
               0,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "geoname",
            "_id": "4424689",
            "_score": 0.23698127,
            "_source": {
               "name": {
                  "default": "Drew"
               },
               "address": {},
               "center_point": {
                  "lon": -90.52648,
                  "lat": 33.80956
               },
               "category": [],
               "alpha3": "USA",
               "admin0": "United States",
               "admin1": "Mississippi",
               "admin2": "Sunflower County",
               "population": 1927,
               "suggest": {
                  "input": [
                     "drew"
                  ],
                  "output": "geoname:4424689",
                  "weight": 8
               },
               "admin1_abbr": "MS",
               "locality": "Drew"
            },
            "sort": [
               0.23698127,
               0,
               3.285107029566812,
               0,
               0
            ]
         },
         {
            "_index": "pelias",
            "_type": "local_admin",
            "_id": "86852:localadmin:us:usa:drew",
            "_score": 0.23698127,
            "_source": {
               "center_point": {
                  "lon": "-68.100354",
                  "lat": "45.586323"
               },
               "woe_id": null,
               "admin1_abbr": "ME",
               "name": {
                  "default": "Drew"
               },
               "admin1": "Maine",
               "alpha3": "USA",
               "admin2": "Penobscot County",
               "admin0": "United States",
               "suggest": {
                  "output": "local_admin:86852:localadmin:us:usa:drew",
                  "input": [
                     "drew"
                  ],
                  "weight": 12
               },
               "gn_id": null
            },
            "sort": [
               0.23698127,
               0,
               0,
               0,
               12
            ]
         }
      ]
   }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment