<commit_before>App.CwbSearchInputsController = Em.ArrayController.extend
  needs: ['corpus', 'searches']

  corpusBinding: 'controllers.corpus.content'

  currentInterface: null

  init: ->
    # Show the preferred interface (simple, multiword or regex) for this user or corpus
    @set('currentInterface', @get('controllers.corpus.preferredSearchInterfaceVariant'))
    @set('content', [{query: '', corpusShortName: 'BOKMAL', tags: @get('corpus.langs.firstObject.tags.options')}])

  isShowingSimple: (->
    @get('currentInterface') is 'simple'
  ).property('currentInterface').volatile()

  isShowingMultiword: (->
    @get('currentInterface') is 'multiword'
  ).property('currentInterface')

  isShowingRegex: (->
    @get('currentInterface') is 'regex'
  ).property('currentInterface')


  # Action handlers
  showSimple:    -> @set('currentInterface', 'simple')
  showMultiword: -> @set('currentInterface', 'multiword')
  showRegex:     -> @set('currentInterface', 'regex')


  search: (component, options = {}) ->
    options.queries = @get('content')
    @get('controllers.searches').createSearch('CwbSearch', options)
<commit_msg>Get the short name of the corpus from the Corpus model<commit_after>App.CwbSearchInputsController = Em.ArrayController.extend
  needs: ['corpus', 'searches']

  corpusBinding: 'controllers.corpus.content'

  currentInterface: null

  init: ->
    # Show the preferred interface (simple, multiword or regex) for this user or corpus
    @set('currentInterface', @get('controllers.corpus.preferredSearchInterfaceVariant'))
    @set 'content', [
      query: '',
      corpusShortName: @get('corpus.shortName')
      tags: @get('corpus.langs.firstObject.tags.options')
    ]

  isShowingSimple: (->
    @get('currentInterface') is 'simple'
  ).property('currentInterface').volatile()

  isShowingMultiword: (->
    @get('currentInterface') is 'multiword'
  ).property('currentInterface')

  isShowingRegex: (->
    @get('currentInterface') is 'regex'
  ).property('currentInterface')


  # Action handlers
  showSimple:    -> @set('currentInterface', 'simple')
  showMultiword: -> @set('currentInterface', 'multiword')
  showRegex:     -> @set('currentInterface', 'regex')


  search: (component, options = {}) ->
    options.queries = @get('content')
    @get('controllers.searches').createSearch('CwbSearch', options)

{'fraction_non_alphanumeric': 0.15668789808917197, 'fraction_numerical': 0.0, 'mean_word_length': 4.817283950617284, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '6990311', 'n_tokens_mistral': 721, 'n_tokens_neox': 695, 'n_words': 139}