<commit_before><?
require_once (mnminclude.'sphinxapi.php');

function do_search($by_date = false, $start = 0, $count = 50, $proximity = true) {
	search_parse_query();
	if ($_REQUEST['w'] == 'links' && ($_REQUEST['p'] == 'site' || $_REQUEST['p'] == 'url_db')) {
		return db_get_search_links($by_date, $start, $count);
	} else {
		return sphinx_do_search($by_date, $start, $count);
	}

}

function sphinx_client() {
	global $globals, $db;

	static $cl = false;
	if (!$cl) {
		$cl = new SphinxClient ();
		$cl->SetServer ($globals['sphinx_server'], $globals['sphinx_port']);

		// Request for status values, it's used in other sites
		$globals['status_values'] = $db->get_enum_values('links', 'link_status');
	}
	return $cl;
}

function sphinx_do_search($by_date = false, $start = 0, $count = 10, $proximity = true) {
	global $globals;

	$response = array();
	$queries = array();
	$recorded = array();


	$start_time = microtime(true);

	$indices = $_REQUEST['w'].' '.$_REQUEST['w'].'_delta';

	$cl = sphinx_client();
	if (!$cl) return $response;

	$cl->SetLimits ( $start, $count );
	if ($_REQUEST['w'] == 'links') {
		$cl->SetFieldWeights(array('title' => 3, 'tags' => 3, 'url' => 1, 'content' => 1));
	} else {
		$cl->SetFieldWeights(array('content' => 1));
	}

	// Function to filter by sub site
	if ($_REQUEST['w'] == 'links' || $_REQUEST['w'] == 'comments') {
		$allowed_categories = SitesMgr::get_categories();
		if ($allowed_categories) {
			$cats = array();
			foreach ($allowed_categories as $c) {
				$cats[] = (int) $c->id;
			}
			$cl->SetFilter('category', $cats);
		}
	}

	$response['rows'] = 0;
	$response['time'] = 0;

	if (empty($_REQUEST['words'])) return $response;


	$words_array = preg_split('/\s+/', $_REQUEST['words'], -1, PREG_SPLIT_NO_EMPTY);<commit_msg>Removed category from comments<commit_after><?
require_once (mnminclude.'sphinxapi.php');

function do_search($by_date = false, $start = 0, $count = 50, $proximity = true) {
	search_parse_query();
	if ($_REQUEST['w'] == 'links' && ($_REQUEST['p'] == 'site' || $_REQUEST['p'] == 'url_db')) {
		return db_get_search_links($by_date, $start, $count);
	} else {
		return sphinx_do_search($by_date, $start, $count);
	}

}

function sphinx_client() {
	global $globals, $db;

	static $cl = false;
	if (!$cl) {
		$cl = new SphinxClient ();
		$cl->SetServer ($globals['sphinx_server'], $globals['sphinx_port']);

		// Request for status values, it's used in other sites
		$globals['status_values'] = $db->get_enum_values('links', 'link_status');
	}
	return $cl;
}

function sphinx_do_search($by_date = false, $start = 0, $count = 10, $proximity = true) {
	global $globals;

	$response = array();
	$queries = array();
	$recorded = array();


	$start_time = microtime(true);

	$indices = $_REQUEST['w'].' '.$_REQUEST['w'].'_delta';

	$cl = sphinx_client();
	if (!$cl) return $response;

	$cl->SetLimits ( $start, $count );
	if ($_REQUEST['w'] == 'links') {
		$cl->SetFieldWeights(array('title' => 3, 'tags' => 3, 'url' => 1, 'content' => 1));
	} else {
		$cl->SetFieldWeights(array('content' => 1));
	}

	// Function to filter by sub site
	if ($_REQUEST['w'] == 'links') {
		$allowed_categories = SitesMgr::get_categories();
		if ($allowed_categories) {
			$cats = array();
			foreach ($allowed_categories as $c) {
				$cats[] = (int) $c->id;
			}
			$cl->SetFilter('category', $cats);
		}
	}

	$response['rows'] = 0;
	$response['time'] = 0;

	if (empty($_REQUEST['words'])) return $response;


	$words_array = preg_split('/\s+/', $_REQUEST['words'], -1, PREG_SPLIT_NO_EMPTY);
{'fraction_non_alphanumeric': 0.21761219305673157, 'fraction_numerical': 0.007902907140841095, 'mean_word_length': 4.753246753246753, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '6185333', 'n_tokens_mistral': 1435, 'n_tokens_neox': 1322, 'n_words': 286}