<commit_before>import { Component, OnDestroy } from '@angular/core';
import { Router } from '@angular/router';
import { Observable, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

import { ArticleList } from 'app/_models/ArticleList';
import { ArticleService } from 'app/_services/article.service';

@Component({
    selector: 'search-by-title',
    templateUrl: './search-by-title.component.html',
    styleUrls: ['./search-by-title.component.scss']
})
export class SearchByTitleComponent implements OnDestroy {
    public filteredArticles: Observable<ArticleList[]>;

    private destroyed: Subject<boolean> = new Subject<boolean>();

    constructor(private router: Router,
                private articleService: ArticleService) { }

    selectArticle(article: ArticleList) {
        this.router.navigate(['article', article._id]);
    }

    filterArticles(title: string) {
        this.filteredArticles = this.articleService.getArticlesByTitle(title).pipe(takeUntil(this.destroyed));
    }

    ngOnDestroy() {<commit_msg>Fixed error<commit_after>import { Component, OnDestroy } from '@angular/core';
import { Router } from '@angular/router';
import { Observable, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

import { ArticleList } from 'app/_models/ArticleList';
import { ArticleService } from 'app/_services/article.service';

@Component({
    selector: 'search-by-title',
    templateUrl: './search-by-title.component.html',
    styleUrls: ['./search-by-title.component.scss']
})
export class SearchByTitleComponent implements OnDestroy {
    public filteredArticles: Observable<ArticleList[]>;

    private destroyed: Subject<boolean> = new Subject<boolean>();

    constructor(private router: Router,
                private articleService: ArticleService) { }

    selectArticle(article: ArticleList) {
        this.router.navigate(['article', article._id]);
    }

    filterArticles(title: string) {
        if (title) {
            this.filteredArticles = this.articleService.getArticlesByTitle(title).pipe(takeUntil(this.destroyed));
        }
    }

    ngOnDestroy() {
{'fraction_non_alphanumeric': 0.13057773602630343, 'fraction_numerical': 0.0, 'mean_word_length': 4.095693779904306, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5042921', 'n_tokens_mistral': 602, 'n_tokens_neox': 583, 'n_words': 125}