<commit_before><?php
class QuickSearch extends Filter {
    /*
     * Quicksearch represents one-field filter which goes perfectly with a grid
     */

    var $region=null;
    var $region_url=null;

    function defaultTemplate(){
        return array('compact_form','form');
    }
    function init(){
        parent::init();
        $this->useDQ($this->owner->dq);
        //on field change we should change a name of a button also: 'clear' in the name will clear fields
        $this->addField('Search','q','Find')->denyEnter()->onChange()->ajaxFunc($this->setGoFunc());
        $this->last_field->onKeyPress()->ajaxFunc($this->setGoFunc());
        $this->addButton('Clear','Clear')->submitForm($this);

        $this->onSubmit()->submitForm($this);
    }
    function setGoFunc(){
    	return "btn=document.getElementById('".$this->name.'_Clear'."'); if(btn){btn.value='Go'; btn.name='".
    		$this->name."_go'; btn.id='".$this->name."_go';}";
    }
    function useFields($fields){
        $this->fields=$fields;
        return $this;
    }
    function applyDQ($dq){
        if(!($v=$this->get('q')))return;

        $v=addslashes($v);  // quote it<commit_msg>QuickSearch was broken since Ajax update. I had to remove "clear" functionality and it works nice<commit_after><?php
class QuickSearch extends Filter {
    /*
     * Quicksearch represents one-field filter which goes perfectly with a grid
     */

    var $region=null;
    var $region_url=null;

    function defaultTemplate(){
        return array('compact_form','form');
    }
    function init(){
        parent::init();
        $this->useDQ($this->owner->dq);
        //on field change we should change a name of a button also: 'clear' in the name will clear fields
        $this->addField('Search','q','Find');//->onChange()->ajaxFunc($this->setGoFunc());
        $this->last_field->onKeyPress()->ajaxFunc($this->setGoFunc());
        $this->addButton('Go','Go')->submitForm($this);

        $this->onSubmit()->submitForm($this);
    }
    function setGoFunc(){
    	return "btn=document.getElementById('".$this->name.'_Clear'."'); if(btn){btn.value='Go'; btn.name='".
    		$this->name."_go'; btn.id='".$this->name."_go';}";
    }
    function useFields($fields){
        $this->fields=$fields;
        return $this;
    }
    function applyDQ($dq){
        if(!($v=$this->get('q')))return;

        $v=addslashes($v);  // quote it
{'fraction_non_alphanumeric': 0.1893687707641196, 'fraction_numerical': 0.0, 'mean_word_length': 3.0830508474576273, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 44, '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': '6094941', 'n_tokens_mistral': 733, 'n_tokens_neox': 715, 'n_words': 152}