original_string: protected function _scopeWords(Query $query, TokenInterface $token)
      {
          if ($this->_isFullTextEnabled()) {
              return $this->_scopeWordsInFulltext($query, $token);
          }
  
          $like = 'LIKE';
          if ($token->negated()) {
              $like = 'NOT LIKE';
          }
  
          // * Matches any one or more characters.
          // ! Matches any single character.
          $value = str_replace(['*', '!'], ['%', '_'], $token->value());
  
          if ($token->where() === 'or') {
              $query->orWhere(["SearchDatasets.words {$like}" => "%{$value}%"]);
          } elseif ($token->where() === 'and') {
              $query->andWhere(["SearchDatasets.words {$like}" => "%{$value}%"]);
          } else {
              $query->where(["SearchDatasets.words {$like}" => "%{$value}%"]);
          }
  
          return $query;
      }
code: protected function _scopeWords(Query $query, TokenInterface $token)
      {
          if ($this->_isFullTextEnabled()) {
              return $this->_scopeWordsInFulltext($query, $token);
          }
  
          $like = 'LIKE';
          if ($token->negated()) {
              $like = 'NOT LIKE';
          }
  
          // * Matches any one or more characters.
          // ! Matches any single character.
          $value = str_replace(['*', '!'], ['%', '_'], $token->value());
  
          if ($token->where() === 'or') {
              $query->orWhere(["SearchDatasets.words {$like}" => "%{$value}%"]);
          } elseif ($token->where() === 'and') {
              $query->andWhere(["SearchDatasets.words {$like}" => "%{$value}%"]);
          } else {
              $query->where(["SearchDatasets.words {$like}" => "%{$value}%"]);
          }
  
          return $query;
      }
code_tokens: protected function _scopeWords ( Query $ query , TokenInterface $ token ) { if ( $ this -> _isFullTextEnabled ( ) ) { return $ this -> _scopeWordsInFulltext ( $ query , $ token ) ; } $ like = 'LIKE' ; if ( $ token -> negated ( ) ) { $ like = 'NOT LIKE' ; } // * Matches any one or more characters. // ! Matches any single character. $ value = str_replace ( [ '*' , '!' ] , [ '%' , '_' ] , $ token -> value ( ) ) ; if ( $ token -> where ( ) === 'or' ) { $ query -> orWhere ( [ "SearchDatasets.words {$like}" => "%{$value}%" ] ) ; } elseif ( $ token -> where ( ) === 'and' ) { $ query -> andWhere ( [ "SearchDatasets.words {$like}" => "%{$value}%" ] ) ; } else { $ query -> where ( [ "SearchDatasets.words {$like}" => "%{$value}%" ] ) ; } return $ query ; }
docstring: Scopes the given query using the given words token.
  
  @param \Cake\ORM\Query $query The query to scope
  @param \Search\TokenInterface $token Token describing a words sequence. e.g `this is a phrase`
  @return \Cake\ORM\Query Scoped query
docstring_tokens: Scopes the given query using the given words token .