<commit_before>import { Component, View, CORE_DIRECTIVES, FORM_DIRECTIVES} from 'angular2/angular2';
import { Router, RouteParams, Location, ROUTER_DIRECTIVES } from 'angular2/router';
import { Client, Upload } from '../../services/api';
import { MindsTitle } from '../../services/ux/title';
import { Material } from '../../directives/material';
import { InfiniteScroll } from '../../directives/infinite-scroll';
import { CARDS } from '../../controllers/cards/cards';
import { BlogCard } from '../../plugins/blog/card/card';

@Component({
  selector: 'minds-search',
  viewBindings: [ Client ],
  bindings: [ MindsTitle ]
})
@View({
  templateUrl: 'src/controllers/search/list.html',
  directives: [ CORE_DIRECTIVES, Material, FORM_DIRECTIVES, ROUTER_DIRECTIVES,
    CARDS, BlogCard, InfiniteScroll ]
})

export class Search {

  q : string = "";
  type : string = "";

  entities: Array<Object> = [];
  offset : string = "";
  inProgress : boolean = false;
  moreData : boolean = true;

  constructor(public client: Client, public params : RouteParams, public title: MindsTitle){
    this.q = params.params['q'];
    if(params.params['type'])
      this.type = params.params['type'];
  	this.search();

    this.title.setTitle("Search");
  }

  /**
   * Search
   */
   search(refresh : boolean = true){
     if(this.inProgress)
      return;

    this.inProgress = true;

    this.client.get('api/v1/search', { q: this.q, type: this.type, limit: 12, offset: this.offset })
      .then((response: any) => {
        if(!response.entitites || response.entities.length == 0){
          this.inProgress = false;
          return;
        }
        this.entities = this.entities.concat(response.entities);
        this.offset = response['load-next'];<commit_msg>(fix): typo in response.entities<commit_after>import { Component, View, CORE_DIRECTIVES, FORM_DIRECTIVES} from 'angular2/angular2';
import { Router, RouteParams, Location, ROUTER_DIRECTIVES } from 'angular2/router';
import { Client, Upload } from '../../services/api';
import { MindsTitle } from '../../services/ux/title';
import { Material } from '../../directives/material';
import { InfiniteScroll } from '../../directives/infinite-scroll';
import { CARDS } from '../../controllers/cards/cards';
import { BlogCard } from '../../plugins/blog/card/card';

@Component({
  selector: 'minds-search',
  viewBindings: [ Client ],
  bindings: [ MindsTitle ]
})
@View({
  templateUrl: 'src/controllers/search/list.html',
  directives: [ CORE_DIRECTIVES, Material, FORM_DIRECTIVES, ROUTER_DIRECTIVES,
    CARDS, BlogCard, InfiniteScroll ]
})

export class Search {

  q : string = "";
  type : string = "";

  entities: Array<Object> = [];
  offset : string = "";
  inProgress : boolean = false;
  moreData : boolean = true;

  constructor(public client: Client, public params : RouteParams, public title: MindsTitle){
    this.q = params.params['q'];
    if(params.params['type'])
      this.type = params.params['type'];
  	this.search();

    this.title.setTitle("Search");
  }

  /**
   * Search
   */
   search(refresh : boolean = true){
     if(this.inProgress)
      return;

    this.inProgress = true;

    this.client.get('api/v1/search', { q: this.q, type: this.type, limit: 12, offset: this.offset })
      .then((response: any) => {
        if(!response.entities || response.entities.length == 0){
          this.inProgress = false;
          return;
        }
        this.entities = this.entities.concat(response.entities);
        this.offset = response['load-next'];
{'fraction_non_alphanumeric': 0.16468590831918506, 'fraction_numerical': 0.003961516694963215, 'mean_word_length': 3.2952612393681653, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4536699', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1103, 'n_words': 240}