[hibernate-dev] HSEARCH-471 Ability to selectively index an entity based on its state

Emmanuel Bernard emmanuel at hibernate.org
Fri Jan 14 08:24:07 EST 2011


On 14 janv. 2011, at 13:47, Hardy Ferentschik wrote:

> On Fri, 14 Jan 2011 11:33:25 +0100, Sanne Grinovero  
> <sanne.grinovero at gmail.com> wrote:
> 
>> Agreed, also there where additional similar requests recently via the
>> forums. As usual, alternatives where found but we should make this
>> easier.
> 
>> * SearchFactory.enableIndexing(boolean) // enables/disables globally on  
>> the fly
>> could operate on existing boolean
>> org.hibernate.search.event.FullTextIndexEventListener.used
> 
> +1 This is something I was wishing for some time back. It should be easy
> to implement as well. This option should then also be exposed via JMX.

What's the use case behind it?

> 
> 
>> * FullTextSession.enableIndexing(boolean)
>> toggles indexing for the currently open session
> 
> I don't find this very useful. Could be skipped imo

What's the use case behind it?

> 
>> * entity controlled, via an entity-level annotation pointing to some
>> custom implementation respecting interface:
>> boolean indexingEnabled(T entity)
>> This one is more tricky, should we evaluate it twice (before and after
>> changes) to see if an index delete operation should trigger?
>> As an alternative, could it have sense to provide a more complex
>> interface which controls add/update/delete triggers prevention.
> 
> That would really be the solution for the HSEARCH-471 usecase, hence +1
> Of course we would have to settle the details.

It seems to me in the use cases we have seen so far was to minimize the numbers of indexing as an optimization. In this case, delete operations should always be applied. It's just Update that is impacted (maybe insert).

> 
>> * entity controlled, via an annotated boolean property
>> I'd mandate a boolean property, or something which can be easily
>> evaluated via a SQL fragment / Criteria / filterable, so that the same
>> information could be reused
>> by the MassIndexer when picking all values to be indexed.
> 
> Not sure I understand exactly what you mean.

@Entity @Indexed
public class MyEntity {
  ...

  @SkipIndexing
  boolean isIndexed() {
     return status == TEMP;
  }
}

> 
> --Hardy
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev





More information about the hibernate-dev mailing list