While consulting indexes to conduct a search, a determination is made from
time to time as to whether it is more efficient to consult individual
indexes in a set or to merge the indexes and consult the merged index.
The cost of merging indexes is compared with the cost of individually
querying indexes. In accordance with the result of this comparison, the
indexes are merged and the merged index is consulted, or the indexes are
individually consulted. A cost-balance invariant in the form of an
inequality is used to equate the cost of merging indexes to a weighted
cost of individually querying indexes. As query events are received, the
costs are updated. As long as the cost-balance invariant is not violated,
indexes are merged and the merged index is queried. If the cost-balance
invariant is violated, indexes are not merged, and the indexes are
individually queried.