<commit_before>import React, { Component } from 'react';
import { connect } from 'react-redux'
import SearchBar from 'material-ui-search-bar'
import _ from 'lodash'

import './index.css'
import SearchResults from '../searchresults'
import { searchTomos } from '../../redux/ducks/tomos'

class Main extends Component {

  onChange = (searchText) => {
    this.setState({
      searchText
    })
  }

  onRequestSearch = () => {
    const text = this.state.searchText.toLowerCase();
    if (_.isString(text) && !_.isEmpty(text)) {
      this.props.dispatch(searchTomos(text.split(/\s/)))
    }
  }

  render = () => {

    const searchBarStyle = {
      margin: '20px auto',
      maxWidth: 800
    };

    return (
      <div>
        <SearchBar
          hintText={'Search by author, paper, microscope, atomic species'}
          onChange={this.onChange}
          onRequestSearch={this.onRequestSearch}
          style={searchBarStyle}
        />
        <SearchResults/>
      </div>
    );
  }
}

function mapStateToProps(state) {
  return {};
}

export default connect(mapStateToProps)(Main)

<commit_msg>Load all datasets by default<commit_after>import React, { Component } from 'react';
import { connect } from 'react-redux'
import SearchBar from 'material-ui-search-bar'
import _ from 'lodash'

import './index.css'
import SearchResults from '../searchresults'
import { searchTomos } from '../../redux/ducks/tomos'

class Main extends Component {

  constructor(props)
  {
    super(props)
    this.state = {
      searchText: null
    }
  }

  componentWillMount = () => {
    this.props.dispatch(searchTomos());
  }

  onChange = (searchText) => {
    this.setState({
      searchText
    })
  }

  onRequestSearch = () => {

    if (_.isString(this.state.searchText) && !_.isEmpty(this.state.searchText)) {
      const text = this.state.searchText.toLowerCase();
      this.props.dispatch(searchTomos(text.split(/\s/)))
    }
    else {
      this.props.dispatch(searchTomos());
    }
  }



  render = () => {

    const searchBarStyle = {
      margin: '20px auto',
      maxWidth: 800
    };

    return (
      <div>
        <SearchBar
          hintText={'Search by author, paper, microscope, atomic species'}
          onChange={this.onChange}
          onRequestSearch={this.onRequestSearch}
          style={searchBarStyle}
        />
        <SearchResults/>
      </div>
    );
  }
}

function mapStateToProps(state) {
  return {};
}

export default connect(mapStateToProps)(Main)


{'fraction_non_alphanumeric': 0.1398880895283773, 'fraction_numerical': 0.003996802557953637, 'mean_word_length': 2.606628242074928, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 18, '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': '3380025', 'n_tokens_mistral': 785, 'n_tokens_neox': 770, 'n_words': 155}