Class ChangeDocumentIndexPolicy

    • Constructor Detail

      • ChangeDocumentIndexPolicy

        public ChangeDocumentIndexPolicy()
    • Method Detail

      • buildFor

        public static ChangeDocumentIndexPolicy.PolicyCheckResult buildFor​(Searchable searchable)
        Defines the conditions which must be met before a change document will be constructed for the specified searchable.

        These are:

        Parameters:
        searchable - the searchable
        Returns:
        the policy check result
      • shouldIndex

        public static boolean shouldIndex​(Searchable searchable)
        Returns true if this searchable should be indexed as a change, false otherwise.
        Parameters:
        searchable - the searchable
        Returns:
        true if this searchable should be indexed as a change, false otherwise.
      • shouldUnIndex

        public static boolean shouldUnIndex​(Searchable searchable)
        Whether we should unindex this searchable. The condition to unindex a searchable is more lenient than indexing, as our main objective here is to ensure we are queuing a list of unindex jobs that make sense. It is sufficient in this case to just check that changes are indexed for the persistent class of the searchable. (The criteria we use for indexing a searchable cannot be re-used for unindexing, since the deletion of a searchable may change its state causing it to fail this criteria. Failing our indexing criteria is no reason at all to not unindex.
        Parameters:
        searchable - the searchable
        Returns:
        true if we should unindex this searchable, false otherwise.