I'm not able to understand the use and role of the node_access tag. I used the Node View permission module to restrict the access to the article content type for anonymous users.
Now I have created an auto-complete search box that searches node titles. This is the query I used.
$query = \Drupal::entityquery('node');
$query->condition('title', trim($search));
$query->condition('status', 1);
$query->addTag('node_access');
$nids = $query->execute();
$nodes = Node::loadMultiple($nids);
I don't want this search box to search titles that belong to the article content type, and I used the node_access tag.
Will this tag serves my purpose here or is there any other approach to achieve the same?