2012-03-06 5 views
1

私は会場を検索して複写所を返しました。重複会場は、会場IDと緯度/経度情報を除いて同一でした。 foursquare.comで同じ検索を行い、複製は表示されません。複製をどのように除外できますか?ここで会場検索apiが間違った緯度/経度の重複会場を返す

APIコール(マイナス秘密)されています https://api.foursquare.com/v2/venues/search?ll=38.468807,-77.372589&query=starbucks

結果:

{ 
    meta: { 
     code: 200 
    } 
    notifications: [ 
    { 
     type: "notificationTray" 
     item: { 
      unreadCount: 0 
     } 
    }] 
    response: { 
     venues: [ 
     { 
      id: "4e4dc886bd41b76bef93082e" 
      name: "Starbucks Coffee" 
      contact: { 
       phone: "5407209145" 
       formattedPhone: "(540) 720-9145" 
      } 
      location: { 
       address: "1495 Stafford Market Pl" 
       lat: 38.47310969662029 
       lng: -77.38591645407749 
       distance: 1256 
       postalCode: "22556" 
       city: "Stafford" 
       state: "VA" 
       country: "United States" 
      } 
      categories: [ 
      { 
       id: "4bf58dd8d48988d1e0931735" 
       name: "Coffee Shop" 
       pluralName: "Coffee Shops" 
       shortName: "Coffee Shop" 
       icon: { 
        prefix: "https://foursquare.com/img/categories/food/coffeeshop_" 
        sizes: [ 32 44 64 88 256 ] 
        name: ".png" 
       } 
       primary: true 
      }] 
      verified: false 
      stats: { 
       checkinsCount: 13 
       usersCount: 11 
       tipCount: 0 
      } 
      specials: { 
       count: 0 
       items: [ ] 
      } 
      hereNow: { 
       count: 0 
      } 
     }, 
     { 
      id: "4b8dd66ef964a520071033e3" 
      name: "Starbucks" 
      contact: { 
       phone: "5407209145" 
       formattedPhone: "(540) 720-9145" 
      } 
      location: { 
       address: "1495 Stafford Market Place" 
       crossStreet: "Garrisonville Road" 
       lat: 38.470214117289444 
       lng: -77.41142749786377 
       distance: 3388 
       postalCode: "22554" 
       city: "Stafford" 
       state: "VA" 
       country: "United States" 
      } 
      categories: [ 
      { 
       id: "4bf58dd8d48988d1e0931735" 
       name: "Coffee Shop" 
       pluralName: "Coffee Shops" 
       shortName: "Coffee Shop" 
       icon: { 
        prefix: "https://foursquare.com/img/categories/food/coffeeshop_" 
        sizes: [ 32 44 64 88 256 ] 
        name: ".png" 
       } 
       primary: true 
      }] 
      verified: true 
      stats: { 
       checkinsCount: 1885 
       usersCount: 522 
       tipCount: 14 
      } 
      url: "http://www.starbucks.com/" 
      specials: { 
       count: 0 
       items: [ ] 
      } 
      hereNow: { 
       count: 0 
      } 
      menu: { 
       url: "https://foursquare.com/v/starbucks/4b8dd66ef964a520071033e3/menu" 
       mobileUrl: "https://foursquare.com/v/4b8dd66ef964a520071033e3/device_menu" 
      } 
     }, 
     { 
      id: "4d87c7bba98841bd5eaf3055" 
      name: "Starbucks" 
      contact: { 
       phone: "5407209145" 
       formattedPhone: "(540) 720-9145" 
       twitter: "starbucks" 
      } 
      location: { 
       address: "1495 Stafford Market Place" 
       lat: 38.50188672 
       lng: -77.37500964 
       distance: 3688 
       postalCode: "22556" 
       city: "Stafford" 
       state: "Virginia" 
       country: "United States" 
      } 
      categories: [ ] 
      verified: true 
      stats: { 
       checkinsCount: 17 
       usersCount: 11 
       tipCount: 0 
      } 
      specials: { 
       count: 0 
       items: [ ] 
      } 
      hereNow: { 
       count: 0 
      } 
     } 
    } 
} 

第二会場、ID = 4b8dd66ef964a520071033e3は、実際のです。他の2つは重複しています。

+0

あなたは、実際のAPIコール(マイナス秘密)と結果を提供することができますか?詳細な説明なしにデバッグを手助けすることは不可能です。 – akdotcom

答えて

2

キー/値 "verified:false"があるため、最初の結果を除外します。 検証済み:所有者が所有者を主張したことを意味します。

したがって、2番目の結果は3番目の結果より優れていることに注意してください。 1.カテゴリは です。2. checkinsCountが高いです。この場合、はるかに高い。 3.それはメニューが 5.「コンパクト会場」の結果の完全性をランク付けするためのアルゴリズムを作成した場合場所は、基本的にクロスストリート

を持っているリンクがあるウェブサイトのリンク(URL) 4を有します。 Foursquare.comの一意性に近づけることができます。私は存在するさまざまな属性のすべてを合計し、検証された属性、チェックインの数とヒント(人々がその会場を使用しているかどうかを示す)に余分な重みを与えます。私はおそらく名前として、通りの住所とおそらく電話番号をキーとして使用します。郵便番号はそれも使いやすいものだと思われますが、この場合、正規のものでなければならない結果には間違っていることがわかります。私はこれに答えるために使用

良い参考ドキュメントは、次のとおりです。https://developer.foursquare.com/docs/responses/venue

+0

私の要求で何かが恋しくなることを望んでいたが、これは最善のルートのように聞こえる。ありがとう。 – scott4arrows

関連する問題