<commit_before>var React = require('react');
var Tag = require('./Tag');
var Suggestions = require('./Suggestions');
var { DragDropContext } = require('react-dnd');
var HTML5Backend = require('react-dnd-html5-backend');

// Constants
const Keys = {
    ENTER: 13,
    TAB: 9,
    BACKSPACE: 8,
    UP_ARROW: 38,
    DOWN_ARROW: 40,
    ESCAPE: 27
};

var ReactTags = React.createClass({
    propTypes: {
        tags: React.PropTypes.array,
        status: React.PropTypes.element,
        placeholder: React.PropTypes.string,
        labelField: React.PropTypes.string,
        suggestions: React.PropTypes.array,
        autofocus: React.PropTypes.bool,
        inline: React.PropTypes.bool,
        handleDelete: React.PropTypes.func.isRequired,
        handleAddition: React.PropTypes.func.isRequired,
        handleDrag: React.PropTypes.func.isRequired
    },
    getDefaultProps: function() {
        return {
            placeholder: 'Add new tag',
            tags: [],
            suggestions: [],
            autofocus: true,
            inline: true
        }
    },
    componentDidMount: function() {
        if (this.props.autofocus) {
            this.refs.input.focus();
        }
    },
    getInitialState: function() {
        return {
            suggestions: this.props.suggestions,
            query: "",
            selectedIndex: -1,
            selectionMode: false
        }
    },
    componentWillReceiveProps(props) {
        var suggestions = props.suggestions.filter((item) => {
            return (item.toLowerCase()).search(this.state.query.toLowerCase()) === 0;
        });

        this.setState({
            suggestions: suggestions
        });
    },

    handleDelete: function(i, e) {
        this.props.handleDelete(i);
        this.setState({ query: "" });
    },
    handleChange: function(e) {
        var query = e.target.value.trim();
        var suggestions = this.props.suggestions.filter(function(item) {
            return (item.toLowerCase()).indexOf(query.toLowerCase()) === 0;
        });
<commit_msg>indexOf instead search<commit_after>var React = require('react');
var Tag = require('./Tag');
var Suggestions = require('./Suggestions');
var { DragDropContext } = require('react-dnd');
var HTML5Backend = require('react-dnd-html5-backend');

// Constants
const Keys = {
    ENTER: 13,
    TAB: 9,
    BACKSPACE: 8,
    UP_ARROW: 38,
    DOWN_ARROW: 40,
    ESCAPE: 27
};

var ReactTags = React.createClass({
    propTypes: {
        tags: React.PropTypes.array,
        status: React.PropTypes.element,
        placeholder: React.PropTypes.string,
        labelField: React.PropTypes.string,
        suggestions: React.PropTypes.array,
        autofocus: React.PropTypes.bool,
        inline: React.PropTypes.bool,
        handleDelete: React.PropTypes.func.isRequired,
        handleAddition: React.PropTypes.func.isRequired,
        handleDrag: React.PropTypes.func.isRequired
    },
    getDefaultProps: function() {
        return {
            placeholder: 'Add new tag',
            tags: [],
            suggestions: [],
            autofocus: true,
            inline: true
        }
    },
    componentDidMount: function() {
        if (this.props.autofocus) {
            this.refs.input.focus();
        }
    },
    getInitialState: function() {
        return {
            suggestions: this.props.suggestions,
            query: "",
            selectedIndex: -1,
            selectionMode: false
        }
    },
    componentWillReceiveProps(props) {
        var suggestions = props.suggestions.filter((item) => {
            return (item.toLowerCase()).indexOf(this.state.query.toLowerCase()) === 0;
        });

        this.setState({
            suggestions: suggestions
        });
    },

    handleDelete: function(i, e) {
        this.props.handleDelete(i);
        this.setState({ query: "" });
    },
    handleChange: function(e) {
        var query = e.target.value.trim();
        var suggestions = this.props.suggestions.filter(function(item) {
            return (item.toLowerCase()).indexOf(query.toLowerCase()) === 0;
        });

{'fraction_non_alphanumeric': 0.13113161728994657, 'fraction_numerical': 0.007285089849441476, 'mean_word_length': 2.14187643020595, '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': '3256831', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1176, 'n_words': 220}