<commit_before>//= require typeahead-0.9.3/typeahead

do ($=jQuery, searchModel = window.edsc.models.searchModel) ->

  $(document).ready ->
    $placenameInputs = $('.autocomplete-placenames')

    $placenameInputs.typeahead
      name: 'keywords'
      remote: '/placenames?q=%QUERY'

    # When the user selects a typeahead value,
    $placenameInputs.on 'typeahead:selected typeahead:autocompleted', (event, datum) ->
      {placename, ref, value} = datum
      searchModel.query.keywords(value)

      $.getJSON "/placenames/#{ref}", (data) -><commit_msg>Preliminary fix to typeahead issues when user presses arrow key<commit_after>//= require typeahead-0.9.3/typeahead

do ($=jQuery, searchModel = window.edsc.models.searchModel) ->

  $(document).ready ->
    $placenameInputs = $('.autocomplete-placenames')

    $placenameInputs.typeahead
      name: 'keywords'
      remote: '/placenames?q=%QUERY'

    # When the user selects a typeahead value,
    # TODO: Upgrade to typeahead-0.10 when available and verify that typeahead:cursorchanged triggers with arrow keys
    $placenameInputs.on 'typeahead:selected typeahead:autocompleted typeahead:cursorchanged', (event, datum) ->
      {placename, ref, value} = datum
      searchModel.query.keywords(value)

      $.getJSON "/placenames/#{ref}", (data) ->
{'fraction_non_alphanumeric': 0.13414634146341464, 'fraction_numerical': 0.006859756097560976, 'mean_word_length': 3.862962962962963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2647354', 'n_tokens_mistral': 432, 'n_tokens_neox': 400, 'n_words': 94}