<commit_before><?php

namespace Joconde\LabBundle\Entity;

use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;

class CoreNoticeRepository extends EntityRepository {

    public function findByNotice($search, $terms, $nbTerm) {
        $max = 5;
        $noticeArray = array();
        $qb = $this->createQueryBuilder('cn');

        if(0 === $nbTerm) {
            $qb->where($qb->expr()->like("lower(cn.titr)", ':s'))
                ->setParameter("s", '%'.$search.'%')<commit_msg>add switch for nbterms<commit_after><?php

namespace Joconde\LabBundle\Entity;

use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;

class CoreNoticeRepository extends EntityRepository {

    public function findByNotice($search, $terms, $nbTerm) {
        
        switch ($nbTerm) {
            case '0': $max = 30; break;
            case '1': $max = 30; break;
            case '2': $max = 15; break;
            case '3': $max = 10; break;
            case '4': $max = 8; break;
            case '5': $max = 6; break;
            case '6': $max = 5; break;
            case '7': $max = 5; break;
            case '8': $max = 5; break;
        }
        echo $nbTerm;
        $noticeArray = array();
        $qb = $this->createQueryBuilder('cn');

        if(0 === $nbTerm) {
            $qb->where($qb->expr()->like("lower(cn.titr)", ':s'))
                ->setParameter("s", '%'.$search.'%')
{'fraction_non_alphanumeric': 0.17092198581560283, 'fraction_numerical': 0.01773049645390071, 'mean_word_length': 2.296728971962617, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '672456', 'n_tokens_mistral': 467, 'n_tokens_neox': 439, 'n_words': 105}