Uploaded image for project: 'Hibernate Search'
  1. HSEARCH-1767

Multiple entity types sharing the index shouldn't necessarily prevent single-term deletions


    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.1.0.Final
    • Component/s: engine
    • Labels:


      As a follow up of discussions on https://issues.jboss.org/browse/ISPN-5103 : performance analysis in Infinispan highlighted that there is a significant performance benefit in enabling single-term delete rather than a query-based delete.

      We already were aware of this and Hibernate Search will apply the better performing single-term delete operations (and update operations) when safe, but the definition of "when safe" is very conservative.

      Currently the optimisation is only enabled when both of these are true:

      • org.hibernate.search.indexes.impl.PropertiesParseHelper.isIndexMetadataComplete(Properties, WorkerBuildContext) returns true (the default but can be configured otherwise)
      • there is a single type in the index (the IndexManager owns only one entity type)

      In reality even if the IndexManager were to contain multiple types, this would be safe as long as we can guarantee that no type has an ambiguity on the keyword used for the ID encoding.
      Some cases in which this is actually possible to figure out:

      1. there are multiple types but they are mapped in an inheritance mode on ORM, which would force them to have a unique ID across different instance types
      2. all types sharing the index have field bridges on the primary ID which would necessarily result in incompatible encodings

      The second case might be complex to hit in practice (or just complex to evaluate), but I think the first case is probably the most common reason for one to possibly have multiple types sharing the same index, so that would be a great enhancement.




            • Assignee:
              emmanuel Emmanuel Bernard
              sanne Sanne Grinovero
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created: