org.hibernate.search.store.impl

## Class IdHashShardingStrategy

- java.lang.Object
- - org.hibernate.search.store.impl.IdHashShardingStrategy

- All Implemented Interfaces:
    IndexShardingStrategy

      public class IdHashShardingStrategy
      extends Object
      implements IndexShardingStrategy

  This implementation use idInString as the hashKey.
  Author:
    Emmanuel Bernard

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IdHashShardingStrategy()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `IndexManager` | `getIndexManagerForAddition(Class<?> entity, Serializable id, String idInString, Document document)`
    `IndexManager[]` | `getIndexManagersForAllShards()` Ask for all shards (eg to query or optimize)
    `IndexManager[]` | `getIndexManagersForDeletion(Class<?> entity, Serializable id, String idInString)` return the IndexManager(s) where the given entity is stored and where the deletion operation needs to be applied id and idInString could be null.
    `IndexManager[]` | `getIndexManagersForQuery(FullTextFilterImplementor[] fullTextFilters)` return the set of IndexManager(s) where the entities matching the filters are stored this optional optimization allows queries to hit a subset of all shards, which may be useful for some datasets if this optimization is not needed, return getIndexManagersForAllShards()
    `void` | `initialize(Properties properties, IndexManager[] indexManagers)` provides access to sharding properties (under the suffix sharding_strategy) and provide access to all the IndexManager for a given index

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### IdHashShardingStrategy

          public IdHashShardingStrategy()

  - ### Method Detail

    - #### initialize

          public void initialize(Properties properties,
                                 IndexManager[] indexManagers)

      Description copied from interface: `IndexShardingStrategy`
      provides access to sharding properties (under the suffix sharding_strategy) and provide access to all the IndexManager for a given index
      Specified by:
        `initialize` in interface `IndexShardingStrategy`
      Parameters:
        `properties` - configuration properties
        `indexManagers` - array of `IndexManager`

    - #### getIndexManagersForAllShards

          public IndexManager[] getIndexManagersForAllShards()

      Description copied from interface: `IndexShardingStrategy`
      Ask for all shards (eg to query or optimize)
      Specified by:
        `getIndexManagersForAllShards` in interface `IndexShardingStrategy`
      Returns:
        all the `IndexManager` for all shards

    - #### getIndexManagerForAddition

          public IndexManager getIndexManagerForAddition(Class<?> entity,
                                                         Serializable id,
                                                         String idInString,
                                                         Document document)

      Specified by:
        `getIndexManagerForAddition` in interface `IndexShardingStrategy`
      Parameters:
        `entity` - the type of the entity
        `id` - the id in object form
        `idInString` - the id as transformed by the used TwoWayStringBridge
        `document` - the document to index
      Returns:
        the IndexManager where the given entity will be indexed

    - #### getIndexManagersForDeletion

          public IndexManager[] getIndexManagersForDeletion(Class<?> entity,
                                                            Serializable id,
                                                            String idInString)

      Description copied from interface: `IndexShardingStrategy`
      return the IndexManager(s) where the given entity is stored and where the deletion operation needs to be applied id and idInString could be null. If null, all the IndexManagers containing entity types should be returned
      Specified by:
        `getIndexManagersForDeletion` in interface `IndexShardingStrategy`
      Parameters:
        `entity` - the type of the deleted entity
        `id` - the id in object form
        `idInString` - the id as transformed by the used TwoWayStringBridge
      Returns:
        the `IndexManager`(s) where the given entity is stored

    - #### getIndexManagersForQuery

          public IndexManager[] getIndexManagersForQuery(FullTextFilterImplementor[] fullTextFilters)

      Description copied from interface: `IndexShardingStrategy`
      return the set of IndexManager(s) where the entities matching the filters are stored this optional optimization allows queries to hit a subset of all shards, which may be useful for some datasets if this optimization is not needed, return getIndexManagersForAllShards()
      Specified by:
        `getIndexManagersForQuery` in interface `IndexShardingStrategy`
      Parameters:
        `fullTextFilters` - can be empty if no filter is applied
      Returns:
        the set of `IndexManager`(s) where the entities matching the filters are stored

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved