<commit_before>import {Component, Input, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {MatMenuTrigger} from '@angular/material';
import {AutocompleteNComponent} from '@shared/modules/controls/autocomplete-n/autocomplete-n.component';
import {SearchQuery} from 'model/SearchQuery';
import {DataTransportService} from '@shared/services/data.transport.service';
import {SearchService} from '@shared/services/search.service';
import {QueryUtils} from '@shared/utils/query-utils';
import {LogService} from '@shared/modules/logs/services/log.service';
import {DataControl} from 'model/DataControl';

@Component({
    selector: '[app-search-box]',
    templateUrl: 'search-box.component.html',
    styleUrls: ['search-box.component.css']
})
export class SearchBoxComponent implements OnInit {

    @ViewChild(AutocompleteNComponent) autocompleteComponent: AutocompleteNComponent;
    @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger;
    query: string;

    queryParams: SearchQuery = new SearchQuery();

    @Input()
    isHomeSearch: boolean;

    params: {};

    // advance search
    dataControl = new DataControl();
    facetsChannel = 'facet_channel';

    constructor(protected router: Router,
                private dataTransportService: DataTransportService,
                private searchService: SearchService,
                private logger: LogService,
                private route: ActivatedRoute) {
    }

    ngOnInit() {
        this.route.queryParams.subscribe(params => {
            if (this.router.url.indexOf('/dataset/') === -1) {
                this.params = params;
                this.queryParams = QueryUtils.extractQuery(params);
                this.query = this.queryParams.toQueryString();
                this.logger.debug('query: {}', this.query);
            }
        });
        this.loadFacetForAdvancedSearch();
    }

    caret_class(): string {
        return this.trigger.menuOpen ? 'fa-caret-up' : 'fa-caret-down';<commit_msg>Remove quote character if the query contain only keyword<commit_after>import {Component, Input, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {MatMenuTrigger} from '@angular/material';
import {AutocompleteNComponent} from '@shared/modules/controls/autocomplete-n/autocomplete-n.component';
import {SearchQuery} from 'model/SearchQuery';
import {DataTransportService} from '@shared/services/data.transport.service';
import {SearchService} from '@shared/services/search.service';
import {QueryUtils} from '@shared/utils/query-utils';
import {LogService} from '@shared/modules/logs/services/log.service';
import {DataControl} from 'model/DataControl';

@Component({
    selector: '[app-search-box]',
    templateUrl: 'search-box.component.html',
    styleUrls: ['search-box.component.css']
})
export class SearchBoxComponent implements OnInit {

    @ViewChild(AutocompleteNComponent) autocompleteComponent: AutocompleteNComponent;
    @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger;
    query: string;

    queryParams: SearchQuery = new SearchQuery();

    @Input()
    isHomeSearch: boolean;

    params: {};

    // advance search
    dataControl = new DataControl();
    facetsChannel = 'facet_channel';

    constructor(protected router: Router,
                private dataTransportService: DataTransportService,
                private searchService: SearchService,
                private logger: LogService,
                private route: ActivatedRoute) {
    }

    ngOnInit() {
        this.route.queryParams.subscribe(params => {
            if (this.router.url.indexOf('/dataset/') === -1) {
                this.params = params;
                this.queryParams = QueryUtils.extractQuery(params);
                const query = this.queryParams.toQueryString();
                if (query.match(/^"[^"]*"$/)) {
                    this.query = query.substring(1, query.length - 1);
                } else {
                    this.query = query;
                }
                this.logger.debug('query: {}', this.query);
            }
        });
        this.loadFacetForAdvancedSearch();
    }

    caret_class(): string {
        return this.trigger.menuOpen ? 'fa-caret-up' : 'fa-caret-down';
{'fraction_non_alphanumeric': 0.12348837209302325, 'fraction_numerical': 0.0009302325581395349, 'mean_word_length': 3.100095328884652, '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': '6889425', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1133, 'n_words': 245}