Hi all,
I'm looking for a way to efficiently purge a subset of entities from the index.
Here is my entity class:
Code:
@Entity
@Table(name = "CONVERSION_ERROR")
@Indexed(index = "ConversionError")
public class ConversionError extends SimpleVersionedObject {
/**
*
*/
private static final long serialVersionUID = 1L;
@Field(analyze = Analyze.NO, store = Store.YES)
private final Long viewId;
@Field(analyze = Analyze.NO)
private final Long attributeId;
@Column(nullable = true)
@Fields({ @Field(analyze = Analyze.NO, store = Store.YES),
@Field(name = "value_forSearch", analyze = Analyze.YES, store = Store.YES) })
private final String value;
@Field(analyze = Analyze.NO)
@org.hibernate.annotations.Index(name = "CONV_ERROR_SYS_IDX")
private final Long systemId;
@Field(analyze = Analyze.NO)
@org.hibernate.annotations.Index(name = "CONV_ERROR_ATT_DEF_IDX")
private final Long attributeDefinitionId;
@Field(analyze = Analyze.NO)
@org.hibernate.annotations.Index(name = "CONV_ERROR_MAP_DEF_ID")
private final Long mappingDefinitionId;
....
My table contains around 1M entries. I want to be able to delete all the ConversionError objects that have the property mappingDefinitionId set to a specific value.
My understanding as of today is that the only two options available to me at the FullTextEntityManager level (I use JPA) are:
public <T> void purgeAll(Class<T> entityType);
and
public <T> void purge(Class<T> entityType, Serializable id);
Obviously purgeAll is not what I want. However, calling purge on 500k objects yield disastrous performance as 500k units of work are going to be executed.
Is there any other way to instruct hibernate search to purge the objects resulting for a term query?
Thanks for your feedback.