Class BaseAttachmentContentExtractor
- java.lang.Object
-
- com.atlassian.confluence.search.v2.extractor.BaseAttachmentContentExtractor
-
- All Implemented Interfaces:
Extractor2
- Direct Known Subclasses:
LimitedTextContentExtractor
public abstract class BaseAttachmentContentExtractor extends Object implements Extractor2
A base template for attachment content extractors to extend.- Since:
- 7.17
-
-
Constructor Summary
Constructors Constructor Description BaseAttachmentContentExtractor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Collection<FieldDescriptor>
extractFields(Object searchable)
Extract fields from the searchable object.protected @NonNull Optional<CharSequence>
extractText(SearchableAttachment attachment)
protected abstract String
extractText(InputStream is, SearchableAttachment attachment)
StringBuilder
extractText(Object searchable)
Returns a buffer of text that will be appended onto the end of a larger buffer of text that will eventually become the searchable body text.protected abstract boolean
shouldExtractFrom(String fileName, String contentType)
-
-
-
Method Detail
-
extractText
protected @NonNull Optional<CharSequence> extractText(SearchableAttachment attachment)
-
extractFields
public Collection<FieldDescriptor> extractFields(Object searchable)
Description copied from interface:Extractor2
Extract fields from the searchable object.- Specified by:
extractFields
in interfaceExtractor2
- Parameters:
searchable
- a searchable object- Returns:
- list of fields extracted from the searchable object
-
extractText
public StringBuilder extractText(Object searchable)
Description copied from interface:Extractor2
Returns a buffer of text that will be appended onto the end of a larger buffer of text that will eventually become the searchable body text.- Specified by:
extractText
in interfaceExtractor2
- Parameters:
searchable
- a searchable object- Returns:
- Returns a buffer of text that will be appended onto the end of a larger buffer of text that will eventually become the searchable body text.
-
shouldExtractFrom
protected abstract boolean shouldExtractFrom(String fileName, String contentType)
-
extractText
protected abstract String extractText(InputStream is, SearchableAttachment attachment)
- Parameters:
is
- a stream containing the attachment contentsattachment
- contains useful attachment metadata, e.g. filename- Returns:
- a String with a textual representation of the attachment's contents
-
-