<commit_before><?php
setlocale(LC_ALL, 'cs_CZ.utf8');

error_reporting(E_ALL);
ini_set('display_errors', '1');

define('ROOT', dirname(__FILE__) . '/');

require_once 'loader.php';

$query = getGETValue('query', '');
$database = getGETValue('database', 'matweb');

$databases = array('matweb', 'jpw', 'inf', 'small', 'dia');

if (isset($_GET['clearcache'])) {
	Cache::clearCache($_GET['clearcache']);
}

if ($query) {
	$searchResults = search($query, $database);
    $jsonDecode = json_decode($searchResults);
}
?>
<!DOCTYPE HTML>
<meta charset="utf-8">
<title>Chandler &mdash; FCA search engine</title>
<link rel="stylesheet" media="screen" href="styly.css">

<div class="web">
	<div class="header"><h1><a href="./">Chandler &mdash; FCA search engine</a></h1></div>
	
	<div class="content">
		<form method="get" class="search">
		    <div class="searchinput">
		    	<input type="text" size="50" name="query" value="<?=$query?>" class="in"> 
		    	<input type="submit" name="search" class="ok" value="search">
		    
			    <select name="database">
			        <?php
			        foreach ($databases as $dtb) {
			            $selected = $dtb == $database ? 'selected' : '';
			            echo "<option $selected>$dtb</option>\n";
			        }
			        ?>
			    </select>
		    </div>
		</form>
		
		<div class="suggestions">
			<?php
				if($query) {
					$fca = new Fca($jsonDecode);
				   	$specStr = $fca->getSpecialization();
				    $siblStr = $fca->getSimilar();
					$genStr = $fca->getGeneralization();
				    echo '<div>', $specStr, '</div><div>', $siblStr, '</div>', '<div>', $genStr, '</div>';
				}
			?>
		</div>
		
		<div class="results">
			<?php
			if($query) {
				$sresults = new Sresults($jsonDecode);
				$sresults->linksOnPage = 15;
						
			    echo '<h2>Search results</h2>';
   				echo $sresults->getLinksList();
				echo $sresults->getPaginator();
				echo '<div class="footer">Total documents: ', $sresults->totalLinks, '</div>';
			}
			?>
		</div>
	</div>
</div><commit_msg>Do not show documents if...<commit_after><?php
setlocale(LC_ALL, 'cs_CZ.utf8');

error_reporting(E_ALL);
ini_set('display_errors', '1');

define('ROOT', dirname(__FILE__) . '/');
define('MIN_LINKS_TO_SHOW_SPECIALIZATION', 10);

require_once 'loader.php';

$query = getGETValue('query', '');
$database = getGETValue('database', 'matweb');

$databases = array('matweb', 'jpw', 'inf', 'small', 'dia');

if (isset($_GET['clearcache'])) {
	Cache::clearCache($_GET['clearcache']);
}

if ($query) {
	$searchResults = search($query, $database);
    $jsonDecode = json_decode($searchResults);
	$sresults = new Sresults($jsonDecode);
	$sresults->linksOnPage = 15;
}
?>
<!DOCTYPE HTML>
<meta charset="utf-8">
<title>Chandler &mdash; FCA search engine</title>
<link rel="stylesheet" media="screen" href="styly.css">

<div class="web">
	<div class="header"><h1><a href="./">Chandler &mdash; FCA search engine</a></h1></div>
	
	<div class="content">
		<form method="get" class="search">
		    <div class="searchinput">
		    	<input type="text" size="50" name="query" value="<?=$query?>" class="in"> 
		    	<input type="submit" name="search" class="ok" value="search">
		    
			    <select name="database">
			        <?php
			        foreach ($databases as $dtb) {
			            $selected = $dtb == $database ? 'selected' : '';
			            echo "<option $selected>$dtb</option>\n";
			        }
			        ?>
			    </select>
		    </div>
		</form>
		
		<div class="suggestions">
			<?php
				if($query) {
					$fca = new Fca($jsonDecode);
				    $siblStr = $fca->getSimilar();
					$genStr = $fca->getGeneralization();
					
					if($sresults->totalLinks < MIN_LINKS_TO_SHOW_SPECIALIZATION) {
						$specStr = '';
					} else {
						$specStr = $fca->getSpecialization();
					}
										
				    echo '<div>', $specStr, '</div><div>', $siblStr, '</div>', '<div>', $genStr, '</div>';
				}
			?>
		</div>
		
		<div class="results">
			<?php
			if($query) {						
			    echo '<h2>Search results</h2>';
   				echo $sresults->getLinksList();
				echo $sresults->getPaginator();
				echo '<div class="footer">Total documents: ', $sresults->totalLinks, '</div>';
			}
			?>
		</div>
	</div>
</div>
{'fraction_non_alphanumeric': 0.2138095238095238, 'fraction_numerical': 0.005714285714285714, 'mean_word_length': 3.344364012409514, 'pattern_counts': {'":': 0, '<': 92, '<?xml version=': 0, '>': 106, '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': '1106783', 'n_tokens_mistral': 1703, 'n_tokens_neox': 1451, 'n_words': 281}