Class MapIndex<K,V>

java.lang.Object
com.loomcache.server.query.MapIndex<K,V>

public class MapIndex<K,V> extends Object
In-memory secondary index on a map column. Supports different index types: SORTED (TreeMap), HASH (HashMap), BITMAP (for low-cardinality).
  • Constructor Details

    • MapIndex

      public MapIndex(IndexConfig config)
      Creates a new index with the specified configuration.
  • Method Details

    • put

      public void put(K key, @Nullable Object columnValue)
      Adds or updates an entry in the index. Atomically removes the old index entry if the column value changed.
      Parameters:
      key - the map key
      columnValue - the value of the indexed column
    • remove

      public void remove(K key, @Nullable Object columnValue)
      Removes an entry from the index. Uses the tracked value rather than relying on the caller.
      Parameters:
      key - the map key
      columnValue - retained for API compatibility; tracked state is authoritative
    • lookup

      public Set<K> lookup(@Nullable Object value)
      Looks up keys that match the exact value.
    • lookupPrefix

      public Set<K> lookupPrefix(List<?> prefixValues)
      Looks up keys matching a leftmost prefix of a composite index.
    • rangeQuery

      public Set<K> rangeQuery(Object from, Object to, boolean includeFrom, boolean includeTo)
      Looks up keys in a range (for SORTED indexes only).
    • size

      public int size()
      Returns the number of unique indexed values.