public static function logHit($query)
 {
     // create or update log
     $existing = SearchLog::get()->filter(array('Query' => $query))->first();
     if ($existing) {
         $existing->Count = $existing->Count + 1;
         $existing->write();
     } else {
         $log = new SearchLog();
         $log->Query = $query;
         $log->Count = 1;
         $log->write();
     }
 }
Ejemplo n.º 2
0
 public static function search($query)
 {
     try {
         $query = strtolower($query);
         $callback = SearchLog::model()->find('query LIKE :query', array(':query' => trim(strtolower($query))));
         if (empty($callback)) {
             $callback = new SearchLog();
             $callback->query = $query;
             $callback->save();
         }
         return $callback;
     } catch (Exception $e) {
         throw new CHttpException(500, $e->getMessage());
     }
 }
 /**
  * @throws SS_HTTPResponse_Exception
  */
 public function logSearchAction()
 {
     $getVars = $this->owner->request->getVars();
     $query = $getVars['Search'];
     // log or count 404
     SearchLog::logHit($query);
 }
 /**
  * If there is a search encoded in the link, go ahead and log it.
  * This happens when you click through on a search suggestion
  */
 public function onAfterInit()
 {
     $req = $this->owner->getRequest();
     $src = $req->requestVar(Config::inst()->get('ShopSearch', 'qs_source'));
     if ($src) {
         $qs_q = Config::inst()->get('ShopSearch', 'qs_query');
         $qs_f = Config::inst()->get('ShopSearch', 'qs_filters');
         $vars = json_decode(base64_decode($src), true);
         // log the search
         $log = SearchLog::create(array('Query' => strtolower($vars[$qs_q]), 'Link' => $req->getURL(false), 'NumResults' => $vars['total'], 'MemberID' => Member::currentUserID(), 'Filters' => !empty($vars[$qs_f]) ? json_encode($vars[$qs_f]) : null));
         $log->write();
         // redirect to the clean page
         $this->owner->redirect($req->getURL(false));
     }
 }
 public function testLogging()
 {
     /** @var Member $m1 */
     $m1 = $this->objFromFixture('Member', 'm1');
     $m1->logOut();
     $this->assertEquals(0, SearchLog::get()->count());
     // Searching for nothing should not leave a record
     ShopSearch::inst()->search(array());
     $this->assertEquals(0, SearchLog::get()->count());
     // Searching should leave a log record
     ShopSearch::inst()->search(array('q' => 'green'));
     $this->assertEquals(1, SearchLog::get()->count());
     $log = SearchLog::get()->last();
     $this->assertEquals('green', $log->Query);
     $this->assertEquals(2, $log->NumResults);
     $this->assertEquals(0, $log->MemberID);
     // If we log in as a customer, the search log should register that
     $m1->logIn();
     ShopSearch::inst()->search(array('q' => 'purple'));
     $this->assertEquals(2, SearchLog::get()->count());
     $log = SearchLog::get()->last();
     $this->assertEquals('purple', $log->Query);
     $this->assertEquals(1, $log->NumResults);
     $this->assertEquals($m1->ID, $log->MemberID);
     $m1->logOut();
     // Refining a search several times should leave us a crumb trail
     $s = ShopSearch::inst();
     $r = $s->search(array('q' => 'green'));
     $this->assertNotNull($r->SearchBreadcrumbs, 'Search crumb exists');
     $this->assertEquals(1, $r->SearchBreadcrumbs->count(), 'Search crumb should have 1 entry');
     $this->assertEquals('Search: green', $r->SearchBreadcrumbs->first()->Title, 'Search crumb label should be correct');
     $r = $s->search(array('q' => 'green', '__ps' => $r->SearchLogID, '__t' => 'Model: ABC', 'f' => array('Model' => 'ABC')));
     $this->assertEquals(2, $r->SearchBreadcrumbs->count(), 'Search crumb should have 2 entries');
     $this->assertEquals('Search: green', $r->SearchBreadcrumbs->first()->Title, 'Search crumb should contain previous search');
     $this->assertEquals('Model: ABC', $r->SearchBreadcrumbs->last()->Title, 'Search crumb should contain current search');
     $r = $s->search(array('q' => 'green', '__ps' => $r->SearchLogID, '__t' => 'Price: $10.50', 'f' => array('Model' => 'ABC', 'Price' => '10.50')));
     $this->assertEquals(3, $r->SearchBreadcrumbs->count(), 'Search crumb should have 3 entries');
     $this->assertEquals('Search: green', $r->SearchBreadcrumbs->first()->Title, 'Search crumb should contain first search');
     $this->assertEquals('Model: ABC', $r->SearchBreadcrumbs->offsetGet(1)->Title, 'Search crumb should contain previous search');
     $this->assertEquals('Price: $10.50', $r->SearchBreadcrumbs->last()->Title, 'Search crumb should contain current search');
     $r = $s->search(array('q' => 'purple'));
     $this->assertEquals(1, $r->SearchBreadcrumbs->count(), 'Search crumb should reset');
 }
Ejemplo n.º 6
0
 public function fichas()
 {
     $per_page = 10;
     //Se obtienen los parametros de busqueda definidos en el input del usuario
     $buscar = $this->input->get('buscar');
     $offset = (int) $this->input->get('offset');
     $exacto = $this->input->get('exacto');
     $empresa = $vista_pymes = $this->input->get('e') && $this->input->get('e') == 1 ? true : false;
     //var_dump($empresa);
     $filtro_temas = $this->input->get('temas') ? explode(',', $this->input->get('temas')) : array();
     $filtro_hecho = $this->input->get('hecho') ? explode(',', $this->input->get('hecho')) : array();
     $filtro_genero = $this->input->get('genero') ? $this->input->get('genero') : null;
     $filtro_edad = $this->input->get('edad') ? $this->input->get('edad') : null;
     $filtro_tema_empresa = $this->input->get('tema_empresa') ? explode(',', $this->input->get('tema_empresa')) : array();
     $filtro_instituciones = $this->input->get('instituciones') ? explode(',', $this->input->get('instituciones')) : array();
     $filtro_formalizacion = $this->input->get('formalizacion') ? explode(',', $this->input->get('formalizacion')) : array();
     $filtro_apoyo_estado = $this->input->get('apoyo_estado') ? explode(',', $this->input->get('apoyo_estado')) : array();
     $filtro_fps = $this->input->get('fps') ? $this->input->get('fps') : '';
     $filtro_rubro = $this->input->get('rubro') ? explode(',', $this->input->get('rubro')) : array();
     $filtro_tipo_empresa = $this->input->get('tipo_empresa') ? explode(',', $this->input->get('tipo_empresa')) : array();
     $filtro_etapa_empresa = $this->input->get('etapa_empresa') ? explode(',', $this->input->get('etapa_empresa')) : array();
     $filtro_hecho_empresa = $this->input->get('hecho_empresa') ? explode(',', $this->input->get('hecho_empresa')) : array();
     $filtro_aprende = $this->input->get('aprende') ? explode(',', $this->input->get('aprende')) : array();
     $filtro_evento = $this->input->get('evento') ? explode(',', $this->input->get('evento')) : array();
     $filtro_req_especial = $this->input->get('req_especial') ? explode(',', $this->input->get('req_especial')) : array();
     $aData = array();
     //Sugerencias en base a diccionario
     $suggest = null;
     $query = trim($buscar);
     if (!$exacto) {
         $correccion = Doctrine::getTable('Diccionario')->corregirTexto($query);
         if ($correccion != $query) {
             //Es decir, hubo una correccion
             $suggest = $query;
             $query = $correccion;
         }
     }
     //Vemos si hay resultados patrocinados
     $promocionados = Doctrine::getTable('SearchPromocionado')->search($query);
     //Se hace la busqueda en Sphinx
     $this->load->library('sphinxclient');
     $this->sphinxclient->setServer($this->config->item('sphinx_host'), (int) $this->config->item('sphinx_port'));
     $this->sphinxclient->SetFieldWeights(array('keywords' => 50, 'titulo' => 100, 'sic' => 50, 'objetivo' => 5));
     if ($query) {
         //Si hau una busqueda, usamos el algoritmo para clasificar los resultados
         $this->sphinxclient->SetMatchMode(SPH_MATCH_EXTENDED);
         $this->sphinxclient->setRankingMode(SPH_RANK_EXPR, 'bm25 + 100*(sum(lcs*user_weight)/max_lcs) + 10*(hits/max_hits)');
     } else {
         //Si no hay busqueda, simplement ordenamos por hits.
         $this->sphinxclient->SetSortMode(SPH_SORT_ATTR_DESC, 'hits');
     }
     $this->sphinxclient->setLimits(0, 1000);
     if (!empty($filtro_temas)) {
         foreach ($filtro_temas as $f) {
             $this->sphinxclient->setFilter('tema_id', array($f));
         }
     }
     if (!empty($filtro_instituciones)) {
         $filtro_instituciones_crc32 = array_map('crc32', $filtro_instituciones);
         $this->sphinxclient->setFilter('servicio_codigo', $filtro_instituciones_crc32);
     }
     if (!empty($filtro_hecho)) {
         $this->sphinxclient->setFilter('hecho_vida_id', $filtro_hecho);
     }
     if ($filtro_genero && $filtro_genero != 1) {
         //Si es que hay un filtro de genero, y no se selecciono "Ambos"
         $this->sphinxclient->setFilter('genero_id', array(1, $filtro_genero));
     }
     if ($filtro_edad) {
         $this->sphinxclient->SetSelect('*, IF(edad_minima < ' . $filtro_edad . ' AND ' . $filtro_edad . ' < edad_maxima ,1,0) as edad_ok');
         $this->sphinxclient->setFilter('edad_ok', array(1));
     }
     if (!empty($filtro_tema_empresa)) {
         $this->sphinxclient->setFilter('tema_empresa_id', $filtro_tema_empresa);
     }
     if (!empty($filtro_formalizacion)) {
         $this->sphinxclient->setFilter('formalizacion', $filtro_formalizacion);
     }
     if (!empty($filtro_apoyo_estado)) {
         $this->sphinxclient->setFilter('apoyo_estado_id', $filtro_apoyo_estado);
     }
     if (!empty($filtro_fps)) {
         $this->sphinxclient->setFilterRange('puntaje_fps_min', 0, $filtro_fps);
         $this->sphinxclient->setFilterRange('puntaje_fps_max', $filtro_fps, 100000);
     }
     if (!empty($filtro_rubro)) {
         $this->sphinxclient->setFilter('rubro_id', $filtro_rubro);
     }
     if (!empty($filtro_tipo_empresa)) {
         $this->sphinxclient->setFilter('tipo_empresa_id', $filtro_tipo_empresa);
     }
     if (!empty($filtro_etapa_empresa)) {
         $this->sphinxclient->setFilter('etapa_empresa_id', $filtro_etapa_empresa);
     }
     if (!empty($filtro_hecho_empresa)) {
         $this->sphinxclient->setFilter('hecho_empresa_id', $filtro_hecho_empresa);
     }
     if (!empty($filtro_aprende)) {
         $this->sphinxclient->setFilter('flujo', $filtro_aprende);
     }
     if (!empty($filtro_evento)) {
         $this->sphinxclient->setFilter('evento_id', $filtro_evento);
     }
     if (!empty($filtro_req_especial)) {
         $this->sphinxclient->setFilter('requisito_especial', $filtro_req_especial);
     }
     //Preparo los terminos para enviarlos al sphinx (Para que haga busqueda ANY)
     $sphinx_query = trim(preg_replace('/[\\-\\+\'\\"]+/', ' ', $query));
     //Le quitamos los caracteres especiales de sphinx (- + " ')
     if ($query) {
         $query_arr = preg_split('/\\s+/', $sphinx_query);
         foreach ($query_arr as &$s) {
             $s = '(' . $s . ')';
         }
         $sphinx_query = implode(' | ', $query_arr);
     }
     //Hago la busqueda
     $result = $this->sphinxclient->query($sphinx_query, 'redchile_fichas');
     //Se hace el match de los resultados de Sphinx con el modelo en Doctrine.
     $doctrine_query = Doctrine_Query::create()->from('Ficha f')->where('f.maestro = 0 AND f.publicado = 1');
     if ($result['total'] > 0) {
         $page_results = array_slice($result['matches'], $offset, $per_page, TRUE);
         $matches = array_keys($page_results);
         if (!empty($matches)) {
             $doctrine_query->whereIn('f.id', $matches);
             $doctrine_query->orderBy('FIELD (id, ' . implode(',', $matches) . ')');
         } else {
             $doctrine_query->where('0');
         }
     } else {
         $doctrine_query->where('0');
     }
     $fichas = $doctrine_query->execute();
     $total_fichas = $result['total'];
     //Se configura la paginacion
     $this->pagination->initialize(array('base_url' => url_buscador(), 'total_rows' => $total_fichas, 'per_page' => $per_page));
     //Se calculan los parametros para llenar la barra izquierda de navegacion.
     if ($result['total'] > 0) {
         $formalidad = array('informal' => 'Informal', 'formal' => 'Formal');
         $req_especial = array('mujer' => 'Mujer', 'indigena' => 'Indigena');
         foreach ($result['matches'] as $ficha) {
             foreach ($formalidad as $tramite => $nombre) {
                 if ($ficha['attrs'][$tramite]) {
                     if (!isset($aData['formalidad'][$tramite])) {
                         $aData['formalidad'][$tramite]['nombre'] = $nombre;
                         $aData['formalidad'][$tramite]['numero_fichas'] = 1;
                     } else {
                         $aData['formalidad'][$tramite]['numero_fichas']++;
                     }
                 }
             }
             foreach ($req_especial as $tramite => $nombre) {
                 if ($ficha['attrs'][$tramite]) {
                     if (!isset($aData['req_especial'][$tramite])) {
                         $aData['req_especial'][$tramite]['nombre'] = $nombre;
                         $aData['req_especial'][$tramite]['numero_fichas'] = 1;
                     } else {
                         $aData['req_especial'][$tramite]['numero_fichas']++;
                     }
                 }
             }
         }
         $all_ids = array_keys($result['matches']);
         $instituciones = Doctrine::getTable('Servicio')->findServiciosBusqueda(implode(',', $all_ids));
         $temas = Doctrine::getTable('Tema')->findTemasBusqueda(implode(',', $all_ids));
         $temas_empresa = Doctrine::getTable('TemaEmpresa')->findTemasEmpresaBusqueda(implode(',', $all_ids));
         $apoyos_estado = Doctrine::getTable('ApoyoEstado')->findApoyosBusqueda(implode(',', $all_ids));
         $tipos_empresa = Doctrine::getTable('TipoEmpresa')->findTipoEmpresaBusqueda(implode(',', $all_ids));
         $etapas_empresa = Doctrine::getTable('EtapaEmpresa')->findEtapaEmpresaBusqueda(implode(',', $all_ids));
         $eventos = Doctrine::getTable('Evento')->findEventoBusqueda(implode(',', $all_ids));
         $formalidad = isset($aData['formalidad']) ? $aData['formalidad'] : array();
         $rubros = Doctrine::getTable('Rubro')->findRubroBusqueda(implode(',', $all_ids));
         $req_especial = isset($aData['req_especial']) ? $aData['req_especial'] : array();
     } else {
         $instituciones = null;
         $temas = null;
         $temas_empresa = null;
         $apoyos_estado = null;
         $tipos_empresa = null;
         $etapas_empresa = null;
         $eventos = null;
         $formalidad = null;
         $rubros = null;
         $req_especial = null;
     }
     //Almacenamos la busqueda en el log
     $this->load->library('user_agent');
     TrackSesion::loadSession();
     $log = new SearchLog();
     $log->search_query = $buscar;
     $log->search_query_parsed = $query;
     $log->cantidad_resultados = $total_fichas + count($promocionados);
     $log->parametros = $this->input->server('QUERY_STRING');
     //Filtros enviados a la busqueda
     $log->referrer = $this->agent->referrer();
     $log->session_id = $this->session_track->userdata('session_id');
     $log->save();
     //Se guarda en la sesión el origen de la navegación del usuario para marcas de analytics
     if (!$this->input->cookie('origen_navegacion')) {
         $origen_navegacion = 'buscador';
         $origen_navegacion = !empty($filtro_hecho) ? 'etapas' : $origen_navegacion;
         $origen_navegacion = !empty($filtro_temas) ? 'temas' : $origen_navegacion;
         $this->input->set_cookie(array('name' => 'origen_navegacion', 'value' => $origen_navegacion, 'expire' => '86400', 'path' => '/', 'secure' => FALSE));
     }
     //Pasamos los parametros a la vista y cargamos la vista.
     $data['buscar'] = $buscar;
     //La busqueda original del usuario
     $data['empresa'] = $empresa;
     //Es busqueda de ChilAtiende Empresas?
     $data['query'] = $query;
     //La busqueda que se hizo realmente
     $data['suggest'] = $suggest;
     //Sugerencia de alternativa
     $data['promocionados'] = $promocionados;
     //Resultados promocionados
     $data['fichas'] = $fichas;
     $data['total_fichas'] = $total_fichas;
     $data['offset'] = $offset;
     $data['temas'] = $temas;
     $data['instituciones'] = $instituciones;
     $data['temas_empresa'] = $temas_empresa;
     $data['apoyos_estado'] = $apoyos_estado;
     $data['tipos_empresa'] = $tipos_empresa;
     $data['etapas_empresa'] = $etapas_empresa;
     $data['eventos'] = $eventos;
     $data['formalidad'] = $formalidad;
     $data['rubros'] = $rubros;
     $data['req_especial'] = $req_especial;
     $data['fps'] = $filtro_fps;
     $data['filtro_temas'] = $filtro_temas;
     $data['filtro_tema_empresa'] = $filtro_tema_empresa;
     $data['filtro_instituciones'] = $filtro_instituciones;
     $data['filtro_apoyo_estado'] = $filtro_apoyo_estado;
     $data['filtro_tipo_empresa'] = $filtro_tipo_empresa;
     $data['filtro_etapa_empresa'] = $filtro_etapa_empresa;
     $data['filtro_evento'] = $filtro_evento;
     $data['filtro_formalizacion'] = $filtro_formalizacion;
     $data['filtro_rubro'] = $filtro_rubro;
     $data['filtro_req_especial'] = $filtro_req_especial;
     $data['title'] = 'Resultados de Búsqueda';
     $data['content'] = 'busqueda/resultado_v2';
     $template = $empresa ? 'template_emprendete_v2' : 'template_v2';
     $this->load->view($template, $data);
 }
Ejemplo n.º 7
0
<?php

$this->pageTitle = Yii::app()->name . ' - Dashboard';
?>

<?php 
$this->widget('zii.widgets.jui.CJuiAccordion', array('panels' => array('Recent Comments' => $this->renderPartial('_list', array('items' => Comment::model()->recent()->findAll()), true), 'LMDB Popular Movies' => $this->renderPartial('_list', array('items' => Movie::model()->popular()->findAll()), true), 'Top Public Movies' => $this->renderPartial('_list', array('items' => MovieAttributes::model()->top()->findAll()), true), 'Recent Added Movies' => $this->renderPartial('_list', array('items' => Movie::model()->recent()->findAll()), true), 'Recent Searches' => $this->renderPartial('_list', array('items' => SearchLog::model()->recent()->findAll()), true)), 'options' => array('animated' => 'bounceslide')));
Ejemplo n.º 8
0
 /**
  * The result will contain at least the following:
  *      Matches - SS_List of results
  *      TotalMatches - total # of results, unlimited
  *      Query - query string
  * Also saves a log record.
  *
  * @param array $vars
  * @param bool $logSearch [optional]
  * @param bool $useFacets [optional]
  * @param int $start [optional]
  * @param int $limit [optional]
  * @return ArrayData
  */
 public function search(array $vars, $logSearch = true, $useFacets = true, $start = -1, $limit = -1)
 {
     $qs_q = $this->config()->get('qs_query');
     $qs_f = $this->config()->get('qs_filters');
     $qs_ps = $this->config()->get('qs_parent_search');
     $qs_t = $this->config()->get('qs_title');
     $qs_sort = $this->config()->get('qs_sort');
     if ($limit < 0) {
         $limit = $this->config()->get('page_size');
     }
     if ($start < 0) {
         $start = !empty($vars['start']) ? (int) $vars['start'] : 0;
     }
     // as far as i can see, fulltextsearch hard codes 'start'
     $facets = $useFacets ? $this->config()->get('facets') : array();
     if (!is_array($facets)) {
         $facets = array();
     }
     if (empty($limit)) {
         $limit = -1;
     }
     // figure out and scrub the sort
     $sortOptions = $this->config()->get('sort_options');
     $sort = !empty($vars[$qs_sort]) ? $vars[$qs_sort] : '';
     if (!isset($sortOptions[$sort])) {
         $sort = current(array_keys($sortOptions));
     }
     // figure out and scrub the filters
     $filters = !empty($vars[$qs_f]) ? FacetHelper::inst()->scrubFilters($vars[$qs_f]) : array();
     // do the search
     $keywords = !empty($vars[$qs_q]) ? $vars[$qs_q] : '';
     if ($keywordRegex = $this->config()->get('keyword_filter_regex')) {
         $keywords = preg_replace($keywordRegex, '', $keywords);
     }
     $results = self::adapter()->searchFromVars($keywords, $filters, $facets, $start, $limit, $sort);
     // massage the results a bit
     if (!empty($keywords) && !$results->hasValue('Query')) {
         $results->Query = $keywords;
     }
     if (!empty($filters) && !$results->hasValue('Filters')) {
         $results->Filters = new ArrayData($filters);
     }
     if (!$results->hasValue('Sort')) {
         $results->Sort = $sort;
     }
     if (!$results->hasValue('TotalMatches')) {
         $results->TotalMatches = $results->Matches->hasMethod('getTotalItems') ? $results->Matches->getTotalItems() : $results->Matches->count();
     }
     // for some types of facets, update the state
     if ($results->hasValue('Facets')) {
         FacetHelper::inst()->transformHierarchies($results->Facets);
         FacetHelper::inst()->updateFacetState($results->Facets, $filters);
     }
     // make a hash of the search so we can know if we've already logged it this session
     $loggedFilters = !empty($filters) ? json_encode($filters) : null;
     $loggedQuery = strtolower($results->Query);
     //		$searchHash    = md5($loggedFilters . $loggedQuery);
     //		$sessSearches  = Session::get('loggedSearches');
     //		if (!is_array($sessSearches)) $sessSearches = array();
     //		Debug::dump($searchHash, $sessSearches);
     // save the log record
     if ($start == 0 && $logSearch && (!empty($keywords) || !empty($filters))) {
         // && !in_array($searchHash, $sessSearches)) {
         $log = SearchLog::create(array('Query' => $loggedQuery, 'Title' => !empty($vars[$qs_t]) ? $vars[$qs_t] : '', 'Link' => Controller::curr()->getRequest()->getURL(true), 'NumResults' => $results->TotalMatches, 'MemberID' => Member::currentUserID(), 'Filters' => $loggedFilters, 'ParentSearchID' => !empty($vars[$qs_ps]) ? $vars[$qs_ps] : 0));
         $log->write();
         $results->SearchLogID = $log->ID;
         $results->SearchBreadcrumbs = $log->getBreadcrumbs();
         //			$sessSearches[] = $searchHash;
         //			Session::set('loggedSearches', $sessSearches);
     }
     return $results;
 }
Ejemplo n.º 9
0
 private function logSearchQuery($query)
 {
     $query = strtolower($query);
     $searchLog = $this->session->get('searchLog', array());
     if (!isset($searchLog[$query])) {
         $log = SearchLog::getNewInstance($query);
         $log->ip->set($this->request->getIPLong());
         $log->save();
         $searchLog[$query] = true;
         $this->session->set('searchLog', $searchLog);
     }
 }
Ejemplo n.º 10
0
}
$arrLogs = array(0 => "/var/log/maillog", 1 => "/var/log/maillog.1", 2 => "/var/log/maillog.2", 3 => "/var/log/maillog.3");
$debug = true;
$argError = false;
$date = date("Y/m/d/H");
$date = explode("/", $date);
$argYear = $date[0];
$argMonth = $date[1];
$argDay = $date[2];
$argHour = $date[3];
wlog("The datetime is {$argYear}/{$argMonth}/{$argDay} {$argHour}" . ":00.\n");
// TODO: A quick check to si if the date is older than the log files. It could save time searching the logs contents one by one.
// TODO: Actually the datetime passed as argument is also being returned in the output. But its value is not accurate. I need to remove this key.
/* ====== MAIN PROGRAM ====== */
$arrStats = array();
$oFile = new SearchLog();
$oFile->setDebug($debug);
// The last stored timestamp.
// I am supposing that the samples will be stored in a database. So this is the last stored timestamp in the DB.
$lastStoredTS = $oFile->convert2ts($argYear, $argMonth, $argDay, $argHour);
$lastStoredTS = $lastStoredTS - 2 * 60 * 60;
//Se le resta 1 hora para que muestre desde la hora que ingrese
$storeDay = false;
$storeMonth = false;
if (($argDay == "01" || $argDay == "16") && $argHour == "00") {
    $storeMonth = true;
}
if ($argHour % 6 == 0) {
    $storeDay = true;
}
// The foreach funcion always starts in the right order? I need it to iterate from index 0 to index n+1
 public function sourceRecords($params, $sort, $limit)
 {
     return SearchLog::get();
 }