Package cleo.search.util

Examples of cleo.search.util.WeightIteratorFromBytes


    if(connectionsStore.hasIndex(uid)) {
      // Get a byte array from resource pool
      byte[] bytes = getBytesFromPool();
     
      try {
        WeightIteratorFromBytes connStrengthIter = getConnectionStrengthIterator(uid, bytes);
        if(connStrengthIter != null) {
          bytes = connStrengthIter.array();
          int filter = bloomFilter.computeQueryFilter(terms);
          applyFilter(filter, connStrengthIter, collector, selector, hitStats, timeoutMillis);
        }
      } catch(Exception e) {
        getLogger().warn(e.getMessage(), e);
View Full Code Here


    if(connectionsStore.hasIndex(uid)) {
      // Get a byte array from resource pool
      byte[] bytes = getBytesFromPool();
     
      try {
        WeightIteratorFromBytes connStrengthIter = getConnectionStrengthIterator(uid, bytes);
        if(connStrengthIter != null) {
          bytes = connStrengthIter.array();
          int filter = bloomFilter.computeQueryFilter(terms);
          applyFilter(filter, connStrengthIter, collector, selector, uniqIds, hitStats, timeoutMillis);
        }
      } catch(Exception e) {
        getLogger().warn(e.getMessage(), e);
View Full Code Here

       
        try {
          for(int i = 0, cnt = connIds.length; i < cnt; i++) {
            int connectionId = connIds[i];
           
            WeightIteratorFromBytes connStrengthIter = getConnectionStrengthIterator(connectionId, bytes);
            if(connStrengthIter == null) continue;
            bytes = connStrengthIter.array();
           
            applyFilter2(filter, weights[i], connStrengthIter, collector, selector, uniqIds, hitStats, timeout);
            if(collector.canStop()) {
              break;
            }
View Full Code Here

          }
        }
      }
     
      if(lenRead > 0) {
        return new WeightIteratorFromBytes(bytes, 0, lenRead);
      }
    }
   
    return null;
  }
View Full Code Here

    bytes = new byte[0];
    offset = 0;
    length = 0;
   
    // Empty WeightIterator
    iter = new WeightIteratorFromBytes(bytes, offset, length);
    assertEquals(false, iter.hasNext());
   
    // Non-empty WeightIterator
    int cnt = rand.nextInt(100) + 1;
    offset = 0;
    length = cnt * (Weight.ELEMENT_ID_NUM_BYTES + Weight.ELEMENT_WEIGHT_NUM_BYTES);
   
    bytes = new byte[length];
    ByteBuffer bb = ByteBuffer.wrap(bytes);
    ArrayList<Weight> list1 = new ArrayList<Weight>(cnt);
   
    for(int i = 0; i < cnt; i++) {
      Weight weight = new Weight(i, rand.nextInt(10000));
      list1.add(weight);
      bb.putInt(weight.elementId);
      bb.putInt(weight.elementWeight);
    }
   
    ArrayList<Weight> list2 = new ArrayList<Weight>(cnt);
    iter = new WeightIteratorFromBytes(bytes, offset, length);
    while(iter.hasNext()) {
      Weight weight = new Weight(0, 0);
      iter.next(weight);
      list2.add(weight);
    }
   
    ArrayList<Weight> list3 = new ArrayList<Weight>(cnt);
    iter = new WeightIteratorFromBytes(bytes, offset, length);
    while(iter.hasNext()) {
      list3.add(iter.next());
    }
   
    assertEquals(cnt, list1.size());
View Full Code Here

TOP

Related Classes of cleo.search.util.WeightIteratorFromBytes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.