Package com.browseengine.bobo.util

Examples of com.browseengine.bobo.util.BigSegmentedArray


    public DocComparator getComparator(AtomicReader reader, int docbase) throws IOException {
      if (!(reader instanceof BoboSegmentReader)) throw new IllegalStateException(
          "reader not instance of " + BoboSegmentReader.class);
      BoboSegmentReader boboReader = (BoboSegmentReader) reader;
      final FacetDataCache<?> dataCache = _facetHandler.getFacetData(boboReader);
      final BigSegmentedArray orderArray = dataCache.orderArray;
      return new DocComparator() {
        @Override
        public Comparable<?> value(ScoreDoc doc) {
          int index = orderArray.get(doc.doc);
          return dataCache.valArray.getComparableValue(index);
        }

        @Override
        public int compare(ScoreDoc doc1, ScoreDoc doc2) {
          return orderArray.get(doc1.doc) - orderArray.get(doc2.doc);
        }
      };
    }
View Full Code Here


  }
  public HashMap<String, IntContainer> map(int[] docIds, int docIdCount, long[] uids, FieldAccessor accessor, FacetCountAccessor facetCountAccessor) {
    if (!facetCountAccessor.areFacetCountsPresent()) {
      return null;
    }
    BigSegmentedArray countDistribution = facetCountAccessor.getFacetCollector(column).getCountDistribution();
    TermValueList termValueList = accessor.getTermValueList(column);
    HashMap<String, IntContainer> ret = new HashMap<String, IntContainer>(countDistribution.size());
    for (int i = 0; i < countDistribution.size(); i++) {
      ret.put(termValueList.get(i), new IntContainer(countDistribution.get(i)));
    }
    return ret;
  }
View Full Code Here

      this._xValArray = xVals;
      this._yValArray = yVals;
      this._zValArray = zVals;

      BigSegmentedArray latOrderArray = latCache.orderArray;
      TermValueList<?> latValList = latCache.valArray;

      BigSegmentedArray lonOrderArray = lonCache.orderArray;
      TermValueList<?> lonValList = lonCache.valArray;

      for (int i = 0; i < maxDoc; ++i) {
        String docLatString = latValList.get(latOrderArray.get(i)).trim();
        String docLonString = lonValList.get(lonOrderArray.get(i)).trim();

        float docLat = 0;
        if (docLatString.length() > 0) {
          docLat = Float.parseFloat(docLatString);
        }
View Full Code Here

    _facetDataFetcher.cleanup(reader);

    int maxDoc = reader.maxDoc();
    int size = dataMap == null ? 1 : (dataMap.size() + 1);

    BigSegmentedArray order = new BigIntArray(maxDoc);
    TermValueList<?> list = _termListFactory == null ? new TermStringList(size) : _termListFactory
        .createTermList(size);

    int[] freqs = new int[size];
    int[] minIDs = new int[size];
    int[] maxIDs = new int[size];

    list.add(null);
    freqs[0] = nullFreq;
    minIDs[0] = nullMinId;
    maxIDs[0] = nullMaxId;

    if (dataMap != null) {
      int i = 1;
      Integer docId;
      for (Map.Entry<Object, LinkedList<Integer>> entry : dataMap.entrySet()) {
        list.add(list.format(entry.getKey()));
        docList = entry.getValue();
        freqs[i] = docList.size();
        minIDs[i] = docList.get(0);
        while ((docId = docList.poll()) != null) {
          doc = docId;
          order.add(docId, i);
        }
        maxIDs[i] = doc;
        ++i;
      }
    }
View Full Code Here

  private BigSegmentedArray getCollapsedCounts() {
    if (_collapsedCounts == null) {
      _collapsedCounts = new LazyBigIntArray(_bucketValues.size());
      FacetDataCache<?> dataCache = _subCollector._dataCache;
      TermValueList<?> subList = dataCache.valArray;
      BigSegmentedArray subcounts = _subCollector._count;
      FixedBitSet indexSet = new FixedBitSet(subcounts.size());
      int c = 0;
      int i = 0;
      for (String val : _bucketValues) {
        if (val.length() > 0) {
          String[] subVals = _predefinedBuckets.get(val);
          int count = 0;
          for (String subVal : subVals) {
            int index = subList.indexOf(subVal);
            if (index > 0) {
              int subcount = subcounts.get(index);
              count += subcount;
              if (!indexSet.get(index)) {
                indexSet.set(index);
                c += dataCache.freqs[index];
              }
View Full Code Here

    int index = _bucketValues.indexOf(bucketValue);
    if (index < 0) {
      return new BrowseFacet(bucketValue, 0);
    }

    BigSegmentedArray counts = getCollapsedCounts();

    return new BrowseFacet(bucketValue, counts.get(index));
  }
View Full Code Here

    int index = _bucketValues.indexOf(value);
    if (index < 0) {
      return 0;
    }

    BigSegmentedArray counts = getCollapsedCounts();

    return counts.get(index);
  }
View Full Code Here

  // get facets for all predefined buckets
  @Override
  public List<BrowseFacet> getFacets() {

    BigSegmentedArray counts = getCollapsedCounts();
    return DefaultFacetCountCollector.getFacets(_ospec, counts, counts.size(), _bucketValues);

  }
View Full Code Here

    _subCollector.close();
  }

  @Override
  public FacetIterator iterator() {
    BigSegmentedArray counts = getCollapsedCounts();
    return new DefaultFacetIterator(_bucketValues, counts, counts.size(), true);
  }
View Full Code Here

      bits |= 0x00000001 << (i - 1);
    }

    final int finalBits = bits;

    final BigSegmentedArray orderArray = dataCache.orderArray;

    if (indexes.length == 0) {
      return EmptyDocIdSet.getInstance();
    } else {
      return new RandomAccessDocIdSet() {
        @Override
        public DocIdSetIterator iterator() {
          return new CompactMultiValueFacetDocIdSetIterator(dataCache, indexes, finalBits);
        }

        @Override
        final public boolean get(int docId) {
          return (orderArray.get(docId) & finalBits) != 0x0;
        }
      };
    }
  }
View Full Code Here

TOP

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

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.