This package is an extension of the idea of Prolog indexing, usually performed, in a limited way, on the first argument. This package provides more powerful indexing schemes. It lets you pick different arguments to index on, and provides for different combinations of arguments to index on. E.g., it will let you index on the first and third argument or the second and the third argument of a predicate.

Library usage:
This facility is used as a package, thus either including
indexer in the package list of the module, or by using the
use_package/1 declaration. The facility predicate
hash_term/2, documented here, is defined in library module
hash.

Description: Declares an indexing scheme for a predicate. All specs of IndexSpecs must be terms for the same predicate. Each spec declares an indexing on a combination of the arguments. Indexing will be performed using any of the specs in IndexSpecs (being thus interpreted as an or).
You should use a * in an argument position if you wish to hash on the entire term in that argument. If a + is used only one level of the term in the argument is used for hashing. An i is used to indicate that argument is already an integer, and therefore its own value will be used for hashing. The argspec ? simply indicates not to use the argument for indexing.
For example, the index specification:

:- index foo(+,?,*,i), foo(?,?,?,i).

declares indexing for foo/4 either on a combination of the first, third, and fourht arguments, or only on the last argument, which is an integer. In the first case, only the principal functor of the first argument will be used for hashing; the third argument will be used in its entirety.
The argspec n is a pragmatic extension and can not be used in conjunction with the other specifiers aside from ?. It stands for "nonvar" and implies that the argument will not be used for hashing, since only ground terms can effectively be used in hashing. Thus, it can not be used in combination with other specifiers within a particular index specification. It is often the fastest thing to use.

The following properties should hold upon exit:IndexSpecs is an index specification.
(indexer_doc:indexspecs/1)