original_string: public function search($criteria)
      {
          $this->loadModel('Content.Contents');
  
          try {
              $contents = $this->Contents->search($criteria);
              if ($contents->clause('limit')) {
                  $this->paginate['limit'] = $contents->clause('limit');
              }
  
              // TO-DO: ask search-engine for operator presence
              if (strpos($criteria, 'language:') === false) {
                  $contents = $contents->where([
                      'Contents.status >' => 0,
                      'Contents.language IN' => ['', null, I18n::locale()] // any or concrete
                  ]);
              }
  
              $contents = $this->paginate($contents);
          } catch (\Exception $e) {
              $contents = new Collection([]);
          }
  
          $this->set(compact('contents', 'criteria'));
          $this->viewMode('search-result');
      }
code: public function search($criteria)
      {
          $this->loadModel('Content.Contents');
  
          try {
              $contents = $this->Contents->search($criteria);
              if ($contents->clause('limit')) {
                  $this->paginate['limit'] = $contents->clause('limit');
              }
  
              // TO-DO: ask search-engine for operator presence
              if (strpos($criteria, 'language:') === false) {
                  $contents = $contents->where([
                      'Contents.status >' => 0,
                      'Contents.language IN' => ['', null, I18n::locale()] // any or concrete
                  ]);
              }
  
              $contents = $this->paginate($contents);
          } catch (\Exception $e) {
              $contents = new Collection([]);
          }
  
          $this->set(compact('contents', 'criteria'));
          $this->viewMode('search-result');
      }
code_tokens: public function search ( $ criteria ) { $ this -> loadModel ( 'Content.Contents' ) ; try { $ contents = $ this -> Contents -> search ( $ criteria ) ; if ( $ contents -> clause ( 'limit' ) ) { $ this -> paginate [ 'limit' ] = $ contents -> clause ( 'limit' ) ; } // TO-DO: ask search-engine for operator presence if ( strpos ( $ criteria , 'language:' ) === false ) { $ contents = $ contents -> where ( [ 'Contents.status >' => 0 , 'Contents.language IN' => [ '' , null , I18n :: locale ( ) ] // any or concrete ] ) ; } $ contents = $ this -> paginate ( $ contents ) ; } catch ( \ Exception $ e ) { $ contents = new Collection ( [ ] ) ; } $ this -> set ( compact ( 'contents' , 'criteria' ) ) ; $ this -> viewMode ( 'search-result' ) ; }
docstring: Contents search engine page.
  
  @param string $criteria A search criteria. e.g.: `"this phrase" -"but not this" OR -hello`
  @return void
docstring_tokens: Contents search engine page .