Solving the "Brooklyn Problem"

Post on 14-Jan-2015

7.049 views 1 download

Tags:

description

Better UX through cheap hacks

Transcript of Solving the "Brooklyn Problem"

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 information2. It’s easy.

Thursday, April 21, 2011

The Brooklyn Problem

Thursday, April 21, 2011

Brooklyn, New York Brooklyn, Alabama

The Brooklyn Problem

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

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

....

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

schema.xml:

Solr geo-spatial extension 3.10+

Thursday, April 21, 2011

<?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); }?>

ALL THE CODE!

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

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

OMG CONTEXT SENSITIVE PERSONALIZED

GEOCODING!!!!!

Thursday, April 21, 2011

Done!

Thursday, April 21, 2011

* 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.

the tear down

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