Package com.browseengine.bobo.facets.data

Examples of com.browseengine.bobo.facets.data.PrimitiveLongArrayWrapper


                                                              int offsetLeft) {

    List<SenseiHit> hitsList = new ArrayList<SenseiHit>(req.getCount());

    // TODO: Pull out the sensei hits extraction from this function
    PrimitiveLongArrayWrapper primitiveLongArrayWrapperTmp = new PrimitiveLongArrayWrapper(null);

    Map<Object, SenseiHit>[] groupHitMaps = new Map[req.getGroupBy().length];
    for (int i=0; i < groupHitMaps.length; ++i)
    {
      groupHitMaps[i] = new HashMap<Object, SenseiHit>(topHits);
    }

    while(mergedIter.hasNext())
    {
      SenseiHit hit = mergedIter.next();
      Object rawGroupValue = extractRawGroupValue(rawGroupValueType, hit.getGroupPosition(), primitiveLongArrayWrapperTmp, hit);

      SenseiHit pre = groupHitMaps[hit.getGroupPosition()].get(rawGroupValue);
      if (pre != null)
      {
        if (offsetLeft <= 0) {
          pre.setGroupHitsCount(pre.getGroupHitsCount()+hit.getGroupHitsCount());
        }
      }
      else
      {
        if (offsetLeft > 0)
          --offsetLeft;
        else if (hitsList.size() < req.getCount())
          hitsList.add(hit);

        if (rawGroupValueType[0] == 2)
          groupHitMaps[hit.getGroupPosition()].put(new PrimitiveLongArrayWrapper(primitiveLongArrayWrapperTmp.data), hit);
        else
          groupHitMaps[hit.getGroupPosition()].put(rawGroupValue, hit);
      }
    }
    return hitsList;
View Full Code Here


      if (groupBy == null) {
        resList = ListMerger.mergeLists(_offset, _count, iterList, MERGE_COMPATATOR);
      } else {
        int rawGroupValueType = 0; // 0: unknown, 1: normal, 2: long[]

        PrimitiveLongArrayWrapper primitiveLongArrayWrapperTmp = new PrimitiveLongArrayWrapper(null);

        Object rawGroupValue = null;

        if (_facetAccessibleLists != null) {
          _groupAccessibles = new CombinedFacetAccessible[_facetAccessibleLists.length];
          for (int i = 0; i < _facetAccessibleLists.length; ++i)
            _groupAccessibles[i] = new CombinedFacetAccessible(new FacetSpec(),
                _facetAccessibleLists[i]);
        }
        resList = new ArrayList<MyScoreDoc>(_count);
        Iterator<MyScoreDoc> mergedIter = ListMerger.mergeLists(iterList, MERGE_COMPATATOR);
        Set<Object> groupSet = new HashSet<Object>(_offset + _count);
        int offsetLeft = _offset;
        while (mergedIter.hasNext()) {
          MyScoreDoc scoreDoc = mergedIter.next();
          Object[] vals = groupBy.getRawFieldValues(scoreDoc.reader, scoreDoc.doc);
          rawGroupValue = null;
          if (vals != null && vals.length > 0) rawGroupValue = vals[0];

          if (rawGroupValueType == 0) {
            if (rawGroupValue != null) {
              if (rawGroupValue instanceof long[]) rawGroupValueType = 2;
              else rawGroupValueType = 1;
            }
          }
          if (rawGroupValueType == 2) {
            primitiveLongArrayWrapperTmp.data = (long[]) rawGroupValue;
            rawGroupValue = primitiveLongArrayWrapperTmp;
          }

          if (!groupSet.contains(rawGroupValue)) {
            if (offsetLeft > 0) --offsetLeft;
            else {
              resList.add(scoreDoc);
              if (resList.size() >= _count) break;
            }
            groupSet.add(new PrimitiveLongArrayWrapper(primitiveLongArrayWrapperTmp.data));
          }
        }
      }
    } else resList = Collections.emptyList();
View Full Code Here

        resList = ListMerger.mergeLists(_offset, _count, iterList, MERGE_COMPATATOR);
      }
      else {
        int rawGroupValueType = 0// 0: unknown, 1: normal, 2: long[]

        PrimitiveLongArrayWrapper primitiveLongArrayWrapperTmp = new PrimitiveLongArrayWrapper(null);

        Object rawGroupValue = null;

        //if (_facetCountCollector != null)
        //{
          //collectTotalGroups();
          //_facetCountCollector = null;
        //}
        if (_facetAccessibleLists != null) {
          _groupAccessibles = new CombinedFacetAccessible[_facetAccessibleLists.length];
          for (int i=0; i<_facetAccessibleLists.length; ++i)
            _groupAccessibles[i] = new CombinedFacetAccessible(new FacetSpec(), _facetAccessibleLists[i]);
        }
        resList = new ArrayList<MyScoreDoc>(_count);
        Iterator<MyScoreDoc> mergedIter = ListMerger.mergeLists(iterList, MERGE_COMPATATOR);
        Set<Object> groupSet = new HashSet<Object>(_offset+_count);
        int offsetLeft = _offset;
        while(mergedIter.hasNext())
        {
          MyScoreDoc scoreDoc = mergedIter.next();
          Object[] vals = groupBy.getRawFieldValues(scoreDoc.reader, scoreDoc.doc);
          rawGroupValue = null;
          if (vals != null && vals.length > 0)
            rawGroupValue = vals[0];

          if (rawGroupValueType == 0) {
            if (rawGroupValue != null)
            {
              if (rawGroupValue instanceof long[])
                rawGroupValueType = 2;
              else
                rawGroupValueType = 1;
            }
          }
          if (rawGroupValueType == 2)
          {
            primitiveLongArrayWrapperTmp.data = (long[])rawGroupValue;
            rawGroupValue = primitiveLongArrayWrapperTmp;
          }

          if (!groupSet.contains(rawGroupValue))
          {
            if (offsetLeft > 0)
              --offsetLeft;
            else
            {
              resList.add(scoreDoc);
              if (resList.size() >= _count)
                break;
            }
            groupSet.add(new PrimitiveLongArrayWrapper(primitiveLongArrayWrapperTmp.data));
          }
        }
      }
    }
    else
View Full Code Here

TOP

Related Classes of com.browseengine.bobo.facets.data.PrimitiveLongArrayWrapper

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.