<commit_before><?php

namespace JayPS\Search\Test;

use Nos\Controller_Front_Application;

class Controller_Front extends Controller_Front_Application
{
    public function action_test($args = array())
    {
        $keywords =  !empty($_GET['q']) ? $_GET['q'] : 'monkey chimpa*';

        echo \View::forge('front/form', array(
            'q' => $keywords,
        ));

        \JayPS\Search\Orm_Behaviour_Searchable::init_relations();

        // note: we could add relations to a specific model
        // but for every model used before the controller (ex: noviusos_page::model/page in the template),
        // init_relations() should be call in 'front.start'
        //\JayPS\Search\Orm_Behaviour_Searchable::init_relations('noviusos_monkey::model/monkey');

        $pages = \Nos\Page\Model_Page::find('all', array(
            'where' => array(
                array('keywords', $keywords),
            ),
            'rows_limit' => 10,
            'order_by' => array('jayps_search_score', 'page_title'),
        ));
        echo \View::forge('front/results', array(
            'title'        => '\Nos\Page\Model_Page::find()',
            'items'        => $pages,
            'field_name'   => 'page_title',
            'field_url'    => 'page_virtual_url',
         ));

        $monkeys = \Nos\Monkey\Model_Monkey::find('all', array(
            'where' => array(
                array('keywords', $keywords),<commit_msg>Display generated keywords<commit_after><?php

namespace JayPS\Search\Test;

use Nos\Controller_Front_Application;

class Controller_Front extends Controller_Front_Application
{
    public function action_test($args = array())
    {
        $q =  !empty($_GET['q']) ? $_GET['q'] : 'monkey chimpa*';

        echo \View::forge('front/form', array(
            'q' => $q,
        ));

        \Config::load('jayps_search::config', 'config');
        $config = \Config::get('config');

        $keywords = \JayPS\Search\Search::generate_keywords($q, array(
            'min_word_len' => $config['min_word_len'],
            'max_keywords' => $config['max_join'],
        ));
        d($keywords);

        \JayPS\Search\Orm_Behaviour_Searchable::init_relations();

        // note: we could add relations to a specific model
        // but for every model used before the controller (ex: noviusos_page::model/page in the template),
        // init_relations() should be call in 'front.start'
        //\JayPS\Search\Orm_Behaviour_Searchable::init_relations('noviusos_monkey::model/monkey');

        $pages = \Nos\Page\Model_Page::find('all', array(
            'where' => array(
                array('keywords', $q),
            ),
            'rows_limit' => 10,
            'order_by' => array('jayps_search_score', 'page_title'),
        ));
        echo \View::forge('front/results', array(
            'title'        => '\Nos\Page\Model_Page::find()',
            'items'        => $pages,
            'field_name'   => 'page_title',
            'field_url'    => 'page_virtual_url',
         ));

        $monkeys = \Nos\Monkey\Model_Monkey::find('all', array(
            'where' => array(
                array('keywords', $q),
{'fraction_non_alphanumeric': 0.15484074424471775, 'fraction_numerical': 0.001261431725007884, 'mean_word_length': 2.3214659685863874, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '4532900', 'n_tokens_mistral': 986, 'n_tokens_neox': 925, 'n_words': 179}