 
 ht_query = (ht_id, level = 0) ->
   for table_id in HT_IA_TABLE_IDS
-    fusion_tables_query "SELECT ia_identifier,score FROM #{table_id} WHERE ht_identifier = #{fusion_tables_escape(ht_id)} ORDER BY score DESC",
+    fusion_tables_query "SELECT ia_identifier,score FROM #{table_id} WHERE ht_identifier = #{fusion_tables_escape(ht_id)}",
       (data) ->
         if data.rows?
           process_ia_id(row[0],(1 - level) * row[1]) for row in data.rows.reverse()

        dataType: 'json'
        crossDomain: true
        error: (jqXHR, textStatus, errorThrown) ->
          $('#results').append($('<div/>',{class: 'alert alert-danger', role: 'alert'}).text('Error in Fusion Tables AJAX call.'))
          console.log errorThrown
          console.log "AJAX Error: #{textStatus}"
          error_callback() if error_callback?

---
---

FUSION_TABLES_URI = 'https://www.googleapis.com/fusiontables/v2'

GOOGLE_BOOKS_API_KEY = 'AIzaSyDkGJOl5EEBahhn1J2kS70FmiRR2uwpFIY'
GOOGLE_API_KEY = 'AIzaSyBoQNYbbHb-MEGa4_oq83_JCLt9cKfd4vg'
# Fusion Tables IDs of the HT-IA indices output from merge-results.rb
HT_IA_TABLE_IDS = ['1Y5uDWMjUzrk6z_8l_C1NzLq9yUSpgS5n473N9dXL','1JNR9hJogOdwsYrNRH0Au_XlLELFViqVXhUg0pgBh']
# Fusion Tables ID of the IA-GB index output as ia-goog-index.csv
IA_GB_TABLE_ID = '1Tg0cm8gXBUwsBGx53GwGhHYiPpt_6YzG-HrR6Ywl'

