<commit_before>Species.ElibrarySearchController = Ember.Controller.extend Species.Spinner,
  Species.SearchContext,
  Species.TaxonConceptAutoCompleteLookup,
  Species.GeoEntityAutoCompleteLookup,
  Species.EventLookup,
  Species.DocumentTagLookup,
  Species.SignedInStatus,
  needs: ['documentGeoEntities', 'taxonConcepts', 'events', 'documentTags']
  geoEntities: Ember.computed.alias("controllers.documentGeoEntities")
  searchContext: 'documents'
  autoCompleteTaxonConcept: null
  selectedEventType: null
  selectedGeneralSubType: null
  locationsDropdownVisible: true
  keywordSearchVisible: true

  setFilters: (filtersHash) ->
    if filtersHash.taxon_concept_query == ''
      filtersHash.taxon_concept_query = null
    @set('taxonConceptQueryForDisplay', filtersHash.taxon_concept_query)
    @set('taxonConceptQuery', filtersHash.taxon_concept_query)
    @set('selectedGeoEntitiesIds', filtersHash.geo_entities_ids || [])
    if filtersHash.title_query == ''
      filtersHash.title_query = null
    @set('titleQuery', filtersHash.title_query)

    allEventTypes = @get('controllers.events.eventTypes')
    allEventTypes.push(@get('controllers.events.idMaterialsEvent')) 

    @set('selectedEventType', allEventTypes.findBy('id', filtersHash.event_type))
    @set('selectedEventsIds', filtersHash.events_ids || [])

    allDocumentTypes = @get('controllers.events.documentTypes')
      .concat @get('controllers.events.interSessionalDocumentTypes')
      .concat @get('controllers.events.identificationDocumentTypes')
    
    @set('selectedDocumentType', allDocumentTypes.findBy('id', filtersHash.document_type))
    @set('selectedDocumentType', allDocumentTypes.findBy('id', filtersHash.document_type))

    @set('selectedGeneralSubType', 
      @get('controllers.events.generalSubTypes')
        .findBy('id', if filtersHash.general_subtype == 'true' then 'general' else 'parts'))

    @set('selectedReviewPhaseId', filtersHash.review_phase_id)

  getFilters: ->
    if @get('taxonConceptQueryForDisplay') && @get('taxonConceptQueryForDisplay').length > 0
      taxonConceptQuery = @get('taxonConceptQueryForDisplay')<commit_msg>fix error when setting general subtype filter<commit_after>Species.ElibrarySearchController = Ember.Controller.extend Species.Spinner,
  Species.SearchContext,
  Species.TaxonConceptAutoCompleteLookup,
  Species.GeoEntityAutoCompleteLookup,
  Species.EventLookup,
  Species.DocumentTagLookup,
  Species.SignedInStatus,
  needs: ['documentGeoEntities', 'taxonConcepts', 'events', 'documentTags']
  geoEntities: Ember.computed.alias("controllers.documentGeoEntities")
  searchContext: 'documents'
  autoCompleteTaxonConcept: null
  selectedEventType: null
  selectedGeneralSubType: null
  locationsDropdownVisible: true
  keywordSearchVisible: true

  setFilters: (filtersHash) ->
    if filtersHash.taxon_concept_query == ''
      filtersHash.taxon_concept_query = null
    @set('taxonConceptQueryForDisplay', filtersHash.taxon_concept_query)
    @set('taxonConceptQuery', filtersHash.taxon_concept_query)
    @set('selectedGeoEntitiesIds', filtersHash.geo_entities_ids || [])
    if filtersHash.title_query == ''
      filtersHash.title_query = null
    @set('titleQuery', filtersHash.title_query)

    allEventTypes = @get('controllers.events.eventTypes')
    allEventTypes.push(@get('controllers.events.idMaterialsEvent')) 

    @set('selectedEventType', allEventTypes.findBy('id', filtersHash.event_type))
    @set('selectedEventsIds', filtersHash.events_ids || [])

    allDocumentTypes = @get('controllers.events.documentTypes')
      .concat @get('controllers.events.interSessionalDocumentTypes')
      .concat @get('controllers.events.identificationDocumentTypes')
    
    @set('selectedDocumentType', allDocumentTypes.findBy('id', filtersHash.document_type))
    @set('selectedDocumentType', allDocumentTypes.findBy('id', filtersHash.document_type))
   
    general_subtype_type = @get_general_subtype_type(filtersHash)
    @set('selectedGeneralSubType', general_subtype_type)

    @set('selectedReviewPhaseId', filtersHash.review_phase_id)

  get_general_subtype_type: (filtersHash) ->
    if filtersHash.general_subtype == 'true' 
      general_subtype_id = 'general'
    else if filtersHash.general_subtype == 'false'
      general_subtype_id = 'parts'

    if general_subtype_id
      return @get('controllers.events.generalSubTypes')
        .findBy('id', general_subtype_id)
    
    return null

  getFilters: ->
    if @get('taxonConceptQueryForDisplay') && @get('taxonConceptQueryForDisplay').length > 0
      taxonConceptQuery = @get('taxonConceptQueryForDisplay')
{'fraction_non_alphanumeric': 0.11243243243243244, 'fraction_numerical': 0.00043243243243243243, 'mean_word_length': 5.753284671532847, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '3112810', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1379, 'n_words': 190}