<commit_before><?php

class SphinxCriteria extends Criteria
{
	/**
	 * @var array<baseObjectFilter>
	 */
	protected $filters = array();
	
	/**
	 * Store the filter as is
	 * Later the filter fields and the advanced search will be used to attach additional criterions
	 * 
	 * @param baseObjectFilter $filter
	 */
	public function attachFilter(baseObjectFilter $filter)
	{
		$this->filters[] = $filter;
	}
	
	/**
	 * Applies all filter on this criteria
	 */
	public function applyFilters()
	{
		foreach($this->filters as $filter)
			$filter->attachToFinalCriteria($this);
	}
	
	
	public static function escapeString($str)
	{
		$from = array ( '\'',	'\\',	'(',')',	'|',	'-',	'!',	'@',	'~',	'"',	'&',	'/',	'^',	'$',	'='		);
		$to   = array ( '\\\'',	'\\\\',	'\(','\)',	'\|',	'\-',	'\!',	'\@',	'\~',	'\"',	'\&',	'\/',	'\^',	'\$',	'\='	);

		return str_replace($from, $to, $str);
	}
}<commit_msg>Added special chars support<commit_after><?php

class SphinxCriteria extends Criteria
{
	/**
	 * @var array<baseObjectFilter>
	 */
	protected $filters = array();
	
	/**
	 * Store the filter as is
	 * Later the filter fields and the advanced search will be used to attach additional criterions
	 * 
	 * @param baseObjectFilter $filter
	 */
	public function attachFilter(baseObjectFilter $filter)
	{
		$this->filters[] = $filter;
	}
	
	/**
	 * Applies all filter on this criteria
	 */
	public function applyFilters()
	{
		foreach($this->filters as $filter)
			$filter->attachToFinalCriteria($this);
	}
	
	
	public static function escapeString($str)
	{
		$from = array ( '\'',	'\\',	'(',')',	'|',	'-',	'!',	'@',	'~',	'"',	'&',	'/',	'^',	'$',	'=',	'_',	'%'		);
		$to   = array ( '\\\'',	'\\\\',	'\(','\)',	'\|',	'\-',	'\!',	'\@',	'\~',	'\"',	'\&',	'\/',	'\^',	'\$',	'\=',	'\_',	'\%'	);

		return str_replace($from, $to, $str);
	}
}
{'fraction_non_alphanumeric': 0.25158562367864695, 'fraction_numerical': 0.0, 'mean_word_length': 2.711764705882353, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '255720', 'n_tokens_mistral': 758, 'n_tokens_neox': 684, 'n_words': 131}