anchor.diff:                          if num_comps > num_eq then
                               // we will have one inequality
                               let ineq = matching_comps.[num_eq]
  +                            // assert ineq is an array of comparisons, but there are no EQs in it.
  +                            // we will use either one or two of them in the bounds of the index scan.
  +                            // TODO should we determine those bounds now?
                               if num_eq>0 then
                                   (Some matching_eqs, Some ineq, None) |> Some
                               else
  
positive.code:                 else
                      // we have some scalar keys, and maybe a text index after it.
                      // for every scalar key, find comparisons from the query.
                      // TODO do we really care about more than one comp per key?
                      // TODO what if the comps have incompatible comparisons for a given key?
                      // TODO like two EQs with different values?  or GT 0 AND LT 0?
                      let matching_comps = Array.map (fun (k,typ) -> (k, Array.choose (fun (op,km,v) -> if k=km then Some (op,v) else None) comps)) scalar_keys
                      let first_no_comps = Array.tryFindIndex (fun (k,acomps) -> 0 = Array.length acomps) matching_comps
                      let matching_eqs = Array.map (fun (k,acomps) -> (k, Array.choose (fun (op,v) -> if op=plan.EQ then Some v else None) acomps)) matching_comps
                      let first_no_eqs = Array.tryFindIndex (fun (k,acomps) -> 0 = Array.length acomps) matching_eqs
                      match text with
                      | Some tq ->
                          match first_no_eqs with
                          | Some _ ->
                              // if there is a text index, we need an EQ for every scalar key.
  
negative.code:                     | Some ndx -> (op,k,ndx,[| v |]) |> Some
                      | None -> None
          ) comps
  
      let private findFitIndexes indexes m =
          let textQuery = findTextQuery m
          let comps = findUsableCompares m
          Array.choose (fun ndx ->
              match tryFitIndexToQuery ndx comps textQuery with
              | Some fit -> (ndx, fit) |> Some
              | None -> None
          ) indexes
  
      let private chooseFromPossibles possibles =
          if Array.isEmpty possibles then 
  