org.xwiki.search.solr.internal.metadata
Class AttachmentSolrMetadataExtractor
java.lang.Object
org.xwiki.search.solr.internal.metadata.AbstractSolrMetadataExtractor
org.xwiki.search.solr.internal.metadata.AttachmentSolrMetadataExtractor
- All Implemented Interfaces:
- SolrMetadataExtractor
@Component
@Named(value="attachment")
public class AttachmentSolrMetadataExtractor
- extends AbstractSolrMetadataExtractor
Extract the metadata to be indexed from attachments.
- Since:
- 4.3M2
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AttachmentSolrMetadataExtractor
public AttachmentSolrMetadataExtractor()
getSolrDocument
public SolrInputDocument getSolrDocument(EntityReference entityReference)
throws SolrIndexException,
IllegalArgumentException
- Description copied from interface:
SolrMetadataExtractor
- Extract data from an XWiki entity and wrap it into a
SolrInputDocument
that is indexable by Solr.
- Parameters:
entityReference
- the reference to the entity.
- Returns:
- the
SolrInputDocument
containing the fields to be indexed for the entity.
- Throws:
SolrIndexException
- if problems occur.
IllegalArgumentException
- if the passed reference is not supported by the current implementation.
addLanguageAndContentFields
protected void addLanguageAndContentFields(DocumentReference documentReference,
SolrInputDocument solrDocument,
AttachmentReference attachmentReference)
throws Exception
- Set the language to all the translations that the owning document has. This ensures that this entity is found for
all the translations of a document, not just the original document.
Also, index the content with each language so that the right analyzer is used.
- Parameters:
documentReference
- the original document's reference.solrDocument
- the Solr document where to add the fields.attachmentReference
- the attachment's reference.
- Throws:
Exception
- if problems occur.
getContentAsText
protected String getContentAsText(AttachmentReference attachment)
throws SolrIndexException
- Tries to extract text indexable content from a generic attachment.
- Parameters:
attachment
- reference to the attachment.
- Returns:
- the text representation of the attachment's content.
- Throws:
SolrIndexException
- if problems occur.
getMimeType
protected String getMimeType(AttachmentReference reference)
- Parameters:
reference
- to the attachment
- Returns:
- the mimetype of the attachment's content.