Class ChangeDocumentIndexPolicy
- java.lang.Object
-
- com.atlassian.confluence.internal.search.ChangeDocumentIndexPolicy
-
@LuceneIndependent public class ChangeDocumentIndexPolicy extends Object
Policy that defines whatSearchable
s should be indexed as change documents.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ChangeDocumentIndexPolicy.PolicyCheckResult
-
Constructor Summary
Constructors Constructor Description ChangeDocumentIndexPolicy()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ChangeDocumentIndexPolicy.PolicyCheckResult
buildFor(Searchable searchable)
Defines the conditions which must be met before a change document will be constructed for the specified searchable.static boolean
shouldIndex(Searchable searchable)
Returns true if this searchable should be indexed as a change, false otherwise.static boolean
shouldUnIndex(Searchable searchable)
Whether we should unindex this searchable.
-
-
-
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:
- Must be instanceof
ContentTypeAware
- Must be a Page, BlogPost, Comment, Attachment, PersonalInformation, SpaceDescription, UserStatus.
- If
Versioned
, the latest version must return true forSearchable.isIndexable()
.
- Parameters:
searchable
- the searchable- Returns:
- the policy check result
- Must be instanceof
-
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.
-
-