When creating ValueSets the ValueSetValidator checks whether the valueset can be indexed or not which is triggered during (re)indexing (new content, content change, full re-index triggered etc.).
The Umbraco ContentValueSetValidator implementation checks for example:
- If the path contains the parentId
- If the item is not in the recycle bin
- If the item is not protected
- etc.
These checks result in a ValueSetValidationResult which basically tells if the record should be in the index or not.
When running a custom index you can of course put the logic inside the ValueSetBuilder (I mean, the world is your oyster), but you can also create your own validator and put the logic there.
If you want to add additional checks on top of the default ContentValueSetValidator you can extend it, create an override, call the base checks that you need and add your logic on top of it!