Interface Indexer


  • public interface Indexer
    This class is registered with a Backend and it provides callbacks for indexing attribute values. An index implementation will use this interface to create the keys for an attribute value.
    • Method Detail

      • getIndexId

        String getIndexId()
        Returns an index identifier associated with this indexer. An identifier should be selected based on the matching rule type. A unique identifier will map to a unique index database in the backend implementation. If multiple matching rules need to share the index database, the corresponding indexers should always use the same identifier.
        Returns:
        index ID A String containing the ID associated with this indexer.
      • createKeys

        void createKeys​(ByteString value,
                        Consumer<ByteString> keyConsumer)
                 throws DecodeException
        Generates the set of index keys for an attribute.
        Parameters:
        value - The attribute value for which keys are required.
        keyConsumer - A consumer that will be invoked for each created keys.
        Throws:
        DecodeException - if an error occurs while normalizing the value
      • keyToHumanReadableString

        String keyToHumanReadableString​(ByteString key)
        Returns a human readable representation of the key. Does a best effort conversion from an index key to a string that can be printed, as used by the diagnostic tools, which are the only users of the method. It is not necessary for the resulting string to exactly match the value it was generated from.
        Parameters:
        key - the byte string for the index key.
        Returns:
        a human readable representation of the key