<commit_before>'use strict';

import Reflux from 'reflux';
import ResultListActions from '../actions/ResultList.action.js';
import CoverImageActions from '../actions/CoverImage.action.js';

// Setup dataobject for query
// @todo We may need to initialize it with data from the URL or an global object
let _store = {
  result: [],
  info: {hits: 0, collections: 0, more: false},
  pending: false,
  hasSearchBeenExecuted: false
};

/**
 * Store containing the current query of the page
 */
let ResultListStore = Reflux.createStore({

  // Initial setup by reflux
  init() {
    // Register statusUpdate action
    this.listenTo(ResultListActions.updated, this.update);
    this.listenTo(ResultListActions.clear, this.empty);
    this.listenTo(ResultListActions.pending, this.updatePending);
  },

  updatePending(state = true) {
    _store.pending = state;
    _store.hasSearchBeenExecuted = true;
    this.trigger(_store);
  },

  // update the resultList object and trigger an action
  update(result) {
    let resultList = result.result || [];
    let info = result.info || [];
    this.callImageActions(resultList);
    _store.result = _store.result.concat(resultList);
    _store.info = info;
    _store.pending = false;
    if (info.more === 'true') {
      _store.offset += _store.worksPerPage;
    }
    this.trigger(_store);
  },
  empty() {
    _store.result = [];
  },

  callImageActions(resultList) {
    resultList.forEach(result => CoverImageActions(result.identifiers));
  },

  // return the store data
  getStore() {
    return _store;
  }
});

export default ResultListStore;<commit_msg>reset store info<commit_after>'use strict';

import Reflux from 'reflux';
import ResultListActions from '../actions/ResultList.action.js';
import CoverImageActions from '../actions/CoverImage.action.js';

// Setup dataobject for query
// @todo We may need to initialize it with data from the URL or an global object
let _store = {
  result: [],
  info: {hits: 0, collections: 0, more: false},
  pending: false,
  hasSearchBeenExecuted: false
};

/**
 * Store containing the current query of the page
 */
let ResultListStore = Reflux.createStore({

  // Initial setup by reflux
  init() {
    // Register statusUpdate action
    this.listenTo(ResultListActions.updated, this.update);
    this.listenTo(ResultListActions.clear, this.empty);
    this.listenTo(ResultListActions.pending, this.updatePending);
  },

  updatePending(state = true) {
    _store.pending = state;
    _store.hasSearchBeenExecuted = true;
    this.trigger(_store);
  },

  // update the resultList object and trigger an action
  update(result) {
    let resultList = result.result || [];
    let info = result.info || [];
    this.callImageActions(resultList);
    _store.result = _store.result.concat(resultList);
    _store.info = info;
    _store.pending = false;
    if (info.more === 'true') {
      _store.offset += _store.worksPerPage;
    }
    this.trigger(_store);
  },
  empty() {
    _store.result = [];
    _store.info = {hits: 0, collections: 0, more: false};
  },

  callImageActions(resultList) {
    resultList.forEach(result => CoverImageActions(result.identifiers));
  },

  // return the store data
  getStore() {
    return _store;
  }
});

export default ResultListStore;
{'fraction_non_alphanumeric': 0.12534393151941303, 'fraction_numerical': 0.0018343014368694588, 'mean_word_length': 3.53185595567867, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4308433', 'n_tokens_mistral': 1004, 'n_tokens_neox': 978, 'n_words': 254}