Este conteúdo não está disponível no idioma selecionado.
6.2. Purging
It is equally possible to remove an entity or all entities of a given type from a Lucene index without the need to physically remove them from the database. This operation is named purging and is also done through the
FullTextSession.
Example 6.3. Purging a specific instance of an entity from the index
Purging will remove the entity with the given id from the Lucene index but will not touch the database.
If you need to remove all entities of a given type, you can use the
purgeAll method. This operation remove all entities of the type passed as a parameter as well as all its subtypes.
Example 6.4. Purging all instances of an entity from the index
It is recommended to optimize the index after such an operation.
Note
Methods
index, purge and purgeAll are available on FullTextEntityManager as well.