<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'dva';
import { Link } from 'dva/router';
import { Spin, Layout, Row, Col, Tag } from 'antd';
import groupBy from 'lodash.groupby';
import ScaffoldItem from '../components/ScaffoldItem';
import styles from './IndexPage.less';

const { Sider, Content } = Layout;

const filterTag = (list, tags, search) => list.filter((item) => {
  if (!tags && !search) {
    return true;
  }
  if (item.name.indexOf(search) < 0 || item.description.indexOf(search) < 0) {
    return false;
  }
  const queryTags = typeof tags === 'string' ? [tags] : [...(tags || [])];
  return queryTags.every(tag => (item.tags || []).indexOf(tag) >= 0);
});

const IndexPage = ({ list, groupedTags, location: { query } }) => {
  const tags = Object.keys(groupedTags);
  const filteredItem = filterTag(list, query.tags, query.search);
  const scaffoldItems = (list && list.length > 0) ? (
    <Layout className={styles.normal}>
      <Sider className={styles.sider} width={300}>
        <section className={styles.tags}>
          <h3><commit_msg>Fix search<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'dva';
import { Link } from 'dva/router';
import { Spin, Layout, Row, Col, Tag } from 'antd';
import groupBy from 'lodash.groupby';
import ScaffoldItem from '../components/ScaffoldItem';
import styles from './IndexPage.less';

const { Sider, Content } = Layout;

const filterTag = (list, tags, search) => list.filter((item) => {
  if (!tags && !search) {
    return true;
  }
  if (item.name.indexOf(search) < 0 && item.description.indexOf(search) < 0) {
    return false;
  }
  const queryTags = typeof tags === 'string' ? [tags] : [...(tags || [])];
  return queryTags.every(tag => (item.tags || []).indexOf(tag) >= 0);
});

const IndexPage = ({ list, groupedTags, location: { query } }) => {
  const tags = Object.keys(groupedTags);
  const filteredItem = filterTag(list, query.tags, query.search);
  const scaffoldItems = (list && list.length > 0) ? (
    <Layout className={styles.normal}>
      <Sider className={styles.sider} width={300}>
        <section className={styles.tags}>
          <h3>
{'fraction_non_alphanumeric': 0.1731718259309107, 'fraction_numerical': 0.007178106774338268, 'mean_word_length': 3.9118942731277535, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, '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': '777688', 'n_tokens_mistral': 719, 'n_tokens_neox': 700, 'n_words': 194}