core/src/main/java/com/orientechnologies/orient/core/sql/OChainedIndexProxy.java
protected static OIndex<?> findBestIndex(Iterable<OIndex<?>> indexes) {
    OIndex<?> bestIndex = null;
    for (OIndex<?> index : indexes) {
      if (priorityOfUsage(index) > priorityOfUsage(bestIndex))
        bestIndex = index;
    }
    return bestIndex;
  }
protected static OIndex<?> findBestIndex(Iterable<OIndex<?>> indexes) {
    OIndex<?> bestIndex = null;
    for (OIndex<?> index : indexes) {
      if (priorityOfUsage(index) > priorityOfUsage(bestIndex))
        bestIndex = index;
    }
    return bestIndex;
  }
protected static OIndex < ? > findBestIndex ( Iterable < OIndex < ? > > indexes ) { OIndex < ? > bestIndex = null ; for ( OIndex < ? > index : indexes ) { if ( priorityOfUsage ( index ) > priorityOfUsage ( bestIndex ) ) bestIndex = index ; } return bestIndex ; }
Finds the index that fits better as a base index in chain.
Requirements to the base index:
<ul>
<li>Should be unique or not unique. Other types cannot be used to get all documents with required links.</li>
<li>Should not be composite hash index. As soon as hash index does not support partial match search.</li>
<li>Composite index that ignores null values should not be used.</li>
<li>Hash index is better than tree based indexes.</li>
<li>Non composite indexes is better that composite.</li>
</ul>

@param indexes where search

@return the index that fits better as a base index in chain
Finds the index that fits better as a base index in chain . Requirements to the base index : <ul > <li > Should be unique or not unique . Other types cannot be used to get all documents with required links . < / li > <li > Should not be composite hash index . As soon as hash index does not support partial match search . < / li > <li > Composite index that ignores null values should not be used . < / li > <li > Hash index is better than tree based indexes . < / li > <li > Non composite indexes is better that composite . < / li > < / ul >