You are here

public function BlockedUsers::preprocessSearchQuery in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::preprocessSearchQuery()
  2. 8.2 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::preprocessSearchQuery()
  3. 8.3 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::preprocessSearchQuery()
  4. 8.4 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::preprocessSearchQuery()
  5. 8.5 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::preprocessSearchQuery()
  6. 8.6 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::preprocessSearchQuery()
  7. 8.7 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::preprocessSearchQuery()
  8. 8.8 modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::preprocessSearchQuery()
  9. 10.3.x modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::preprocessSearchQuery()
  10. 10.0.x modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::preprocessSearchQuery()
  11. 10.1.x modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::preprocessSearchQuery()
  12. 10.2.x modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php \Drupal\social_search\Plugin\search_api\processor\BlockedUsers::preprocessSearchQuery()

Preprocesses a search query.

Parameters

\Drupal\search_api\Query\QueryInterface $query: The object representing the query to be executed.

Overrides ProcessorPluginBase::preprocessSearchQuery

File

modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php, line 65

Class

BlockedUsers
Ignores blocked users in index and queries.

Namespace

Drupal\social_search\Plugin\search_api\processor

Code

public function preprocessSearchQuery(QueryInterface $query) {
  if (!$query
    ->getOption('search_api_bypass_access')) {

    // Add a condition to filter out users through the status field.
    $conditions = $query
      ->createConditionGroup('AND');
    $conditions
      ->addCondition('user_status', 0, '<>');

    // Add the conditions.
    $query
      ->addConditionGroup($conditions);
  }
}