<commit_before>import React from 'react';
import 'whatwg-fetch'

class SearchResult extends React.Component {

    constructor(props){
        super(props)

        this.state = {
            data: []
        }
    }
    
    componentWillMount () {
        const self = this
        fetch('http://localhost:3000/searchListResult')
            .then(function(response) {
                return response.text()
            }).then(function(body) {
                var lists = JSON.parse(body)
                self.setState({data: lists})
            }).catch(function(ex) {
                console.log('Error', ex)
            })
    }

    renderResult(row, index) {
        return (
            <tr key={index}>
                <td>{ row.num }</td>
                <td>{ row.name }</td>                
            </tr>
        )
    }

    render() {
        return (
            <div className="search-result">
                <table>
                    <thead>
                        <tr>
                            <th>Num</th>
                            <th>Description</th>                            
                        </tr>
                    </thead>
                    <tbody>
                        {
                            this.state.data.map(this.renderResult)
                        }
                    </tbody><commit_msg>modified search page<commit_after>import React from 'react';
import 'whatwg-fetch'

class SearchResult extends React.Component {

    constructor(props){
        super(props)

        this.state = {
            data: []
        }
    }
    
    componentWillMount () {
        const self = this
        fetch('http://localhost:3000/searchListResult')
            .then(function(response) {
                return response.text()
            }).then(function(body) {
                var lists = JSON.parse(body)
                self.setState({data: lists})
            }).catch(function(ex) {
                console.log('Error', ex)
            })
    }

    renderResult(row, index) {
        return (
            <tr key={index}>
                <td>{ row.num }</td>
                <td>{ row.name }</td>
                <td>
                {(() => {
                    switch (row.type) {                    
                      case "B": return <img src="/images/content/bus_black.png" />;
                      case "S": return <img src="/images/content/stop_black.png" />;
                    }
                })()}
                </td>
            </tr>
        )
    }

    render() {
        return (
            <div className="search-result">
                <table>
                    <thead>
                        <tr>
                            <th>Num</th>
                            <th>Description</th>
                            <th>B/S</th>
                        </tr>
                    </thead>
                    <tbody>
                        {
                            this.state.data.map(this.renderResult)
                        }
                    </tbody>
{'fraction_non_alphanumeric': 0.1187214611872146, 'fraction_numerical': 0.002609262883235486, 'mean_word_length': 0.8769889840881273, 'pattern_counts': {'":': 2, '<': 45, '<?xml version=': 0, '>': 46, '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': '4804997', 'n_tokens_mistral': 791, 'n_tokens_neox': 734, 'n_words': 130}