original_string: public function operatorterm(Query $query, TokenInterface $token)
      {
          $terms = explode(',', strtolower($token->value()));
          $conjunction = $token->negated() ? 'NOT IN' : 'IN';
  
          if (empty($terms)) {
              return $query;
          }
  
          $conditions = [
              "Contents.id {$conjunction}" => TableRegistry::get('Taxonomy.EntitiesTerms')
                  ->find()
                  ->select(['EntitiesTerms.entity_id'])
                  ->where(['EntitiesTerms.table_alias' => $this->alias()])
                  ->matching('Terms', function ($q) use ($terms) {
                      return $q->where(['Terms.slug IN' => $terms]);
                  })
          ];
  
          if (!empty($conditions)) {
              if ($token->where() === 'or') {
                  $query->orWhere($conditions);
              } elseif ($token->where() === 'and') {
                  $query->andWhere($conditions);
              } else {
                  $query->where($conditions);
              }
          }
  
          return $query;
      }
code: public function operatorterm(Query $query, TokenInterface $token)
      {
          $terms = explode(',', strtolower($token->value()));
          $conjunction = $token->negated() ? 'NOT IN' : 'IN';
  
          if (empty($terms)) {
              return $query;
          }
  
          $conditions = [
              "Contents.id {$conjunction}" => TableRegistry::get('Taxonomy.EntitiesTerms')
                  ->find()
                  ->select(['EntitiesTerms.entity_id'])
                  ->where(['EntitiesTerms.table_alias' => $this->alias()])
                  ->matching('Terms', function ($q) use ($terms) {
                      return $q->where(['Terms.slug IN' => $terms]);
                  })
          ];
  
          if (!empty($conditions)) {
              if ($token->where() === 'or') {
                  $query->orWhere($conditions);
              } elseif ($token->where() === 'and') {
                  $query->andWhere($conditions);
              } else {
                  $query->where($conditions);
              }
          }
  
          return $query;
      }
code_tokens: public function operatorterm ( Query $ query , TokenInterface $ token ) { $ terms = explode ( ',' , strtolower ( $ token -> value ( ) ) ) ; $ conjunction = $ token -> negated ( ) ? 'NOT IN' : 'IN' ; if ( empty ( $ terms ) ) { return $ query ; } $ conditions = [ "Contents.id {$conjunction}" => TableRegistry :: get ( 'Taxonomy.EntitiesTerms' ) -> find ( ) -> select ( [ 'EntitiesTerms.entity_id' ] ) -> where ( [ 'EntitiesTerms.table_alias' => $ this -> alias ( ) ] ) -> matching ( 'Terms' , function ( $ q ) use ( $ terms ) { return $ q -> where ( [ 'Terms.slug IN' => $ terms ] ) ; } ) ] ; if ( ! empty ( $ conditions ) ) { if ( $ token -> where ( ) === 'or' ) { $ query -> orWhere ( $ conditions ) ; } elseif ( $ token -> where ( ) === 'and' ) { $ query -> andWhere ( $ conditions ) ; } else { $ query -> where ( $ conditions ) ; } } return $ query ; }
docstring: Handles "term" search operator.
  
  term:term1-slug,term2-slug,...
  
  @param \Cake\ORM\Query $query The query object
  @param \Search\Parser\TokenInterface $token Operator token
  @return \Cake\ORM\Query
docstring_tokens: Handles term search operator .