org.apache.ignite.spi.indexing

## Interface IndexingSpi

All Superinterfaces:
  IgniteSpi

All Known Implementing Classes:
  NoopIndexingSpi

    public interface IndexingSpi
    extends IgniteSpi

Indexing SPI allows user to index cache content. Using indexing SPI user can index data in cache and run Usually cache name will be used as space name, so multiple caches can write to single indexing SPI instance.

NOTE: this SPI (i.e. methods in this interface) should never be used directly. SPIs provide internal view on the subsystem and is used internally by Ignite kernal. In rare use cases when access to a specific implementation of this SPI is required - an instance of this SPI can be obtained via `Ignite.configuration()` method to check its configuration properties or call other non-SPI methods. Note again that calling methods from this interface on the obtained instance can lead to undefined behavior and explicitly not supported. Here is a Java example on how to configure SPI.

     IndexingSpi spi = new MyIndexingSpi();

     IgniteConfiguration cfg = new IgniteConfiguration();

     // Overrides default indexing SPI.
     cfg.setIndexingSpi(spi);

     // Starts grid.
     Ignition.start(cfg);

Here is an example of how to configure SPI from Spring XML configuration file.

     <property name="indexingSpi">
         <bean class="com.example.MyIndexingSpi">
         </bean>
     </property>

For information about Spring framework visit www.springframework.org

### Method Summary

Methods
`void` `onSwap(String spaceName, Object key)` Will be called when entry with given key is swapped.
`void` `onUnswap(String spaceName, Object key, Object val)` Will be called when entry with given key is unswapped.
`Iterator<javax.cache.Cache.Entry<?,?>>` `query(String spaceName, Collection<Object> params, IndexingQueryFilter filters)` Executes query.
`void` `remove(String spaceName, Object key)` Removes index entry by key.
`void` `store(String spaceName, Object key, Object val, long expirationTime)` Updates index.

### Methods inherited from interface org.apache.ignite.spi.IgniteSpi

`getName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized, spiStart, spiStop`

### Method Detail

#### query

    Iterator<javax.cache.Cache.Entry<?,?>> query(@Nullable
                                               String spaceName,
                                               Collection<Object> params,
                                               @Nullable
                                               IndexingQueryFilter filters)
                                                 throws IgniteSpiException

Executes query.

Parameters:
  `spaceName` - Space name.
  `params` - Query parameters.
  `filters` - System filters.
Returns:
  Query result. If the iterator implements `AutoCloseable` it will be correctly closed.
Throws:
  `IgniteSpiException` - If failed.

#### store

    void store(@Nullable
             String spaceName,
             Object key,
             Object val,
             long expirationTime)
               throws IgniteSpiException

Updates index. Note that key is unique for space, so if space contains multiple indexes the key should be removed from indexes other than one being updated.

Parameters:
  `spaceName` - Space name.
  `key` - Key.
  `val` - Value.
  `expirationTime` - Expiration time or 0 if never expires.
Throws:
  `IgniteSpiException` - If failed.

#### remove

    void remove(@Nullable
              String spaceName,
              Object key)
                throws IgniteSpiException

Removes index entry by key.

Parameters:
  `spaceName` - Space name.
  `key` - Key.
Throws:
  `IgniteSpiException` - If failed.

#### onSwap

    void onSwap(@Nullable
              String spaceName,
              Object key)
                throws IgniteSpiException

Will be called when entry with given key is swapped.

Parameters:
  `spaceName` - Space name.
  `key` - Key.
Throws:
  `IgniteSpiException` - If failed.

#### onUnswap

    void onUnswap(@Nullable
                String spaceName,
                Object key,
                Object val)
                  throws IgniteSpiException

Will be called when entry with given key is unswapped.

Parameters:
  `spaceName` - Space name.
  `key` - Key.
  `val` - Value.
Throws:
  `IgniteSpiException` - If failed.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.7.0
Release Date | : August 1 2016