Package com.browseengine.bobo.util

Examples of com.browseengine.bobo.util.LazyBigIntArray


      _ospec = ospec;
      _isAggregated = false;
      _start = start;
      _end = end;
      _unit = unit;
      _count = new LazyBigIntArray(countArraySize());
    }
View Full Code Here


      for (int i=0;i<_subcollectors.length;++i){
        _lens[i]=_subcollectors[i]._countlength;
        totalLen*=_lens[i];
      }
      _countlength = totalLen;
      _count = new LazyBigIntArray(_countlength);
      _maxdoc = maxdoc;
    }
View Full Code Here

  public RangeFacetCountCollector(String name,FacetDataCache dataCache,int docBase,FacetSpec ospec,List<String> predefinedRanges)
  {
    _name = name;
    _dataCache = dataCache;
    _countlength = _dataCache.freqs.length;
    _count= new LazyBigIntArray(_countlength);
    _array = _dataCache.orderArray;
    _docBase = docBase;
    _ospec=ospec;
    if(predefinedRanges != null) {
      _predefinedRanges = new TermStringList();
View Full Code Here

  public BigSegmentedArray getCountDistribution()
  {
    BigSegmentedArray dist;
    if (_predefinedRangeIndexes!=null)
    {
      dist = new LazyBigIntArray(_predefinedRangeIndexes.length);
      int n=0;
      for (int[] range : _predefinedRangeIndexes)
      {
        int start = range[0];
        int end = range[1];
View Full Code Here

      {
        int minCount=_ospec.getMinHitCount();
        int maxNumOfFacets = _ospec.getMaxCount();
        if (maxNumOfFacets <= 0 || maxNumOfFacets > _predefinedRangeIndexes.length) maxNumOfFacets = _predefinedRangeIndexes.length;
       
        BigSegmentedArray rangeCount = new LazyBigIntArray(_predefinedRangeIndexes.length);
      
        for (int k=0;k<_predefinedRangeIndexes.length;++k)
        {
          int count = 0;
          int idx = _predefinedRangeIndexes[k][0];
          int end = _predefinedRangeIndexes[k][1];
          while(idx <= end)
          {
            count += _count.get(idx++);
          }
          rangeCount.add(k, count);
        }
       
        List<BrowseFacet> facetColl;
        FacetSortSpec sortspec = _ospec.getOrderBy();
        if (sortspec == FacetSortSpec.OrderValueAsc)
        {
          facetColl = new ArrayList<BrowseFacet>(maxNumOfFacets);
          for (int k=0;k<_predefinedRangeIndexes.length;++k)
          {
            if(rangeCount.get(k) >= minCount)
            {
              BrowseFacet choice=new BrowseFacet(_predefinedRanges.get(k), rangeCount.get(k));
              facetColl.add(choice);
            }
            if(facetColl.size() >= maxNumOfFacets) break;
          }
        }
        else //if (sortspec == FacetSortSpec.OrderHitsDesc)
        {
          ComparatorFactory comparatorFactory;
          if (sortspec == FacetSortSpec.OrderHitsDesc)
          {
            comparatorFactory = new FacetHitcountComparatorFactory();
          }
          else
          {
            comparatorFactory = _ospec.getCustomComparatorFactory();
          }

          if (comparatorFactory == null){
            throw new IllegalArgumentException("facet comparator factory not specified");
          }

          final IntComparator comparator = comparatorFactory.newComparator(new FieldValueAccessor(){
              public String getFormatedValue(int index)
              {
                return _predefinedRanges.get(index);
              }

              public Object getRawValue(int index) {
                return _predefinedRanges.getRawValue(index);
              }
            }, rangeCount);
         
          final int forbidden = -1;
          IntBoundedPriorityQueue pq=new IntBoundedPriorityQueue(comparator, maxNumOfFacets, forbidden);
          for (int i=0; i<_predefinedRangeIndexes.length; ++i)
          {
            if (rangeCount.get(i)>=minCount)   pq.offer(i);
          }

          int val;
          facetColl=new LinkedList<BrowseFacet>();
          while((val = pq.pollInt()) != forbidden)
          {
            BrowseFacet facet=new BrowseFacet(_predefinedRanges.get(val),rangeCount.get(val));
            ((LinkedList<BrowseFacet>)facetColl).addFirst(facet);
          }
        }
        return facetColl;
      }
View Full Code Here

    // TODO Auto-generated method stub
  }   

  public FacetIterator iterator() {
    if(_predefinedRanges != null) {
      BigSegmentedArray rangeCounts = new LazyBigIntArray(_predefinedRangeIndexes.length);
          for (int k=0;k<_predefinedRangeIndexes.length;++k)
          {
            int count = 0;
            int idx = _predefinedRangeIndexes[k][0];
            int end = _predefinedRangeIndexes[k][1];
            while(idx <= end)
            {
              count += _count.get(idx++);
            }
            rangeCounts.add(k, rangeCounts.get(k) + count);
          }
      return new DefaultFacetIterator(_predefinedRanges, rangeCounts, rangeCounts.size(), true);
    }
    return null;
 
View Full Code Here

   * @see com.browseengine.bobo.facets.FacetCountCollector#getCountDistribution()
   */
  public BigSegmentedArray getCountDistribution() {
    BigSegmentedArray dist = null;
    if(_latPredefinedRangeIndexes != null) {
      dist = new LazyBigIntArray(_latPredefinedRangeIndexes.length);
      int n = 0;
      int start;
      int end;
      for(int[] range: _latPredefinedRangeIndexes) {
        start = range[0];
View Full Code Here

  }
 
  public FacetIterator iterator() {
    // each range is of the form <lat, lon, radius>
    LazyBigIntArray rangeCounts = new LazyBigIntArray(_latPredefinedRangeIndexes.length);
    for (int i=0;i<_latCount.length;++i){
      if (_latCount[i] >0 ){
        for (int k=0;k<_latPredefinedRangeIndexes.length;++k)
        {
          if (i>=_latPredefinedRangeIndexes[k][0] && i<=_latPredefinedRangeIndexes[k][1])
          {
            rangeCounts.add(k, rangeCounts.get(k) + _latCount[i]);
          }
        }
      }
    }
    return new DefaultFacetIterator(_predefinedRanges, rangeCounts, rangeCounts.size(), true);
 
View Full Code Here

   */
  @Override
  public BigSegmentedArray getCountDistribution() {
    BigSegmentedArray dist = null;
    if (_latPredefinedRangeIndexes != null) {
      dist = new LazyBigIntArray(_latPredefinedRangeIndexes.length);
      int n = 0;
      int start;
      int end;
      for (int[] range : _latPredefinedRangeIndexes) {
        start = range[0];
View Full Code Here

  }

  @Override
  public FacetIterator iterator() {
    // each range is of the form <lat, lon, radius>
    LazyBigIntArray rangeCounts = new LazyBigIntArray(_latPredefinedRangeIndexes.length);
    for (int i = 0; i < _latCount.length; ++i) {
      if (_latCount[i] > 0) {
        for (int k = 0; k < _latPredefinedRangeIndexes.length; ++k) {
          if (i >= _latPredefinedRangeIndexes[k][0] && i <= _latPredefinedRangeIndexes[k][1]) {
            rangeCounts.add(k, rangeCounts.get(k) + _latCount[i]);
          }
        }
      }
    }
    return new DefaultFacetIterator(_predefinedRanges, rangeCounts, rangeCounts.size(), true);
  }
View Full Code Here

TOP

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

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.