Skip to content
Snippets Groups Projects
Commit dab4f5e5 authored by ribeaudc's avatar ribeaudc
Browse files

[LMS-634] add: - Experiment attachments are searchable.

SVN: 9006
parent eb3badd5
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,10 @@ import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.hibernate.annotations.Type;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FieldBridge;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Store;
import org.hibernate.validator.NotNull;
import ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants;
......@@ -66,7 +69,7 @@ public class AttachmentContentPE implements Serializable
@Column(name = ColumnNames.VALUE_COLUMN, updatable = false)
@NotNull(message = ValidationMessages.VALUE_NOT_NULL_MESSAGE)
@Type(type = "org.springframework.orm.hibernate3.support.BlobByteArrayType")
@FieldBridge(impl = ByteArrayBridge.class)
@Field(bridge = @FieldBridge(impl = ByteArrayBridge.class), index = Index.TOKENIZED, store = Store.NO)
public byte[] getValue()
{
return value;
......
......@@ -282,6 +282,7 @@ public class ExperimentPE implements IEntityPropertiesHolder<ExperimentPropertyP
}
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "parent")
@IndexedEmbedded
@Private
public Set<AttachmentPE> getExperimentAttachments()
{
......
......@@ -47,6 +47,13 @@ public enum SearchableEntity
},
EXPERIMENT("Experiment")
{
private final String[] getAttachmentFields()
{
return new String[]
{ "experimentAttachments.attachmentContent.value" };
}
//
// SearchableEntity
//
......@@ -60,8 +67,8 @@ public enum SearchableEntity
@Override
public final String[] getFields()
{
return (String[]) ArrayUtils.addAll(getStandardFields(), getPropertyFields(name()
.toLowerCase()));
return (String[]) ArrayUtils.addAll(ArrayUtils.addAll(getStandardFields(),
getPropertyFields(name().toLowerCase())), getAttachmentFields());
}
},
MATERIAL("Material")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment