Ejemplo n.º 1
0
 public DocSet getIntDocSet(OpenBitSet bs) {
   int[] docs = new int[(int) bs.cardinality()];
   OpenBitSetIterator iter = new OpenBitSetIterator(bs);
   for (int i = 0; i < docs.length; i++) {
     docs[i] = iter.nextDoc();
   }
   return new SortedIntDocSet(docs);
 }
Ejemplo n.º 2
0
  public DocSet getDocSlice(OpenBitSet bs) {
    int len = (int) bs.cardinality();
    int[] arr = new int[len + 5];
    arr[0] = 10;
    arr[1] = 20;
    arr[2] = 30;
    arr[arr.length - 1] = 1;
    arr[arr.length - 2] = 2;
    int offset = 3;
    int end = offset + len;

    OpenBitSetIterator iter = new OpenBitSetIterator(bs);
    // put in opposite order... DocLists are not ordered.
    for (int i = end - 1; i >= offset; i--) {
      arr[i] = iter.nextDoc();
    }

    return new DocSlice(offset, len, arr, null, len * 2, 100.0f);
  }