org.apache.cassandra.db.index.keys

## Class KeysIndex

- java.lang.Object
- - org.apache.cassandra.db.index.SecondaryIndex
  - - org.apache.cassandra.db.index.PerColumnSecondaryIndex
    - - org.apache.cassandra.db.index.AbstractSimplePerColumnSecondaryIndex
      - - org.apache.cassandra.db.index.keys.KeysIndex

    public class KeysIndex
    extends AbstractSimplePerColumnSecondaryIndex

Implements a secondary index for a column family using a second column family. The design uses inverted index http://en.wikipedia.org/wiki/Inverted_index. The row key is the indexed value. For example, if we're indexing a column named city, the index value of city is the row key. The column names are the keys of the records. To see a detailed example, please refer to wikipedia.

### Field Summary

### Fields inherited from class org.apache.cassandra.db.index.AbstractSimplePerColumnSecondaryIndex

`columnDef, indexCfs`

### Fields inherited from class org.apache.cassandra.db.index.SecondaryIndex

`baseCfs, columnDefs, CUSTOM_INDEX_OPTION_NAME, INDEX_ENTRIES_OPTION_NAME, INDEX_KEYS_OPTION_NAME, INDEX_VALUES_OPTION_NAME, keyComparator, logger`

### Constructor Summary

Constructors
Constructor and Description
`KeysIndex()`

### Method Summary

All Methods Instance Methods Concrete Methods
`SecondaryIndexSearcher` `createSecondaryIndexSearcher(java.util.Set<java.nio.ByteBuffer> columns)` Called at query time Creates a implementation specific searcher instance for this index type
`protected AbstractType` `getExpressionComparator()`
`protected java.nio.ByteBuffer` `getIndexedValue(java.nio.ByteBuffer rowKey, Cell cell)`
`boolean` `indexes(CellName name)` Returns true if the provided cell name is indexed by this secondary index.
`boolean` `isIndexEntryStale(java.nio.ByteBuffer indexedValue, ColumnFamily data, long now)`
`protected CellName` `makeIndexColumnName(java.nio.ByteBuffer rowKey, Cell cell)`
`void` `validateOptions()` Validates the index_options passed in the ColumnDef

### Methods inherited from class org.apache.cassandra.db.index.AbstractSimplePerColumnSecondaryIndex

`delete, deleteForCleanup, estimateResultRows, expressionString, forceBlockingFlush, getIndexCfs, getIndexKeyComparator, getIndexName, init, insert, invalidate, reload, removeIndex, truncateBlocking, update, validate`

### Methods inherited from class org.apache.cassandra.db.index.PerColumnSecondaryIndex

`getNameForSystemKeyspace, validate`

### Methods inherited from class org.apache.cassandra.db.index.SecondaryIndex

`buildIndexAsync, buildIndexBlocking, createInstance, getBaseCfs, getColumnDefs, getIndexComparator, getIndexKeyFor, indexes, isIndexBuilt, isQueryable, setIndexBuilt, setIndexRemoved, supportsOperator, toString`

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

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

### Constructor Detail

#### KeysIndex

    public KeysIndex()

### Method Detail

#### getIndexedValue

    protected java.nio.ByteBuffer getIndexedValue(java.nio.ByteBuffer rowKey,
                                                  Cell cell)

Specified by:
  `getIndexedValue` in class `AbstractSimplePerColumnSecondaryIndex`

#### makeIndexColumnName

    protected CellName makeIndexColumnName(java.nio.ByteBuffer rowKey,
                                           Cell cell)

Specified by:
  `makeIndexColumnName` in class `AbstractSimplePerColumnSecondaryIndex`

#### createSecondaryIndexSearcher

    public SecondaryIndexSearcher createSecondaryIndexSearcher(java.util.Set<java.nio.ByteBuffer> columns)

Description copied from class: `SecondaryIndex`
Called at query time Creates a implementation specific searcher instance for this index type

Specified by:
  `createSecondaryIndexSearcher` in class `SecondaryIndex`
Parameters:
  `columns` - the list of columns which belong to this index type
Returns:
  the secondary index search impl

#### isIndexEntryStale

    public boolean isIndexEntryStale(java.nio.ByteBuffer indexedValue,
                                     ColumnFamily data,
                                     long now)

#### validateOptions

    public void validateOptions()
                         throws ConfigurationException

Description copied from class: `SecondaryIndex`
Validates the index_options passed in the ColumnDef

Specified by:
  `validateOptions` in class `SecondaryIndex`
Throws:
  `ConfigurationException`

#### indexes

    public boolean indexes(CellName name)

Description copied from class: `SecondaryIndex`
Returns true if the provided cell name is indexed by this secondary index. The default implementation checks whether the name is one the columnDef name, but this should be overriden but subclass if needed.

Specified by:
  `indexes` in class `SecondaryIndex`

#### getExpressionComparator

    protected AbstractType getExpressionComparator()

Specified by:
  `getExpressionComparator` in class `AbstractSimplePerColumnSecondaryIndex`