Exclude node from search API results based on values in existing fields My content node includes a verified checkbox that's marked by a human reviewer who then also enters a date. The node is verified only when the box is checked and the date is entered. A content node may be published before it is verified.

How can I keep an unverified content node from appearing in search API results?

One solution is to add a search API exclude entity field to the content node and to set the value of the exclude field in a presave hook based on the verified checkbox and date. This isn't difficult, but it seems there should be a more straightforward way of accomplishing what's needed.

I've looked at modules, but those I've seen don't seem to fit the need. I imagine I'm just missing something obvious, but what is it?

I don't think it's relevant, but I'll mention that I'm using Solr search.
Given no alternative answers, I solved this problem by


installing the Search API Exclude Entity module
adding a field of type Search API Exclude Entity named search_exclude to the content node
adding the following to my custom rsc module

function rsc_node_presave(EntityInterface $node) {
  switch ($node-&gt;getType()) {
    case 'content':
      $node-&gt;field_search_exclude-&gt;value = &lt;conditions to exclude node&gt;;
      break;
  }
}

going to /admin/config/search/search-api/index/default_solr_index/processors
checking the Search API Exclude Entity box
selecting the Search API Exclude Entity tab at the bottom of the page
checking the field_search_exclude (content) box
reindexing the content


Seems to be working well. When unverified nodes are saved, the search_exclude field is set and that keeps the nodes out of the search results.