SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
Solving The
                           Brooklyn Problem:
                           Better UX through cheap hacks




                           Kellan Elliott-McCrea, Etsy
                           @kellan




Thursday, April 21, 2011
Thursday, April 21, 2011
Thursday, April 21, 2011
Thursday, April 21, 2011
1. UI/UX can be improved by applying
     ambient location information




Thursday, April 21, 2011
1. UI/UX can be improved by applying
     ambient location information
     2. It’s easy.



Thursday, April 21, 2011
The Brooklyn Problem




Thursday, April 21, 2011
The Brooklyn Problem




             Brooklyn, New York Brooklyn, Alabama
Thursday, April 21, 2011
if ($query == ‘Brooklyn’) {
             return ‘Brooklyn, NY’;
            }




Thursday, April 21, 2011
Thursday, April 21, 2011
Thursday, April 21, 2011
Thursday, April 21, 2011
Thursday, April 21, 2011
Solr 3.10, Maxmind world populations dataset, bash,
                            and an “algorithm”




Thursday, April 21, 2011
Solr geo-spatial extension 3.10+

      schema.xml:
        <fieldType name="location" class="solr.LatLonType"
        subFieldSuffix="_coordinate"/>

        ....

        <field name="latlong" type="location" indexed="true" stored="true"
        required="true" />




Thursday, April 21, 2011
ALL THE CODE!


              <?php

                   $fh = fopen('worldcitiespop.txt', 'r');
                   $row = fgetcsv($fh); // discard headers
                   for($i=0;$i<100;$i++) {
                       $row = fgetcsv($fh);
                       $json = array('add'=> array('doc' =>
                           array(
                                'terms' => $row[2] . ' ' . $row[0], // city country
                                'population' => $row[4],
                                'latlong' => $row[5] . ',' . $row[6], // "latitude,longitude" gets parsed
                           )));
                           curl_post(json_encode($json));
                       }
                   }

                   function curl_post($json, $url='http://localhost:8983/solr/update/json') {
                       $ch = curl_init();
                       curl_setopt($ch, CURLOPT_HTTPHEADERS, array('Content-Type: application/json'));
                       curl_setopt($ch, CURLOPT_URL, $URL);
                   }
              ?>




Thursday, April 21, 2011
“a custom Solr scoring function to re-rank results
                        based on social geo-relevance”




Thursday, April 21, 2011
div(geodist(),sqrt(sum(population,1))




Thursday, April 21, 2011
http://localhost:8393/solr/
               placesuggest/select?
               q=b*&sfield=latlong&pt=37.7749295
               ,-122.4194155&sort=div(geodist
               (),sqrt(sum(population,1)))%20asc




Thursday, April 21, 2011
OM
           G
             CO
               NT
          http://localhost:8393/solr/
                  EX
                     TS
          placesuggest/select?
                   GE EN
          q=b*&sfield=latlong&pt=37.7749295
                      OC SIT
                        O D IV
          ,-122.4194155&sort=div(geodist
                           IN E PE
          (),sqrt(sum(population,1)))%20asc
                             G!     RS
                               !!!!   ON
                                        AL
                                          IZ
                                             ED


Thursday, April 21, 2011
Done!


Thursday, April 21, 2011
the tear down

   * Solr 3.10+ working geo-spatial extensions
   * 2.6 million points == 380Mb index
   * the data sucks, and it doesn’t matter (much)
   * a few days of work, 85% increase in data
   quality.




Thursday, April 21, 2011
.Wanjialing, China




Thursday, April 21, 2011
Brooklyn NY, population: 0




Thursday, April 21, 2011
So why aren’t people doing this?




Thursday, April 21, 2011
Thursday, April 21, 2011
Thursday, April 21, 2011
Thursday, April 21, 2011
Solr 3.10, Maxmind world populations dataset, bash,
                            and an “algorithm”




Thursday, April 21, 2011
Thank you!

                           http://www.etsy.com/listing/59401151/vintage-coffee-bean-bag-chairs
                           http://www.flickr.com/photos/darn/141009324/
                           http://www.flickr.com/photos/21953562@N07/5539813593/
                           http://www.maxmind.com/app/worldcities
                           http://www.lucidimagination.com/blog/2010/07/20/update-spatial-search-in-
                           apache-lucene-and-solr/
                           http://www.etsy.com/listing/66013923/triceratops-forged-copper-mask
Thursday, April 21, 2011

Weitere ähnliche Inhalte

Mehr von Kellan

More women in engineering: Something that ACTUALLY WORKED.
More women in engineering: Something that ACTUALLY WORKED.More women in engineering: Something that ACTUALLY WORKED.
More women in engineering: Something that ACTUALLY WORKED.Kellan
 
Optimizing for change: Taking risks safely & e-commerce
Optimizing for change: Taking risks safely & e-commerceOptimizing for change: Taking risks safely & e-commerce
Optimizing for change: Taking risks safely & e-commerceKellan
 
Optimizing for change: Taking risks safely & e-commerce
Optimizing for change: Taking risks safely & e-commerceOptimizing for change: Taking risks safely & e-commerce
Optimizing for change: Taking risks safely & e-commerceKellan
 
More women in engineering: Something that ACTUALLY WORKED.
More women in engineering: Something that ACTUALLY WORKED.More women in engineering: Something that ACTUALLY WORKED.
More women in engineering: Something that ACTUALLY WORKED.Kellan
 
Future of handmade
Future of handmadeFuture of handmade
Future of handmadeKellan
 
Architecting for Change: QCONNYC 2012
Architecting for Change: QCONNYC 2012Architecting for Change: QCONNYC 2012
Architecting for Change: QCONNYC 2012Kellan
 
Metrics driven engineering (velocity 2011)
Metrics driven engineering (velocity 2011)Metrics driven engineering (velocity 2011)
Metrics driven engineering (velocity 2011)Kellan
 
Engineering Change
Engineering ChangeEngineering Change
Engineering ChangeKellan
 
Social Software For Robots
Social Software For RobotsSocial Software For Robots
Social Software For RobotsKellan
 
Beyond REST? Building data services with XMPP
Beyond REST? Building data services with XMPPBeyond REST? Building data services with XMPP
Beyond REST? Building data services with XMPPKellan
 
Advanced OAuth Wrangling
Advanced OAuth WranglingAdvanced OAuth Wrangling
Advanced OAuth WranglingKellan
 
Casual Privacy (Ignite Web2.0 Expo)
Casual Privacy (Ignite Web2.0 Expo)Casual Privacy (Ignite Web2.0 Expo)
Casual Privacy (Ignite Web2.0 Expo)Kellan
 

Mehr von Kellan (12)

More women in engineering: Something that ACTUALLY WORKED.
More women in engineering: Something that ACTUALLY WORKED.More women in engineering: Something that ACTUALLY WORKED.
More women in engineering: Something that ACTUALLY WORKED.
 
Optimizing for change: Taking risks safely & e-commerce
Optimizing for change: Taking risks safely & e-commerceOptimizing for change: Taking risks safely & e-commerce
Optimizing for change: Taking risks safely & e-commerce
 
Optimizing for change: Taking risks safely & e-commerce
Optimizing for change: Taking risks safely & e-commerceOptimizing for change: Taking risks safely & e-commerce
Optimizing for change: Taking risks safely & e-commerce
 
More women in engineering: Something that ACTUALLY WORKED.
More women in engineering: Something that ACTUALLY WORKED.More women in engineering: Something that ACTUALLY WORKED.
More women in engineering: Something that ACTUALLY WORKED.
 
Future of handmade
Future of handmadeFuture of handmade
Future of handmade
 
Architecting for Change: QCONNYC 2012
Architecting for Change: QCONNYC 2012Architecting for Change: QCONNYC 2012
Architecting for Change: QCONNYC 2012
 
Metrics driven engineering (velocity 2011)
Metrics driven engineering (velocity 2011)Metrics driven engineering (velocity 2011)
Metrics driven engineering (velocity 2011)
 
Engineering Change
Engineering ChangeEngineering Change
Engineering Change
 
Social Software For Robots
Social Software For RobotsSocial Software For Robots
Social Software For Robots
 
Beyond REST? Building data services with XMPP
Beyond REST? Building data services with XMPPBeyond REST? Building data services with XMPP
Beyond REST? Building data services with XMPP
 
Advanced OAuth Wrangling
Advanced OAuth WranglingAdvanced OAuth Wrangling
Advanced OAuth Wrangling
 
Casual Privacy (Ignite Web2.0 Expo)
Casual Privacy (Ignite Web2.0 Expo)Casual Privacy (Ignite Web2.0 Expo)
Casual Privacy (Ignite Web2.0 Expo)
 

Solving the "Brooklyn Problem"

  • 1. Solving The Brooklyn Problem: Better UX through cheap hacks Kellan Elliott-McCrea, Etsy @kellan Thursday, April 21, 2011
  • 5. 1. UI/UX can be improved by applying ambient location information Thursday, April 21, 2011
  • 6. 1. UI/UX can be improved by applying ambient location information 2. It’s easy. Thursday, April 21, 2011
  • 8. The Brooklyn Problem Brooklyn, New York Brooklyn, Alabama Thursday, April 21, 2011
  • 9. if ($query == ‘Brooklyn’) { return ‘Brooklyn, NY’; } Thursday, April 21, 2011
  • 14. Solr 3.10, Maxmind world populations dataset, bash, and an “algorithm” Thursday, April 21, 2011
  • 15. Solr geo-spatial extension 3.10+ schema.xml: <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/> .... <field name="latlong" type="location" indexed="true" stored="true" required="true" /> Thursday, April 21, 2011
  • 16. ALL THE CODE! <?php $fh = fopen('worldcitiespop.txt', 'r'); $row = fgetcsv($fh); // discard headers for($i=0;$i<100;$i++) { $row = fgetcsv($fh); $json = array('add'=> array('doc' => array( 'terms' => $row[2] . ' ' . $row[0], // city country 'population' => $row[4], 'latlong' => $row[5] . ',' . $row[6], // "latitude,longitude" gets parsed ))); curl_post(json_encode($json)); } } function curl_post($json, $url='http://localhost:8983/solr/update/json') { $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADERS, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_URL, $URL); } ?> Thursday, April 21, 2011
  • 17. “a custom Solr scoring function to re-rank results based on social geo-relevance” Thursday, April 21, 2011
  • 19. http://localhost:8393/solr/ placesuggest/select? q=b*&sfield=latlong&pt=37.7749295 ,-122.4194155&sort=div(geodist (),sqrt(sum(population,1)))%20asc Thursday, April 21, 2011
  • 20. OM G CO NT http://localhost:8393/solr/ EX TS placesuggest/select? GE EN q=b*&sfield=latlong&pt=37.7749295 OC SIT O D IV ,-122.4194155&sort=div(geodist IN E PE (),sqrt(sum(population,1)))%20asc G! RS !!!! ON AL IZ ED Thursday, April 21, 2011
  • 22. the tear down * Solr 3.10+ working geo-spatial extensions * 2.6 million points == 380Mb index * the data sucks, and it doesn’t matter (much) * a few days of work, 85% increase in data quality. Thursday, April 21, 2011
  • 24. Brooklyn NY, population: 0 Thursday, April 21, 2011
  • 25. So why aren’t people doing this? Thursday, April 21, 2011
  • 29. Solr 3.10, Maxmind world populations dataset, bash, and an “algorithm” Thursday, April 21, 2011
  • 30. Thank you! http://www.etsy.com/listing/59401151/vintage-coffee-bean-bag-chairs http://www.flickr.com/photos/darn/141009324/ http://www.flickr.com/photos/21953562@N07/5539813593/ http://www.maxmind.com/app/worldcities http://www.lucidimagination.com/blog/2010/07/20/update-spatial-search-in- apache-lucene-and-solr/ http://www.etsy.com/listing/66013923/triceratops-forged-copper-mask Thursday, April 21, 2011