<commit_before>import Ember from 'ember';
import KeyboardMixin from 'ember-keyboard-service/mixins/keyboard';

function keywordMatches(keyword='', query='') {
  let normalizedQuery = query.toLowerCase().replace(/\W*/, '');
  return keyword.replace(/_/g, '').indexOf(normalizedQuery) !== -1;
}

export default Ember.Controller.extend(KeyboardMixin, {

  queryParams: ['query'],
  query: undefined,

  init() {
    this._super();
    this.set('initialQuery', this.get('query'));
  },

  updateEmojis(query='') {
    this.set('query', query || undefined);
    this.store.filter('keyword', keyword => {
      return keywordMatches(keyword.get('id'), query);
    }).then(keywordModels => {
      let keywordStrings = keywordModels.map(k => k.get('id'));<commit_msg>Fix broken query param support on page load<commit_after>import Ember from 'ember';
import KeyboardMixin from 'ember-keyboard-service/mixins/keyboard';

function keywordMatches(keyword='', query='') {
  let normalizedQuery = query.toLowerCase().replace(/\W*/, '');
  return keyword.replace(/_/g, '').indexOf(normalizedQuery) !== -1;
}

export default Ember.Controller.extend(KeyboardMixin, {

  queryParams: ['query'],
  query: undefined,
  initialQuery: Ember.computed.oneWay('query'),

  updateEmojis(query='') {
    this.set('query', query || undefined);
    this.store.filter('keyword', keyword => {
      return keywordMatches(keyword.get('id'), query);
    }).then(keywordModels => {
      let keywordStrings = keywordModels.map(k => k.get('id'));
{'fraction_non_alphanumeric': 0.17779246530072704, 'fraction_numerical': 0.0013218770654329147, 'mean_word_length': 4.778625954198473, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3676716', 'n_tokens_mistral': 463, 'n_tokens_neox': 464, 'n_words': 90}