You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2014/12/05 15:07:50 UTC

[49/52] [abbrv] incubator-ignite git commit: # Renaming

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/GridIndexingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/GridIndexingSpi.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/GridIndexingSpi.java
deleted file mode 100644
index 7c6d4c8..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/GridIndexingSpi.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.indexing;
-
-import org.apache.ignite.spi.*;
-import org.gridgain.grid.cache.*;
-import org.gridgain.grid.cache.query.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-
-/**
- * Indexing SPI allows user to index cache content. Using indexing SPI user can index data in cache and run SQL,
- * TEXT or individual field queries against these indexes. Usually indexing SPI is used by caches by name
- * (see {@link GridCacheConfiguration#getIndexingSpiName()}). Logically storage is organized into separate spaces.
- * Usually cache name will be used as space name, so multiple caches can write to single indexing SPI instance.
- * <p>
- * Functionality of this SPI is exposed to {@link GridCacheQueries} interface:
- * <ul>
- *      <li>{@link GridCacheQueries#createSqlQuery(Class, String)}</li>
- *      <li>{@link GridCacheQueries#createSqlFieldsQuery(String)}</li>
- *      <li>{@link GridCacheQueries#createFullTextQuery(Class, String)}</li>
- * </ul>
- * <p>
- * The default indexing SPI implementation is
- * {@gglink org.gridgain.grid.spi.indexing.h2.GridH2IndexingSpi} which uses H2 database engine
- * for data indexing and querying. User can implement his own indexing SPI and use his own data structures
- * and query language instead of SQL. SPI can be configured for grid using {@link org.apache.ignite.configuration.IgniteConfiguration#getIndexingSpi()}.
- * <p>
- * GridGain comes with following built-in indexing SPI implementations:
- * <ul>
- *      <li>{@gglink org.gridgain.grid.spi.indexing.h2.GridH2IndexingSpi}</li>
- * </ul>
- * <p>
- * <b>NOTE:</b> 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 GridGain 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 {@link org.apache.ignite.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.
- */
-public interface GridIndexingSpi extends IgniteSpi {
-    /**
-     * Queries individual fields (generally used by JDBC drivers).
-     *
-     * @param spaceName Space name.
-     * @param qry Query.
-     * @param params Query parameters.
-     * @param filters Space name and key filters.
-     * @return Query result.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <K, V> GridIndexingFieldsResult queryFields(@Nullable String spaceName, String qry,
-        Collection<Object> params, GridIndexingQueryFilter filters) throws IgniteSpiException;
-
-    /**
-     * Executes regular query.
-     *
-     * @param spaceName Space name.
-     * @param qry Query.
-     * @param params Query parameters.
-     * @param type Query return type.
-     * @param filters Space name and key filters.
-     * @return Queried rows.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <K, V> IgniteSpiCloseableIterator<GridIndexingKeyValueRow<K, V>> query(@Nullable String spaceName, String qry,
-        Collection<Object> params, GridIndexingTypeDescriptor type, GridIndexingQueryFilter filters)
-        throws IgniteSpiException;
-
-    /**
-     * Executes text query.
-     *
-     * @param spaceName Space name.
-     * @param qry Text query.
-     * @param type Query return type.
-     * @param filters Space name and key filter.
-     * @return Queried rows.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <K, V> IgniteSpiCloseableIterator<GridIndexingKeyValueRow<K, V>> queryText(@Nullable String spaceName, String qry,
-        GridIndexingTypeDescriptor type, GridIndexingQueryFilter filters) throws IgniteSpiException;
-
-    /**
-     * Gets size of index for given type or -1 if it is a unknown type.
-     *
-     * @param spaceName Space name.
-     * @param desc Type descriptor.
-     * @return Objects number.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public long size(@Nullable String spaceName, GridIndexingTypeDescriptor desc) throws IgniteSpiException;
-
-    /**
-     * Registers type if it was not known before or updates it otherwise.
-     *
-     * @param spaceName Space name.
-     * @param desc Type descriptor.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     * @return {@code True} if type was registered, {@code false} if for some reason it was rejected.
-     */
-    public boolean registerType(@Nullable String spaceName, GridIndexingTypeDescriptor desc) throws IgniteSpiException;
-
-    /**
-     * Unregisters type and removes all corresponding data.
-     *
-     * @param spaceName Space name.
-     * @param type Type descriptor.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public void unregisterType(@Nullable String spaceName, GridIndexingTypeDescriptor type) 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.
-     *
-     * @param spaceName Space name.
-     * @param type Value type.
-     * @param key Key.
-     * @param val Value.
-     * @param ver Version.
-     * @param expirationTime Expiration time or 0 if never expires.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <K, V> void store(@Nullable String spaceName, GridIndexingTypeDescriptor type, GridIndexingEntity<K> key,
-        GridIndexingEntity<V> val, byte[] ver, long expirationTime) throws IgniteSpiException;
-
-    /**
-     * Removes index entry by key.
-     *
-     * @param spaceName Space name.
-     * @param key Key.
-     * @return {@code True} if removed by this operation, {@code false} otherwise.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <K> boolean remove(@Nullable String spaceName, GridIndexingEntity<K> key) throws IgniteSpiException;
-
-    /**
-     * Will be called when entry with given key is swapped.
-     *
-     * @param spaceName Space name.
-     * @param swapSpaceName Swap space name.
-     * @param key Key.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <K> void onSwap(@Nullable String spaceName, String swapSpaceName, K key) throws IgniteSpiException;
-
-    /**
-     * Will be called when entry with given key is unswapped.
-     *
-     * @param spaceName Space name.
-     * @param key Key.
-     * @param val Value.
-     * @param valBytes Value bytes.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <K, V> void onUnswap(@Nullable String spaceName, K key, V val, byte[] valBytes) throws IgniteSpiException;
-
-    /**
-     * Marshaller to be used by SPI.
-     *
-     * @param marshaller Marshaller.
-     */
-    public void registerMarshaller(GridIndexingMarshaller marshaller);
-
-    /**
-     * Registers space in this SPI.
-     *
-     * @param spaceName Space name.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public void registerSpace(String spaceName) throws IgniteSpiException;
-
-    /**
-     * Rebuilds all indexes of given type.
-     *
-     * @param spaceName Space name.
-     * @param type Type descriptor.
-     */
-    public void rebuildIndexes(@Nullable String spaceName, GridIndexingTypeDescriptor type);
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/GridIndexingTypeDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/GridIndexingTypeDescriptor.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/GridIndexingTypeDescriptor.java
deleted file mode 100644
index ea39e90..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/GridIndexingTypeDescriptor.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.indexing;
-
-
-import org.apache.ignite.spi.*;
-
-import java.util.*;
-
-/**
- * Value descriptor which allows to extract fields from value object of given type.
- * See also {@link GridIndexingSpi#registerType(String, GridIndexingTypeDescriptor)}.
- */
-public interface GridIndexingTypeDescriptor {
-    /**
-     * Gets type name which uniquely identifies this type.
-     *
-     * @return Type name which uniquely identifies this type.
-     */
-    public String name();
-
-    /**
-     * Gets mapping from values field name to its type.
-     *
-     * @return Fields that can be indexed, participate in queries and can be queried using
-     *      {@link GridIndexingSpi#queryFields(String, String, Collection, GridIndexingQueryFilter[])}
-     *      method.
-     */
-    public Map<String, Class<?>> valueFields();
-
-    /**
-     * Gets mapping from keys field name to its type.
-     *
-     * @return Fields that can be indexed, participate in queries and can be queried using
-     *      {@link GridIndexingSpi#queryFields(String, String, Collection, GridIndexingQueryFilter[])}
-     *      method.
-     */
-    public Map<String, Class<?>> keyFields();
-
-    /**
-     * Gets field value for given object.
-     *
-     * @param obj Object to get field value from.
-     * @param field Field name.
-     * @return Value for given field.
-     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
-     */
-    public <T> T value(Object obj, String field) throws IgniteSpiException;
-
-    /**
-     * Gets indexes for this type.
-     *
-     * @return Indexes for this type.
-     */
-    public Map<String, GridIndexDescriptor> indexes();
-
-    /**
-     * Gets value class.
-     *
-     * @return Value class.
-     */
-    public Class<?> valueClass();
-
-    /**
-     * Gets key class.
-     *
-     * @return Key class.
-     */
-    public Class<?> keyClass();
-
-    /**
-     * Returns {@code true} if string representation of value should be indexed as text.
-     *
-     * @return If string representation of value should be full-text indexed.
-     */
-    public boolean valueTextIndex();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/GridNoopIndexingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/GridNoopIndexingSpi.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/GridNoopIndexingSpi.java
deleted file mode 100644
index 2cdd25d..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/GridNoopIndexingSpi.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.indexing;
-
-import org.apache.ignite.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.spi.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-
-/**
- * No-op implementation of {@link GridIndexingSpi}, throws exception on query attempt.
- */
-@IgniteSpiNoop
-public class GridNoopIndexingSpi extends IgniteSpiAdapter implements GridIndexingSpi {
-    /** */
-    @IgniteLoggerResource
-    private IgniteLogger log;
-
-    /** {@inheritDoc} */
-    @Override public <K, V> GridIndexingFieldsResult queryFields(@Nullable String spaceName, String qry,
-        Collection<Object> params, GridIndexingQueryFilter filters) throws IgniteSpiException {
-        throw spiException();
-    }
-
-    /** {@inheritDoc} */
-    @Override public <K, V> IgniteSpiCloseableIterator<GridIndexingKeyValueRow<K, V>> query(@Nullable String spaceName,
-        String qry, Collection<Object> params, GridIndexingTypeDescriptor type,
-        GridIndexingQueryFilter filters) throws IgniteSpiException {
-        throw spiException();
-    }
-
-    /** {@inheritDoc} */
-    @Override public <K, V> IgniteSpiCloseableIterator<GridIndexingKeyValueRow<K, V>> queryText(@Nullable
-        String spaceName, String qry, GridIndexingTypeDescriptor type, GridIndexingQueryFilter filters)
-        throws IgniteSpiException {
-        throw spiException();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long size(@Nullable String spaceName, GridIndexingTypeDescriptor desc) throws IgniteSpiException {
-        throw spiException();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean registerType(@Nullable String spaceName, GridIndexingTypeDescriptor desc)
-        throws IgniteSpiException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void unregisterType(@Nullable String spaceName, GridIndexingTypeDescriptor type)
-        throws IgniteSpiException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public <K, V> void store(@Nullable String spaceName, GridIndexingTypeDescriptor type,
-        GridIndexingEntity<K> key, GridIndexingEntity<V> val, byte[] ver, long expirationTime) throws IgniteSpiException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public <K> boolean remove(@Nullable String spaceName, GridIndexingEntity<K> key) throws IgniteSpiException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public <K> void onSwap(@Nullable String spaceName, String swapSpaceName, K key) throws IgniteSpiException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public <K, V> void onUnswap(@Nullable String spaceName, K key, V val, byte[] valBytes)
-        throws IgniteSpiException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void registerMarshaller(GridIndexingMarshaller marshaller) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void registerSpace(String spaceName) throws IgniteSpiException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void rebuildIndexes(@Nullable String spaceName, GridIndexingTypeDescriptor type) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void spiStart(@Nullable String gridName) throws IgniteSpiException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void spiStop() throws IgniteSpiException {
-        // No-op.
-    }
-
-    /**
-     * @return No-op SPI usage exception.
-     */
-    private IgniteSpiException spiException() {
-        return new IgniteSpiException("Current grid configuration does not support queries " +
-            "(please configure GridH2IndexingSpi).");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexDescriptor.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexDescriptor.java
new file mode 100644
index 0000000..7fecd56
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexDescriptor.java
@@ -0,0 +1,42 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.indexing;
+
+import java.util.*;
+
+/**
+ * Describes an index to be created for a certain type. It contains all necessary
+ * information about fields, order, uniqueness, and specified
+ * whether this is SQL or Text index.
+ * See also {@link IndexingTypeDescriptor#indexes()}.
+ */
+public interface IndexDescriptor {
+    /**
+     * Gets all fields to be indexed.
+     *
+     * @return Fields to be indexed.
+     */
+    public Collection<String> fields();
+
+    /**
+     * Specifies order of the index for each indexed field.
+     *
+     * @param field Field name.
+     * @return {@code True} if given field should be indexed in descending order.
+     */
+    public boolean descending(String field);
+
+    /**
+     * Gets index type.
+     *
+     * @return Type.
+     */
+    public IndexType type();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexType.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexType.java
new file mode 100644
index 0000000..f7f0ea2
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexType.java
@@ -0,0 +1,24 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.indexing;
+
+/**
+ * Index types.
+ */
+public enum IndexType {
+    /** Sorted SQL index. */
+    SORTED,
+
+    /** Spatial SQL index. */
+    GEO_SPATIAL,
+
+    /** Fulltext index. */
+    FULLTEXT
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingEntity.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingEntity.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingEntity.java
new file mode 100644
index 0000000..556d4f0
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingEntity.java
@@ -0,0 +1,50 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.indexing;
+
+import org.apache.ignite.spi.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+/**
+ * Wrapper around indexed key or value which also may contain the value in
+ * unmarshalled form. It exists to avoid unnecessary unmarshalling whenever
+ * it is not needed.
+ * See also {@link IndexingSpi#queryFields(String, String, Collection, IndexingQueryFilter[])}.
+ */
+public interface IndexingEntity<T> {
+    /**
+     * Gets indexed value. This method may return {@code null} only
+     * if actual value is {@code null}. Otherwise, it will unmarshal
+     * the {@link #bytes()} and return the actual value.
+     *
+     * @return Indexed value.
+     * @throws org.apache.ignite.spi.IgniteSpiException If value de-serialization failed.
+     */
+    @Nullable public T value() throws IgniteSpiException;
+
+    /**
+     * Optional bytes for marshaled indexed value. Certain SPI implementations
+     * may keep objects in unmarshalled form and therefore will not provide
+     * marshaled bytes for them.
+     *
+     * @return Optional marshaled value.
+     */
+    @Nullable public byte[] bytes();
+
+    /**
+     * Flag indicating whether this entity contains unmarshalled value.
+     *
+     * @return {@code True} if entity contains unmarshalled value, {@code false}
+     *      otherwise.
+     */
+    public boolean hasValue();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingEntityAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingEntityAdapter.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingEntityAdapter.java
new file mode 100644
index 0000000..1effa99
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingEntityAdapter.java
@@ -0,0 +1,57 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.indexing;
+
+import org.gridgain.grid.util.typedef.internal.*;
+import org.gridgain.grid.util.tostring.*;
+import org.jetbrains.annotations.*;
+
+/**
+ * Convenience adapter for {@link IndexingEntity}.
+ */
+public class IndexingEntityAdapter<T> implements IndexingEntity<T> {
+    /** */
+    @GridToStringInclude
+    private final T val;
+
+    /** */
+    @GridToStringExclude
+    private final byte[] bytes;
+
+    /**
+     * @param val Value.
+     * @param bytes Value marshalled by {@link org.apache.ignite.marshaller.IgniteMarshaller}.
+     */
+    public IndexingEntityAdapter(T val, @Nullable byte[] bytes) {
+        this.val = val;
+        this.bytes = bytes;
+    }
+
+    /** {@inheritDoc} */
+    @Override public T value() {
+        return val;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte[] bytes() {
+        return bytes;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean hasValue() {
+        return val != null || (val == null && bytes == null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(IndexingEntityAdapter.class, this,
+            "bytesLength", (bytes == null ? 0 : bytes.length));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingFieldMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingFieldMetadata.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingFieldMetadata.java
new file mode 100644
index 0000000..f530b20
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingFieldMetadata.java
@@ -0,0 +1,46 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.indexing;
+
+import java.io.*;
+
+/**
+ * Query field descriptor. This descriptor is used to provide metadata
+ * about fields returned in query result.
+ */
+public interface IndexingFieldMetadata extends Externalizable {
+    /**
+     * Gets schema name.
+     *
+     * @return Schema name.
+     */
+    public String schemaName();
+
+    /**
+     * Gets name of type to which this field belongs.
+     *
+     * @return Gets type name.
+     */
+    public String typeName();
+
+    /**
+     * Gets field name.
+     *
+     * @return Field name.
+     */
+    public String fieldName();
+
+    /**
+     * Gets field type name.
+     *
+     * @return Field type name.
+     */
+    public String fieldTypeName();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingFieldsResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingFieldsResult.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingFieldsResult.java
new file mode 100644
index 0000000..ede3278
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingFieldsResult.java
@@ -0,0 +1,35 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.indexing;
+
+import org.apache.ignite.spi.*;
+
+import java.util.*;
+
+/**
+ * Field query result. It is composed of
+ * fields metadata and iterator over queried fields.
+ * See also {@link IndexingSpi#queryFields(String, String, Collection, IndexingQueryFilter)}.
+ */
+public interface IndexingFieldsResult {
+    /**
+     * Gets metadata for queried fields.
+     *
+     * @return Meta data for queried fields.
+     */
+    List<IndexingFieldMetadata> metaData();
+
+    /**
+     * Gets iterator over queried fields.
+     *
+     * @return Iterator over queried fields.
+     */
+    IgniteSpiCloseableIterator<List<IndexingEntity<?>>> iterator();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingFieldsResultAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingFieldsResultAdapter.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingFieldsResultAdapter.java
new file mode 100644
index 0000000..348f344
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingFieldsResultAdapter.java
@@ -0,0 +1,49 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.indexing;
+
+import org.apache.ignite.spi.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+/**
+ * Convenience adapter for {@link IndexingFieldsResult}.
+ */
+public class IndexingFieldsResultAdapter implements IndexingFieldsResult {
+    /** Meta data. */
+    private final List<IndexingFieldMetadata> metaData;
+
+    /** Result iterator. */
+    private final IgniteSpiCloseableIterator<List<IndexingEntity<?>>> it;
+
+    /**
+     * Creates query field result composed of field metadata and iterator
+     * over queried fields.
+     *
+     * @param metaData Meta data.
+     * @param it Result iterator.
+     */
+    public IndexingFieldsResultAdapter(@Nullable List<IndexingFieldMetadata> metaData,
+                                       IgniteSpiCloseableIterator<List<IndexingEntity<?>>> it) {
+        this.metaData = metaData != null ? Collections.unmodifiableList(metaData) : null;
+        this.it = it;
+    }
+
+    /** {@inheritDoc} */
+    @Override public List<IndexingFieldMetadata> metaData() {
+        return metaData;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteSpiCloseableIterator<List<IndexingEntity<?>>> iterator() {
+        return it;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingKeyValueRow.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingKeyValueRow.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingKeyValueRow.java
new file mode 100644
index 0000000..841130e
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingKeyValueRow.java
@@ -0,0 +1,42 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.indexing;
+
+import java.util.*;
+
+/**
+ * This class represents a single row returned by key-value query. For example, it is returned
+ * by query such as {@link IndexingSpi#query(String, String, Collection, IndexingTypeDescriptor, IndexingQueryFilter[])}
+ * method. Key-value queries are different from fields query in a way that they
+ * return the whole cached value, not its individual fields.
+ * See also {@link IndexingSpi#query(String, String, Collection, IndexingTypeDescriptor, IndexingQueryFilter[])}.
+ */
+public interface IndexingKeyValueRow<K, V> {
+    /**
+     * Gets cache key.
+     *
+     * @return Cache key.
+     */
+    public IndexingEntity<K> key();
+
+    /**
+     * Gets cache value.
+     *
+     * @return Cache value.
+     */
+    public IndexingEntity<V> value();
+
+    /**
+     * Gets version of cache value.
+     *
+     * @return Version of cache value.
+     */
+    public byte[] version();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingKeyValueRowAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingKeyValueRowAdapter.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingKeyValueRowAdapter.java
new file mode 100644
index 0000000..8b95aa3
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingKeyValueRowAdapter.java
@@ -0,0 +1,82 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+*  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+*  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+*  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+*  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+*/
+
+package org.gridgain.grid.spi.indexing;
+
+import org.gridgain.grid.kernal.processors.cache.query.*;
+import org.gridgain.grid.util.typedef.internal.*;
+import org.gridgain.grid.util.tostring.*;
+import org.jetbrains.annotations.*;
+
+/**
+ * Convenience adapter for {@link IndexingKeyValueRow}.
+ */
+public class IndexingKeyValueRowAdapter<K, V> implements IndexingKeyValueRow<K, V> {
+    /** Key. */
+    @GridToStringInclude
+    private IndexingEntity<K> key;
+
+    /** Value. */
+    @GridToStringInclude
+    private IndexingEntity<V> val;
+
+    /** Version. */
+    @GridToStringInclude
+    private byte[] ver;
+
+    /**
+     * Constructor.
+     *
+     * @param key Key.
+     * @param val Value.
+     */
+    public IndexingKeyValueRowAdapter(K key, V val) {
+        assert key != null;
+        assert val != null;
+
+        this.key = new IndexingEntityAdapter<>(key, null);
+        this.val = new IndexingEntityAdapter<>(val, null);
+    }
+
+    /**
+     * Constructs query index row.
+     *
+     * @param key Key.
+     * @param val Value.
+     * @param ver Version. It is {@code null} in case of {@link GridCacheQueryType#SCAN} query.
+     */
+    public IndexingKeyValueRowAdapter(IndexingEntity<K> key, @Nullable IndexingEntity<V> val,
+                                      @Nullable byte[] ver) {
+        assert key != null;
+
+        this.key = key;
+        this.val = val;
+        this.ver = ver;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IndexingEntity<K> key() {
+        return key;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IndexingEntity<V> value() {
+        return val;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte[] version() {
+        return ver;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(IndexingKeyValueRowAdapter.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingMarshaller.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingMarshaller.java
new file mode 100644
index 0000000..403b871
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingMarshaller.java
@@ -0,0 +1,38 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.indexing;
+
+import org.apache.ignite.spi.*;
+
+/**
+ * Marshaller to be used in indexing SPI. This marshaller automatically
+ * takes care of class loading of unmarshalled classes.
+ * See also {@link IndexingSpi#registerMarshaller(IndexingMarshaller)}.
+ */
+public interface IndexingMarshaller {
+    /**
+     * Unmarshalls bytes to object.
+     *
+     * @param bytes Bytes.
+     * @param <T> Value type.
+     * @return Value.
+     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
+     */
+    public <T> IndexingEntity<T> unmarshal(byte[] bytes) throws IgniteSpiException;
+
+    /**
+     * Marshals object to bytes.
+     *
+     * @param entity Entity.
+     * @return Bytes.
+     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
+     */
+    public byte[] marshal(IndexingEntity<?> entity) throws IgniteSpiException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingQueryFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingQueryFilter.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingQueryFilter.java
new file mode 100644
index 0000000..4424734
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingQueryFilter.java
@@ -0,0 +1,27 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.indexing;
+
+import org.apache.ignite.lang.*;
+import org.gridgain.grid.*;
+import org.jetbrains.annotations.*;
+
+/**
+ * Space name and key filter.
+ */
+public interface IndexingQueryFilter {
+    /**
+     * Creates optional predicate for space.
+     *
+     * @param spaceName Space name.
+     * @return Predicate or {@code null} if no filtering is needed.
+     */
+    @Nullable public <K, V> IgniteBiPredicate<K, V> forSpace(String spaceName) throws GridException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingSpi.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingSpi.java
new file mode 100644
index 0000000..d95905a
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingSpi.java
@@ -0,0 +1,188 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.indexing;
+
+import org.apache.ignite.spi.*;
+import org.gridgain.grid.cache.*;
+import org.gridgain.grid.cache.query.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+/**
+ * Indexing SPI allows user to index cache content. Using indexing SPI user can index data in cache and run SQL,
+ * TEXT or individual field queries against these indexes. Usually indexing SPI is used by caches by name
+ * (see {@link GridCacheConfiguration#getIndexingSpiName()}). Logically storage is organized into separate spaces.
+ * Usually cache name will be used as space name, so multiple caches can write to single indexing SPI instance.
+ * <p>
+ * Functionality of this SPI is exposed to {@link GridCacheQueries} interface:
+ * <ul>
+ *      <li>{@link GridCacheQueries#createSqlQuery(Class, String)}</li>
+ *      <li>{@link GridCacheQueries#createSqlFieldsQuery(String)}</li>
+ *      <li>{@link GridCacheQueries#createFullTextQuery(Class, String)}</li>
+ * </ul>
+ * <p>
+ * The default indexing SPI implementation is
+ * {@gglink org.gridgain.grid.spi.indexing.h2.GridH2IndexingSpi} which uses H2 database engine
+ * for data indexing and querying. User can implement his own indexing SPI and use his own data structures
+ * and query language instead of SQL. SPI can be configured for grid using {@link org.apache.ignite.configuration.IgniteConfiguration#getIndexingSpi()}.
+ * <p>
+ * GridGain comes with following built-in indexing SPI implementations:
+ * <ul>
+ *      <li>{@gglink org.gridgain.grid.spi.indexing.h2.GridH2IndexingSpi}</li>
+ * </ul>
+ * <p>
+ * <b>NOTE:</b> 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 GridGain 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 {@link org.apache.ignite.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.
+ */
+public interface IndexingSpi extends IgniteSpi {
+    /**
+     * Queries individual fields (generally used by JDBC drivers).
+     *
+     * @param spaceName Space name.
+     * @param qry Query.
+     * @param params Query parameters.
+     * @param filters Space name and key filters.
+     * @return Query result.
+     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
+     */
+    public <K, V> IndexingFieldsResult queryFields(@Nullable String spaceName, String qry,
+        Collection<Object> params, IndexingQueryFilter filters) throws IgniteSpiException;
+
+    /**
+     * Executes regular query.
+     *
+     * @param spaceName Space name.
+     * @param qry Query.
+     * @param params Query parameters.
+     * @param type Query return type.
+     * @param filters Space name and key filters.
+     * @return Queried rows.
+     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
+     */
+    public <K, V> IgniteSpiCloseableIterator<IndexingKeyValueRow<K, V>> query(@Nullable String spaceName, String qry,
+        Collection<Object> params, IndexingTypeDescriptor type, IndexingQueryFilter filters)
+        throws IgniteSpiException;
+
+    /**
+     * Executes text query.
+     *
+     * @param spaceName Space name.
+     * @param qry Text query.
+     * @param type Query return type.
+     * @param filters Space name and key filter.
+     * @return Queried rows.
+     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
+     */
+    public <K, V> IgniteSpiCloseableIterator<IndexingKeyValueRow<K, V>> queryText(@Nullable String spaceName, String qry,
+        IndexingTypeDescriptor type, IndexingQueryFilter filters) throws IgniteSpiException;
+
+    /**
+     * Gets size of index for given type or -1 if it is a unknown type.
+     *
+     * @param spaceName Space name.
+     * @param desc Type descriptor.
+     * @return Objects number.
+     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
+     */
+    public long size(@Nullable String spaceName, IndexingTypeDescriptor desc) throws IgniteSpiException;
+
+    /**
+     * Registers type if it was not known before or updates it otherwise.
+     *
+     * @param spaceName Space name.
+     * @param desc Type descriptor.
+     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
+     * @return {@code True} if type was registered, {@code false} if for some reason it was rejected.
+     */
+    public boolean registerType(@Nullable String spaceName, IndexingTypeDescriptor desc) throws IgniteSpiException;
+
+    /**
+     * Unregisters type and removes all corresponding data.
+     *
+     * @param spaceName Space name.
+     * @param type Type descriptor.
+     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
+     */
+    public void unregisterType(@Nullable String spaceName, IndexingTypeDescriptor type) 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.
+     *
+     * @param spaceName Space name.
+     * @param type Value type.
+     * @param key Key.
+     * @param val Value.
+     * @param ver Version.
+     * @param expirationTime Expiration time or 0 if never expires.
+     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
+     */
+    public <K, V> void store(@Nullable String spaceName, IndexingTypeDescriptor type, IndexingEntity<K> key,
+        IndexingEntity<V> val, byte[] ver, long expirationTime) throws IgniteSpiException;
+
+    /**
+     * Removes index entry by key.
+     *
+     * @param spaceName Space name.
+     * @param key Key.
+     * @return {@code True} if removed by this operation, {@code false} otherwise.
+     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
+     */
+    public <K> boolean remove(@Nullable String spaceName, IndexingEntity<K> key) throws IgniteSpiException;
+
+    /**
+     * Will be called when entry with given key is swapped.
+     *
+     * @param spaceName Space name.
+     * @param swapSpaceName Swap space name.
+     * @param key Key.
+     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
+     */
+    public <K> void onSwap(@Nullable String spaceName, String swapSpaceName, K key) throws IgniteSpiException;
+
+    /**
+     * Will be called when entry with given key is unswapped.
+     *
+     * @param spaceName Space name.
+     * @param key Key.
+     * @param val Value.
+     * @param valBytes Value bytes.
+     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
+     */
+    public <K, V> void onUnswap(@Nullable String spaceName, K key, V val, byte[] valBytes) throws IgniteSpiException;
+
+    /**
+     * Marshaller to be used by SPI.
+     *
+     * @param marshaller Marshaller.
+     */
+    public void registerMarshaller(IndexingMarshaller marshaller);
+
+    /**
+     * Registers space in this SPI.
+     *
+     * @param spaceName Space name.
+     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
+     */
+    public void registerSpace(String spaceName) throws IgniteSpiException;
+
+    /**
+     * Rebuilds all indexes of given type.
+     *
+     * @param spaceName Space name.
+     * @param type Type descriptor.
+     */
+    public void rebuildIndexes(@Nullable String spaceName, IndexingTypeDescriptor type);
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingTypeDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingTypeDescriptor.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingTypeDescriptor.java
new file mode 100644
index 0000000..dfcb7d4
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/IndexingTypeDescriptor.java
@@ -0,0 +1,84 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.indexing;
+
+
+import org.apache.ignite.spi.*;
+
+import java.util.*;
+
+/**
+ * Value descriptor which allows to extract fields from value object of given type.
+ * See also {@link IndexingSpi#registerType(String, IndexingTypeDescriptor)}.
+ */
+public interface IndexingTypeDescriptor {
+    /**
+     * Gets type name which uniquely identifies this type.
+     *
+     * @return Type name which uniquely identifies this type.
+     */
+    public String name();
+
+    /**
+     * Gets mapping from values field name to its type.
+     *
+     * @return Fields that can be indexed, participate in queries and can be queried using
+     *      {@link IndexingSpi#queryFields(String, String, Collection, IndexingQueryFilter[])}
+     *      method.
+     */
+    public Map<String, Class<?>> valueFields();
+
+    /**
+     * Gets mapping from keys field name to its type.
+     *
+     * @return Fields that can be indexed, participate in queries and can be queried using
+     *      {@link IndexingSpi#queryFields(String, String, Collection, IndexingQueryFilter[])}
+     *      method.
+     */
+    public Map<String, Class<?>> keyFields();
+
+    /**
+     * Gets field value for given object.
+     *
+     * @param obj Object to get field value from.
+     * @param field Field name.
+     * @return Value for given field.
+     * @throws org.apache.ignite.spi.IgniteSpiException If failed.
+     */
+    public <T> T value(Object obj, String field) throws IgniteSpiException;
+
+    /**
+     * Gets indexes for this type.
+     *
+     * @return Indexes for this type.
+     */
+    public Map<String, IndexDescriptor> indexes();
+
+    /**
+     * Gets value class.
+     *
+     * @return Value class.
+     */
+    public Class<?> valueClass();
+
+    /**
+     * Gets key class.
+     *
+     * @return Key class.
+     */
+    public Class<?> keyClass();
+
+    /**
+     * Returns {@code true} if string representation of value should be indexed as text.
+     *
+     * @return If string representation of value should be full-text indexed.
+     */
+    public boolean valueTextIndex();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/main/java/org/gridgain/grid/spi/indexing/NoopIndexingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/indexing/NoopIndexingSpi.java b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/NoopIndexingSpi.java
new file mode 100644
index 0000000..d82954c
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/indexing/NoopIndexingSpi.java
@@ -0,0 +1,119 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.gridgain.grid.spi.indexing;
+
+import org.apache.ignite.*;
+import org.apache.ignite.resources.*;
+import org.apache.ignite.spi.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+/**
+ * No-op implementation of {@link IndexingSpi}, throws exception on query attempt.
+ */
+@IgniteSpiNoop
+public class NoopIndexingSpi extends IgniteSpiAdapter implements IndexingSpi {
+    /** */
+    @IgniteLoggerResource
+    private IgniteLogger log;
+
+    /** {@inheritDoc} */
+    @Override public <K, V> IndexingFieldsResult queryFields(@Nullable String spaceName, String qry,
+        Collection<Object> params, IndexingQueryFilter filters) throws IgniteSpiException {
+        throw spiException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <K, V> IgniteSpiCloseableIterator<IndexingKeyValueRow<K, V>> query(@Nullable String spaceName,
+        String qry, Collection<Object> params, IndexingTypeDescriptor type,
+        IndexingQueryFilter filters) throws IgniteSpiException {
+        throw spiException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <K, V> IgniteSpiCloseableIterator<IndexingKeyValueRow<K, V>> queryText(@Nullable
+        String spaceName, String qry, IndexingTypeDescriptor type, IndexingQueryFilter filters)
+        throws IgniteSpiException {
+        throw spiException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long size(@Nullable String spaceName, IndexingTypeDescriptor desc) throws IgniteSpiException {
+        throw spiException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean registerType(@Nullable String spaceName, IndexingTypeDescriptor desc)
+        throws IgniteSpiException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void unregisterType(@Nullable String spaceName, IndexingTypeDescriptor type)
+        throws IgniteSpiException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public <K, V> void store(@Nullable String spaceName, IndexingTypeDescriptor type,
+        IndexingEntity<K> key, IndexingEntity<V> val, byte[] ver, long expirationTime) throws IgniteSpiException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public <K> boolean remove(@Nullable String spaceName, IndexingEntity<K> key) throws IgniteSpiException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public <K> void onSwap(@Nullable String spaceName, String swapSpaceName, K key) throws IgniteSpiException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public <K, V> void onUnswap(@Nullable String spaceName, K key, V val, byte[] valBytes)
+        throws IgniteSpiException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void registerMarshaller(IndexingMarshaller marshaller) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void registerSpace(String spaceName) throws IgniteSpiException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void rebuildIndexes(@Nullable String spaceName, IndexingTypeDescriptor type) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void spiStart(@Nullable String gridName) throws IgniteSpiException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void spiStop() throws IgniteSpiException {
+        // No-op.
+    }
+
+    /**
+     * @return No-op SPI usage exception.
+     */
+    private IgniteSpiException spiException() {
+        return new IgniteSpiException("Current grid configuration does not support queries " +
+            "(please configure GridH2IndexingSpi).");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxExceptionAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxExceptionAbstractSelfTest.java
index 27560ac..f319eb3 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxExceptionAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxExceptionAbstractSelfTest.java
@@ -571,7 +571,7 @@ public abstract class GridCacheTxExceptionAbstractSelfTest extends GridCacheAbst
     /**
      * Indexing SPI that can fail on demand.
      */
-    private static class TestIndexingSpi extends IgniteSpiAdapter implements GridIndexingSpi {
+    private static class TestIndexingSpi extends IgniteSpiAdapter implements IndexingSpi {
         /** Fail flag. */
         private volatile boolean fail;
 
@@ -583,37 +583,37 @@ public abstract class GridCacheTxExceptionAbstractSelfTest extends GridCacheAbst
         }
 
         /** {@inheritDoc} */
-        @Override public <K, V> GridIndexingFieldsResult queryFields(@Nullable String spaceName, String qry,
-            Collection<Object> params, GridIndexingQueryFilter filters) {
+        @Override public <K, V> IndexingFieldsResult queryFields(@Nullable String spaceName, String qry,
+            Collection<Object> params, IndexingQueryFilter filters) {
             throw new UnsupportedOperationException();
         }
 
         /** {@inheritDoc} */
-        @Override public <K, V> IgniteSpiCloseableIterator<GridIndexingKeyValueRow<K, V>> query(
-            @Nullable String spaceName, String qry, Collection<Object> params, GridIndexingTypeDescriptor type,
-            GridIndexingQueryFilter filters) {
+        @Override public <K, V> IgniteSpiCloseableIterator<IndexingKeyValueRow<K, V>> query(
+            @Nullable String spaceName, String qry, Collection<Object> params, IndexingTypeDescriptor type,
+            IndexingQueryFilter filters) {
             throw new UnsupportedOperationException();
         }
 
         /** {@inheritDoc} */
-        @Override public <K, V> IgniteSpiCloseableIterator<GridIndexingKeyValueRow<K, V>> queryText(
-            @Nullable String spaceName, String qry, GridIndexingTypeDescriptor type,
-            GridIndexingQueryFilter filters) {
+        @Override public <K, V> IgniteSpiCloseableIterator<IndexingKeyValueRow<K, V>> queryText(
+            @Nullable String spaceName, String qry, IndexingTypeDescriptor type,
+            IndexingQueryFilter filters) {
             throw new UnsupportedOperationException();
         }
 
         /** {@inheritDoc} */
-        @Override public long size(@Nullable String spaceName, GridIndexingTypeDescriptor desc) {
+        @Override public long size(@Nullable String spaceName, IndexingTypeDescriptor desc) {
             return 0;
         }
 
         /** {@inheritDoc} */
-        @Override public boolean registerType(@Nullable String spaceName, GridIndexingTypeDescriptor desc) {
+        @Override public boolean registerType(@Nullable String spaceName, IndexingTypeDescriptor desc) {
             return true;
         }
 
         /** {@inheritDoc} */
-        @Override public void unregisterType(@Nullable String spaceName, GridIndexingTypeDescriptor type) {
+        @Override public void unregisterType(@Nullable String spaceName, IndexingTypeDescriptor type) {
             // No-op.
         }
 
@@ -628,18 +628,18 @@ public abstract class GridCacheTxExceptionAbstractSelfTest extends GridCacheAbst
         }
 
         /** {@inheritDoc} */
-        @Override public void registerMarshaller(GridIndexingMarshaller marshaller) {
+        @Override public void registerMarshaller(IndexingMarshaller marshaller) {
             // No-op.
         }
 
         /** {@inheritDoc} */
-        @Override public void rebuildIndexes(@Nullable String spaceName, GridIndexingTypeDescriptor type) {
+        @Override public void rebuildIndexes(@Nullable String spaceName, IndexingTypeDescriptor type) {
             // No-op.
         }
 
         /** {@inheritDoc} */
-        @Override public <K, V> void store(@Nullable String spaceName, GridIndexingTypeDescriptor type,
-                                           GridIndexingEntity<K> key, GridIndexingEntity<V> val, byte[] ver, long expirationTime)
+        @Override public <K, V> void store(@Nullable String spaceName, IndexingTypeDescriptor type,
+                                           IndexingEntity<K> key, IndexingEntity<V> val, byte[] ver, long expirationTime)
             throws IgniteSpiException {
             if (fail) {
                 fail = false;
@@ -649,7 +649,7 @@ public abstract class GridCacheTxExceptionAbstractSelfTest extends GridCacheAbst
         }
 
         /** {@inheritDoc} */
-        @Override public <K> boolean remove(@Nullable String spaceName, GridIndexingEntity<K> k)
+        @Override public <K> boolean remove(@Nullable String spaceName, IndexingEntity<K> k)
             throws IgniteSpiException {
             if (fail) {
                 fail = false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/GridH2IndexingSpi.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/GridH2IndexingSpi.java b/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/GridH2IndexingSpi.java
index f6aff01..4a0f8bb 100644
--- a/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/GridH2IndexingSpi.java
+++ b/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/GridH2IndexingSpi.java
@@ -45,7 +45,7 @@ import java.util.*;
 import java.util.concurrent.*;
 
 import static org.apache.ignite.IgniteSystemProperties.*;
-import static org.gridgain.grid.spi.indexing.GridIndexType.*;
+import static org.gridgain.grid.spi.indexing.IndexType.*;
 import static org.gridgain.grid.spi.indexing.h2.opt.GridH2AbstractKeyValueRow.*;
 import static org.h2.result.SortOrder.*;
 
@@ -56,10 +56,10 @@ import static org.h2.result.SortOrder.*;
  * with name {@code PUBLIC} will be used. To avoid name conflicts user should not explicitly name
  * a schema {@code PUBLIC}.
  * <p>
- * For each registered {@link GridIndexingTypeDescriptor} this SPI will create respective SQL table with
+ * For each registered {@link org.gridgain.grid.spi.indexing.IndexingTypeDescriptor} this SPI will create respective SQL table with
  * {@code '_key'} and {@code '_val'} fields for key and value, and fields from
- * {@link GridIndexingTypeDescriptor#keyFields()} and {@link GridIndexingTypeDescriptor#valueFields()}.
- * For each table it will create indexes declared in {@link GridIndexingTypeDescriptor#indexes()}.
+ * {@link org.gridgain.grid.spi.indexing.IndexingTypeDescriptor#keyFields()} and {@link org.gridgain.grid.spi.indexing.IndexingTypeDescriptor#valueFields()}.
+ * For each table it will create indexes declared in {@link org.gridgain.grid.spi.indexing.IndexingTypeDescriptor#indexes()}.
  * <p>
  * Note that you can monitor longer queries by setting {@link #setLongQueryExplain(boolean)} to {@code true}.
  * In this case a warning and execution plan are printed out if query exceeds certain time threshold. The
@@ -131,11 +131,11 @@ import static org.h2.result.SortOrder.*;
  * <img src="http://www.gridgain.com/images/spring-small.png">
  * <br>
  * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
- * @see GridIndexingSpi
+ * @see org.gridgain.grid.spi.indexing.IndexingSpi
  */
 @IgniteSpiMultipleInstancesSupport(true)
 @SuppressWarnings({"UnnecessaryFullyQualifiedName", "NonFinalStaticVariableUsedInClassInitialization"})
-public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingSpi, GridH2IndexingSpiMBean {
+public class GridH2IndexingSpi extends IgniteSpiAdapter implements IndexingSpi, GridH2IndexingSpiMBean {
     /** Default query execution time interpreted as long query (3 seconds). */
     public static final long DFLT_LONG_QRY_EXEC_TIMEOUT = 3000;
 
@@ -244,7 +244,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
     private final CountDownLatch ctxInitLatch = new CountDownLatch(1);
 
     /** Marshaller. */
-    private GridIndexingMarshaller marshaller;
+    private IndexingMarshaller marshaller;
 
     /** */
     private GridUnsafeMemory offheap;
@@ -406,7 +406,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
      * @param tblToUpdate Table to update.
      * @throws org.apache.ignite.spi.IgniteSpiException In case of error.
      */
-    private <K> void removeKey(@Nullable String spaceName, GridIndexingEntity<K> k, TableDescriptor tblToUpdate)
+    private <K> void removeKey(@Nullable String spaceName, IndexingEntity<K> k, TableDescriptor tblToUpdate)
         throws IgniteSpiException {
         K key = k.value();
 
@@ -471,8 +471,8 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
     }
 
     /** {@inheritDoc} */
-    @Override public <K, V> void store(@Nullable String spaceName, GridIndexingTypeDescriptor type,
-        GridIndexingEntity<K> k, GridIndexingEntity<V> v, byte[] ver, long expirationTime)
+    @Override public <K, V> void store(@Nullable String spaceName, IndexingTypeDescriptor type,
+        IndexingEntity<K> k, IndexingEntity<V> v, byte[] ver, long expirationTime)
         throws IgniteSpiException {
         TableDescriptor tbl = tableDescriptor(spaceName, type);
 
@@ -498,7 +498,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
     }
 
     /** {@inheritDoc} */
-    @Override public <K> boolean remove(@Nullable String spaceName, GridIndexingEntity<K> k) throws IgniteSpiException {
+    @Override public <K> boolean remove(@Nullable String spaceName, IndexingEntity<K> k) throws IgniteSpiException {
         assert k != null;
 
         K key = k.value();
@@ -652,9 +652,9 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    @Override public <K, V> IgniteSpiCloseableIterator<GridIndexingKeyValueRow<K, V>> queryText(
-        @Nullable String spaceName, String qry, GridIndexingTypeDescriptor type,
-        GridIndexingQueryFilter filters) throws IgniteSpiException {
+    @Override public <K, V> IgniteSpiCloseableIterator<IndexingKeyValueRow<K, V>> queryText(
+        @Nullable String spaceName, String qry, IndexingTypeDescriptor type,
+        IndexingQueryFilter filters) throws IgniteSpiException {
         TableDescriptor tbl = tableDescriptor(spaceName, type);
 
         if (tbl != null && tbl.luceneIdx != null)
@@ -664,7 +664,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
     }
 
     /** {@inheritDoc} */
-    @Override public void unregisterType(@Nullable String spaceName, GridIndexingTypeDescriptor type)
+    @Override public void unregisterType(@Nullable String spaceName, IndexingTypeDescriptor type)
         throws IgniteSpiException {
         TableDescriptor tbl = tableDescriptor(spaceName, type);
 
@@ -674,8 +674,8 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    @Override public <K, V> GridIndexingFieldsResult queryFields(@Nullable final String spaceName, final String qry,
-        @Nullable final Collection<Object> params, final GridIndexingQueryFilter filters)
+    @Override public <K, V> IndexingFieldsResult queryFields(@Nullable final String spaceName, final String qry,
+        @Nullable final Collection<Object> params, final IndexingQueryFilter filters)
         throws IgniteSpiException {
         localSpi.set(this);
 
@@ -686,7 +686,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
 
             ResultSet rs = executeSqlQueryWithTimer(conn, qry, params);
 
-            List<GridIndexingFieldMetadata> meta = null;
+            List<IndexingFieldMetadata> meta = null;
 
             if (rs != null) {
                 try {
@@ -708,7 +708,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
                 }
             }
 
-            return new GridIndexingFieldsResultAdapter(meta, new FieldsIterator(rs));
+            return new IndexingFieldsResultAdapter(meta, new FieldsIterator(rs));
         }
         finally {
             setFilters(null);
@@ -869,9 +869,9 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
      * @throws org.apache.ignite.spi.IgniteSpiException If failed.
      */
     @SuppressWarnings("unchecked")
-    @Override public <K, V> IgniteSpiCloseableIterator<GridIndexingKeyValueRow<K, V>> query(@Nullable String spaceName,
-        final String qry, @Nullable final Collection<Object> params, GridIndexingTypeDescriptor type,
-        final GridIndexingQueryFilter filters) throws IgniteSpiException {
+    @Override public <K, V> IgniteSpiCloseableIterator<IndexingKeyValueRow<K, V>> query(@Nullable String spaceName,
+        final String qry, @Nullable final Collection<Object> params, IndexingTypeDescriptor type,
+        final IndexingQueryFilter filters) throws IgniteSpiException {
         final TableDescriptor tbl = tableDescriptor(spaceName, type);
 
         if (tbl == null)
@@ -900,7 +900,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
      *
      * @param filters Filters.
      */
-    private void setFilters(@Nullable GridIndexingQueryFilter filters) {
+    private void setFilters(@Nullable IndexingQueryFilter filters) {
         GridH2IndexBase.setFiltersForThread(filters);
     }
 
@@ -962,7 +962,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
      * @param type Type description.
      * @throws org.apache.ignite.spi.IgniteSpiException In case of error.
      */
-    @Override public boolean registerType(@Nullable String spaceName, GridIndexingTypeDescriptor type)
+    @Override public boolean registerType(@Nullable String spaceName, IndexingTypeDescriptor type)
         throws IgniteSpiException {
         if (!validateTypeDescriptor(spaceName, type))
             return false;
@@ -1023,7 +1023,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
      * @return True if type is valid.
      * @throws org.apache.ignite.spi.IgniteSpiException If validation failed.
      */
-    private boolean validateTypeDescriptor(@Nullable String spaceName, GridIndexingTypeDescriptor type)
+    private boolean validateTypeDescriptor(@Nullable String spaceName, IndexingTypeDescriptor type)
         throws IgniteSpiException {
         assert type != null;
 
@@ -1152,7 +1152,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
      * @param type Value type descriptor.
      * @return Table descriptor or {@code null} if not found.
      */
-    @Nullable private TableDescriptor tableDescriptor(@Nullable String spaceName, GridIndexingTypeDescriptor type) {
+    @Nullable private TableDescriptor tableDescriptor(@Nullable String spaceName, IndexingTypeDescriptor type) {
         return tableDescriptor(type.name(), spaceName);
     }
 
@@ -1201,7 +1201,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
     }
 
     /** {@inheritDoc} */
-    @Override public void rebuildIndexes(@Nullable String spaceName, GridIndexingTypeDescriptor type) {
+    @Override public void rebuildIndexes(@Nullable String spaceName, IndexingTypeDescriptor type) {
         if (offheap != null)
             throw new UnsupportedOperationException("Index rebuilding is not supported when off-heap memory is used");
 
@@ -1214,19 +1214,19 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
     }
 
     /** {@inheritDoc} */
-    @Override public long size(@Nullable String spaceName, GridIndexingTypeDescriptor type) throws IgniteSpiException {
+    @Override public long size(@Nullable String spaceName, IndexingTypeDescriptor type) throws IgniteSpiException {
         TableDescriptor tbl = tableDescriptor(spaceName, type);
 
         if (tbl == null)
             return -1;
 
-        IgniteSpiCloseableIterator<List<GridIndexingEntity<?>>> iter = queryFields(spaceName,
+        IgniteSpiCloseableIterator<List<IndexingEntity<?>>> iter = queryFields(spaceName,
             "SELECT COUNT(*) FROM " + tbl.fullTableName(), null, null).iterator();
 
         if (!iter.hasNext())
             throw new IllegalStateException();
 
-        return ((GridIndexingEntityAdapter<Number>)iter.next().get(0)).value().longValue();
+        return ((IndexingEntityAdapter<Number>)iter.next().get(0)).value().longValue();
     }
 
     /** {@inheritDoc} */
@@ -1724,7 +1724,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
     }
 
     /** {@inheritDoc} */
-    @Override public void registerMarshaller(GridIndexingMarshaller marshaller) {
+    @Override public void registerMarshaller(IndexingMarshaller marshaller) {
         this.marshaller = marshaller;
     }
 
@@ -1943,7 +1943,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
         private final String fullTblName;
 
         /** */
-        private final GridIndexingTypeDescriptor type;
+        private final IndexingTypeDescriptor type;
 
         /** */
         private final String spaceName;
@@ -1961,7 +1961,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
          * @param spaceName Space name.
          * @param type Type descriptor.
          */
-        TableDescriptor(@Nullable String spaceName, GridIndexingTypeDescriptor type) {
+        TableDescriptor(@Nullable String spaceName, IndexingTypeDescriptor type) {
             this.spaceName = spaceName;
             this.type = type;
 
@@ -1994,7 +1994,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
         /**
          * @return Type.
          */
-        GridIndexingTypeDescriptor type() {
+        IndexingTypeDescriptor type() {
             return type;
         }
 
@@ -2020,9 +2020,9 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
                 }
             }
 
-            for (Map.Entry<String, GridIndexDescriptor> e : type.indexes().entrySet()) {
+            for (Map.Entry<String, IndexDescriptor> e : type.indexes().entrySet()) {
                 String name = e.getKey();
-                GridIndexDescriptor idx = e.getValue();
+                IndexDescriptor idx = e.getValue();
 
                 if (idx.type() == FULLTEXT) {
                     try {
@@ -2064,7 +2064,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
     /**
      * Special field set iterator based on database result set.
      */
-    private static class FieldsIterator extends GridH2ResultSetIterator<List<GridIndexingEntity<?>>> {
+    private static class FieldsIterator extends GridH2ResultSetIterator<List<IndexingEntity<?>>> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -2077,12 +2077,12 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
         }
 
         /** {@inheritDoc} */
-        @Override protected List<GridIndexingEntity<?>> createRow() {
-            List<GridIndexingEntity<?>> res = new ArrayList<>(row.length);
+        @Override protected List<IndexingEntity<?>> createRow() {
+            List<IndexingEntity<?>> res = new ArrayList<>(row.length);
 
             for (Object val : row) {
-                res.add(val instanceof GridIndexingEntity ? (GridIndexingEntity<?>)val :
-                    new GridIndexingEntityAdapter<>(val, null));
+                res.add(val instanceof IndexingEntity ? (IndexingEntity<?>)val :
+                    new IndexingEntityAdapter<>(val, null));
             }
 
             return res;
@@ -2092,7 +2092,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
     /**
      * Special key/value iterator based on database result set.
      */
-    private static class KeyValIterator<K, V> extends GridH2ResultSetIterator<GridIndexingKeyValueRow<K, V>> {
+    private static class KeyValIterator<K, V> extends GridH2ResultSetIterator<IndexingKeyValueRow<K, V>> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -2105,19 +2105,19 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
         }
 
         /** {@inheritDoc} */
-        @Override protected GridIndexingKeyValueRow<K, V> createRow() {
+        @Override protected IndexingKeyValueRow<K, V> createRow() {
             K key = (K)row[0];
             V val = (V)row[1];
 
-            return new GridIndexingKeyValueRowAdapter<>(new GridIndexingEntityAdapter<>(key, null),
-                new GridIndexingEntityAdapter<>(val, null), null);
+            return new IndexingKeyValueRowAdapter<>(new IndexingEntityAdapter<>(key, null),
+                new IndexingEntityAdapter<>(val, null), null);
         }
     }
 
     /**
      * Field descriptor.
      */
-    private static class SqlFieldMetadata implements GridIndexingFieldMetadata {
+    private static class SqlFieldMetadata implements IndexingFieldMetadata {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -2221,7 +2221,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
      */
     private class RowDescriptor implements GridH2RowDescriptor {
         /** */
-        private final GridIndexingTypeDescriptor type;
+        private final IndexingTypeDescriptor type;
 
         /** */
         private final String[] fields;
@@ -2252,7 +2252,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
          * @param schema Schema.
          * @param keyAsObj Store key as java object.
          */
-        RowDescriptor(GridIndexingTypeDescriptor type, Schema schema, boolean keyAsObj) {
+        RowDescriptor(IndexingTypeDescriptor type, Schema schema, boolean keyAsObj) {
             assert type != null;
             assert schema != null;
 
@@ -2387,7 +2387,7 @@ public class GridH2IndexingSpi extends IgniteSpiAdapter implements GridIndexingS
     private static class H2Serializer implements JavaObjectSerializer {
         /** {@inheritDoc} */
         @Override public byte[] serialize(Object o) throws Exception {
-            return localSpi.get().marshaller.marshal(new GridIndexingEntityAdapter<>(o, null));
+            return localSpi.get().marshaller.marshal(new IndexingEntityAdapter<>(o, null));
         }
 
         /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2AbstractKeyValueRow.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2AbstractKeyValueRow.java b/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2AbstractKeyValueRow.java
index 56d6461..99b778f 100644
--- a/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2AbstractKeyValueRow.java
+++ b/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2AbstractKeyValueRow.java
@@ -11,7 +11,6 @@ package org.gridgain.grid.spi.indexing.h2.opt;
 
 import org.apache.ignite.spi.*;
 import org.gridgain.grid.*;
-import org.gridgain.grid.spi.indexing.*;
 import org.gridgain.grid.util.typedef.internal.*;
 import org.h2.message.*;
 import org.h2.result.*;
@@ -25,7 +24,7 @@ import java.sql.*;
 import java.util.*;
 
 /**
- * Table row implementation based on {@link GridIndexingTypeDescriptor}.
+ * Table row implementation based on {@link org.gridgain.grid.spi.indexing.IndexingTypeDescriptor}.
  */
 public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
     /** */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2IndexBase.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2IndexBase.java b/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2IndexBase.java
index d279e1e..d605d1a 100644
--- a/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2IndexBase.java
+++ b/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2IndexBase.java
@@ -27,7 +27,7 @@ import java.util.*;
  */
 public abstract class GridH2IndexBase extends BaseIndex {
     /** */
-    protected static final ThreadLocal<GridIndexingQueryFilter> filters = new ThreadLocal<>();
+    protected static final ThreadLocal<IndexingQueryFilter> filters = new ThreadLocal<>();
 
     /** */
     protected final int keyCol;
@@ -49,7 +49,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
      *
      * @param fs Filters.
      */
-    public static void setFiltersForThread(GridIndexingQueryFilter fs) {
+    public static void setFiltersForThread(IndexingQueryFilter fs) {
         filters.set(fs);
     }
 
@@ -105,7 +105,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
     protected Iterator<GridH2Row> filter(Iterator<GridH2Row> iter) {
         IgniteBiPredicate<Object, Object> p = null;
 
-        GridIndexingQueryFilter f = filters.get();
+        IndexingQueryFilter f = filters.get();
 
         if (f != null) {
             String spaceName = ((GridH2Table)getTable()).spaceName();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2TreeIndex.java b/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2TreeIndex.java
index ff01b25..ecc89fe 100644
--- a/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridH2TreeIndex.java
@@ -162,7 +162,7 @@ public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridS
 
     /** {@inheritDoc} */
     @Override public long getRowCount(@Nullable Session ses) {
-        GridIndexingQueryFilter f = filters.get();
+        IndexingQueryFilter f = filters.get();
 
         try { // Fast path if we don't need to perform any filtering.
             if (f == null || f.forSpace(((GridH2Table)getTable()).spaceName()) == null)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dec83ed4/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridLuceneIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridLuceneIndex.java b/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridLuceneIndex.java
index 99d9c35..6844093 100644
--- a/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridLuceneIndex.java
+++ b/modules/indexing/src/main/java/org/gridgain/grid/spi/indexing/h2/opt/GridLuceneIndex.java
@@ -46,13 +46,13 @@ public class GridLuceneIndex implements Closeable {
     public static final String EXPIRATION_TIME_FIELD_NAME = "_gg_expires__";
 
     /** */
-    private final GridIndexingMarshaller marshaller;
+    private final IndexingMarshaller marshaller;
 
     /** */
     private final String spaceName;
 
     /** */
-    private final GridIndexingTypeDescriptor type;
+    private final IndexingTypeDescriptor type;
 
     /** */
     private final IndexWriter writer;
@@ -82,8 +82,8 @@ public class GridLuceneIndex implements Closeable {
      * @param storeVal Store value in index.
      * @throws org.apache.ignite.spi.IgniteSpiException If failed.
      */
-    public GridLuceneIndex(GridIndexingMarshaller marshaller, @Nullable GridUnsafeMemory mem,
-        @Nullable String spaceName, GridIndexingTypeDescriptor type, boolean storeVal) throws IgniteSpiException {
+    public GridLuceneIndex(IndexingMarshaller marshaller, @Nullable GridUnsafeMemory mem,
+        @Nullable String spaceName, IndexingTypeDescriptor type, boolean storeVal) throws IgniteSpiException {
         this.marshaller = marshaller;
         this.spaceName = spaceName;
         this.type = type;
@@ -99,10 +99,10 @@ public class GridLuceneIndex implements Closeable {
             throw new IgniteSpiException(e);
         }
 
-        GridIndexDescriptor idx = null;
+        IndexDescriptor idx = null;
 
-        for (GridIndexDescriptor descriptor : type.indexes().values()) {
-            if (descriptor.type() == GridIndexType.FULLTEXT) {
+        for (IndexDescriptor descriptor : type.indexes().values()) {
+            if (descriptor.type() == IndexType.FULLTEXT) {
                 idx = descriptor;
 
                 break;
@@ -137,7 +137,7 @@ public class GridLuceneIndex implements Closeable {
      * @param expires Expiration time.
      * @throws org.apache.ignite.spi.IgniteSpiException If failed.
      */
-    public void store(GridIndexingEntity<?> key, GridIndexingEntity<?> val, byte[] ver, long expires)
+    public void store(IndexingEntity<?> key, IndexingEntity<?> val, byte[] ver, long expires)
         throws IgniteSpiException {
         Document doc = new Document();
 
@@ -197,7 +197,7 @@ public class GridLuceneIndex implements Closeable {
      * @param key Key.
      * @throws org.apache.ignite.spi.IgniteSpiException If failed.
      */
-    public void remove(GridIndexingEntity<?> key) throws IgniteSpiException {
+    public void remove(IndexingEntity<?> key) throws IgniteSpiException {
         try {
             writer.deleteDocuments(new Term(KEY_FIELD_NAME, Base64.encodeBase64String(marshaller.marshal(key))));
         }
@@ -217,8 +217,8 @@ public class GridLuceneIndex implements Closeable {
      * @return Query result.
      * @throws org.apache.ignite.spi.IgniteSpiException If failed.
      */
-    public <K, V> GridCloseableIterator<GridIndexingKeyValueRow<K, V>> query(String qry,
-        GridIndexingQueryFilter filters) throws IgniteSpiException {
+    public <K, V> GridCloseableIterator<IndexingKeyValueRow<K, V>> query(String qry,
+        IndexingQueryFilter filters) throws IgniteSpiException {
         IndexReader reader;
 
         try {
@@ -277,7 +277,7 @@ public class GridLuceneIndex implements Closeable {
     /**
      * Key-value iterator over fulltext search result.
      */
-    private class It<K, V> extends GridCloseableIteratorAdapter<GridIndexingKeyValueRow<K, V>> {
+    private class It<K, V> extends GridCloseableIteratorAdapter<IndexingKeyValueRow<K, V>> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -297,7 +297,7 @@ public class GridLuceneIndex implements Closeable {
         private int idx;
 
         /** */
-        private GridIndexingKeyValueRow<K, V> curr;
+        private IndexingKeyValueRow<K, V> curr;
 
         /**
          * Constructor.
@@ -349,28 +349,28 @@ public class GridLuceneIndex implements Closeable {
 
                 String keyStr = doc.get(KEY_FIELD_NAME);
 
-                GridIndexingEntity<K> k = marshaller.unmarshal(Base64.decodeBase64(keyStr));
+                IndexingEntity<K> k = marshaller.unmarshal(Base64.decodeBase64(keyStr));
 
                 byte[] valBytes = doc.getBinaryValue(VAL_FIELD_NAME);
 
-                GridIndexingEntity<V> v = valBytes != null ? marshaller.<V>unmarshal(valBytes) :
+                IndexingEntity<V> v = valBytes != null ? marshaller.<V>unmarshal(valBytes) :
                     type.valueClass() == String.class ?
-                    new GridIndexingEntityAdapter<>((V)doc.get(VAL_STR_FIELD_NAME), null): null;
+                    new IndexingEntityAdapter<>((V)doc.get(VAL_STR_FIELD_NAME), null): null;
 
                 if (!filter(k.value(), v == null ? null : v.value()))
                     continue;
 
                 byte[] ver = doc.getBinaryValue(VER_FIELD_NAME);
 
-                curr = new GridIndexingKeyValueRowAdapter<>(k, v, ver);
+                curr = new IndexingKeyValueRowAdapter<>(k, v, ver);
 
                 break;
             }
         }
 
         /** {@inheritDoc} */
-        @Override protected GridIndexingKeyValueRow<K, V> onNext() throws GridException {
-            GridIndexingKeyValueRow<K, V> res = curr;
+        @Override protected IndexingKeyValueRow<K, V> onNext() throws GridException {
+            IndexingKeyValueRow<K, V> res = curr;
 
             findNext();