<commit_before><?php
if ($timefacet) {
	if (!isset($fdates))
		$exportfacet = null;
	else
		$exportfacet = $fdates;
}
if($parlfacet) {
	$exportfacet = null;
	if(isset($facet['parlementaires']))
		$exportfacet = $facet['parlementaires']['values'];
}
if ($tagsfacet) {
	$exportfacet = null;
	if (isset($facet['tag']))
		$exportfacet = $facet['tag']['values'];
}
if (isset($exportfacet)) {
	print(json_encode($exportfacet));
	return ;
}

if (!$tags) : ?>
{ "start": <?php echo $results['start'] + 1; ?>, "end": <?php if ($results['numFound'] == $results['end'] - 1) echo $results['end'] - 1; else echo $results['end']; ?>, "last_result": <?php echo $results['numFound'];  ?>, "results": [<?php
	    $nb = 0;
foreach ($results['docs'] as $record)
{
  if ($nb)
    echo ", ";
  else
    $nb = 1;
  echo '{"document_type": "'.get_class($record['object']).'", ';
  echo '"document_id": '.$record['object']->id.", ";
  echo '"document_url": "'.sfConfig::get('app_base_url').url_for('@api_document?format='.$format.'&class='.get_class($record['object']).'&id='.$record['object']->id).'"}';
}
?> ]}<?php return;
endif;
?>
[
<?php
    $cpt = 0;
foreach(array_keys($facet) as $k)
  if (isset($facet[$k]['values']) && count($facet[$k]['values']))
    foreach($facet[$k]['values'] as $value => $nb)
      if ($nb) {
	if ($cpt)
	  echo ", ";
	else
	  $cpt = 1;
	echo '{"tag_type": "'.$k.'", "tag_nom": "'.$value.'", "nb": '.$nb."}\n";
      }
  ?>]
<commit_msg>fix more json solr api<commit_after><?php
if ($timefacet) {
	if (!isset($fdates))
		$exportfacet = null;
	else
		$exportfacet = $fdates;
}
if($parlfacet) {
	$exportfacet = null;
	if(isset($facet['parlementaires']))
		$exportfacet = $facet['parlementaires']['values'];
}
if ($tagsfacet) {
	$exportfacet = null;
	if (isset($facet['tag']))
		$exportfacet = $facet['tag']['values'];
}
if (isset($exportfacet)) {
	print(json_encode($exportfacet));
	return ;
}

if (!$tags) : ?>{"start": <?php echo $results['start'] + 1; ?>, "end": <?php if ($results['numFound'] == $results['end'] - 1) echo $results['end'] - 1; else echo $results['end']; ?>, "last_result": <?php echo $results['numFound'];  ?>, "results": [<?php
	    $nb = 0;
foreach ($results['docs'] as $record)
{
  if ($nb)
    echo ", ";
  else
    $nb = 1;
  echo '{"document_type": "'.get_class($record['object']).'", ';
  echo '"document_id": '.($record['object']->id ? $record['object']->id : '""').", ";
  echo '"document_url": "'.sfConfig::get('app_base_url').url_for('@api_document?format='.$format.'&class='.get_class($record['object']).'&id='.$record['object']->id).'"}';
}
?> ]}<?php return;
endif;
?>
[
<?php
    $cpt = 0;
foreach(array_keys($facet) as $k)
  if (isset($facet[$k]['values']) && count($facet[$k]['values']))
    foreach($facet[$k]['values'] as $value => $nb)
      if ($nb) {
	if ($cpt)
	  echo ", ";
	else
	  $cpt = 1;
	echo '{"tag_type": "'.$k.'", "tag_nom": "'.$value.'", "nb": '.$nb."}\n";
      } ?>
]

{'fraction_non_alphanumeric': 0.28147389969293757, 'fraction_numerical': 0.004776526782668032, 'mean_word_length': 4.852295409181637, 'pattern_counts': {'":': 20, '<': 17, '<?xml version=': 0, '>': 24, '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': '130812', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1146, 'n_words': 215}