Package com.browseengine.bobo.util

Examples of com.browseengine.bobo.util.BigIntArray


  @Override
  public FacetDataCache load(BoboIndexReader reader) throws IOException {
    int maxDoc = reader.maxDoc();

    BigIntArray order = new BigIntArray(maxDoc);

    TermValueList mterms = _termListFactory == null ? new TermStringList() : _termListFactory.createTermList();
   
    IntArrayList minIDList=new IntArrayList();
      IntArrayList maxIDList=new IntArrayList();
      IntArrayList freqList = new IntArrayList();
     
    TermDocs termDocs = null;
    TermEnum termEnum = null;
    int t = 0; // current term number
    mterms.add(null);
    minIDList.add(-1);
      maxIDList.add(-1);
      freqList.add(0);
    t++;
    try {
      termDocs = reader.termDocs();
      termEnum = reader.terms(new Term(_indexFieldName, ""));
      do {
        if (termEnum == null)
          break;
        Term term = termEnum.term();
        if (term == null || !_indexFieldName.equals(term.field()))
          break;

        // store term text
        // we expect that there is at most one term per document
        if (t > MAX_VAL_COUNT) {
          throw new IOException("maximum number of value cannot exceed: "
              + MAX_VAL_COUNT);
        }
        String val = term.text();
        mterms.add(val);
        int bit = (0x00000001 << (t-1));
        termDocs.seek(termEnum);
        //freqList.add(termEnum.docFreq());  // removed because the df doesn't take into account the num of deletedDocs
        int df = 0;
        int minID=-1;
            int maxID=-1;
            if(termDocs.next())
            {
              df++;
                  int docid = termDocs.doc();
                  order.add(docid, order.get(docid) | bit);
                  minID = docid;
                  while (termDocs.next())
              {
                    df++;
                    docid = termDocs.doc();
                    order.add(docid, order.get(docid) | bit);
              }
          maxID = docid;
            }
              freqList.add(df);
        minIDList.add(minID);
View Full Code Here


 
  static void time1(final int[][] array)
  {
    int iter = array.length;
    final BigIntArray bigArray = new BigIntArray(max);
    Thread[] threads=new Thread[iter];
   
    for (int i=0;i<iter;++i)
    {
      threads[i]=new RunnerThread2(array[i],bigArray);
View Full Code Here

   
    for (int i=0;i<numVals;++i){
      cache.valArray.add(formatter.format(i+1));
    }
    cache.valArray.seal();
    cache.orderArray = new BigIntArray(numDocsPerSeg);
    return cache;
  }
View Full Code Here

public class BigIntArrayTest extends TestCase
{
  public static void testBigIntArray()
  {
    int count = 5000000;
    BigIntArray test = new BigIntArray(count);
    int[] test2 = new int[count];
    for (int i = 0; i < count; i++)
    {
      test.add(i, i);
      test2[i]=i;
    }
   
    for (int i = 0; i< count; i++)
    {
      assertEquals(0, test.get(0));
    }
   
    int k = 0;
    long start = System.currentTimeMillis();
    for (int i = 0; i < count; i++)
    {
      k = test.get(i);
    }
    long end = System.currentTimeMillis();
    System.out.println("Big array took: "+(end-start));
   
    start = System.currentTimeMillis();
View Full Code Here

      return new BigByteArray(maxDoc);
    }
    else if (termCountSize == TermCountSize.medium){
      return new BigShortArray(maxDoc);
    }
    else return new BigIntArray(maxDoc);
  }
View Full Code Here

import com.browseengine.bobo.util.LazyBigIntArray;

public class BigSegmentedArrayTest extends TestCase {

  public static void testEmptyArray() {
    emptyArrayTestHelper(new BigIntArray(0));
    emptyArrayTestHelper(new BigByteArray(0));
    emptyArrayTestHelper(new BigShortArray(0));
    emptyArrayTestHelper(new LazyBigIntArray(0));
  }
View Full Code Here

    assertEquals(0, array.get(0));
    assertEquals(0, array.size());
  }

  public static void testCountUp() {
    countUpTestHelper(new BigIntArray(Short.MAX_VALUE * 2));
    countUpTestHelper(new LazyBigIntArray(Short.MAX_VALUE * 2));
    countUpTestHelper(new BigShortArray(Short.MAX_VALUE * 2));
    countUpTestHelper(new BigByteArray(Short.MAX_VALUE * 2));
  }
View Full Code Here

      assertEquals(i % array.maxValue(), array.get(i));
    }
  }

  public static void testFindValues() {
    findValueHelper(new BigIntArray(Short.MAX_VALUE * 2));
    findValueHelper(new LazyBigIntArray(Short.MAX_VALUE * 2));
    findValueHelper(new BigShortArray(Short.MAX_VALUE * 2));
    findValueHelper(new BigByteArray(Short.MAX_VALUE * 2));
  }
View Full Code Here

    assertEquals(DocIdSetIterator.NO_MORE_DOCS, array.findValue(b, 2000, 3000));
    assertEquals(4000, array.findValue(c, 4000, 4000));
  }

  public static void testFindValueRange() {
    findValueRangeHelper(new BigIntArray(Short.MAX_VALUE * 2));
    findValueRangeHelper(new LazyBigIntArray(Short.MAX_VALUE * 2));
    findValueRangeHelper(new BigShortArray(Short.MAX_VALUE * 2));
    findValueRangeHelper(new BigByteArray(Short.MAX_VALUE * 2));
  }
View Full Code Here

    assertEquals(10000, array.findValueRange(b, e, 9000, 10000));
    assertEquals(10000, array.findValueRange(b, b, 9000, 10000));
  }

  public static void testFill() {
    fillTestHelper(new BigIntArray(Short.MAX_VALUE << 1));
    fillTestHelper(new LazyBigIntArray(Short.MAX_VALUE << 1));
    fillTestHelper(new BigShortArray(Short.MAX_VALUE << 1));
    fillTestHelper(new BigByteArray(Short.MAX_VALUE << 1));
  }
View Full Code Here

TOP

Related Classes of com.browseengine.bobo.util.BigIntArray

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.