Package com.browseengine.bobo.api

Examples of com.browseengine.bobo.api.BrowseFacet


  }

  @Override
  public Comparable next() {
    count = 0;
    BrowseFacet next = iterator.next();
    if (next == null) {
      return null;
    }
    count = next.getFacetValueHitCount();
    facet = next.getValue();
    return next.getValue();
  }
View Full Code Here


  }

  @Override
  public Comparable next(int minHits) {
    while (iterator.hasNext()) {
      BrowseFacet next = iterator.next();
      count = next.getFacetValueHitCount();
      facet = next.getValue();
      if (next.getFacetValueHitCount() >= minHits) {
        return next.getValue();
      }
    }
    return null;
  }
View Full Code Here

  {
    if (_closed)
    {
      throw new IllegalStateException("This instance of count collector for " + _name + " was already closed");
    }
    BrowseFacet facet = null;
    int index=_dataCache.valArray.indexOf(value);
    if (index >=0 ){
      facet = new BrowseFacet(_dataCache.valArray.get(index),_count.get(index));
    }
    else{
      facet = new BrowseFacet(_dataCache.valArray.format(value),0)
    }
    return facet;
  }
View Full Code Here

          for (int i = 1; i < countlength;++i) // exclude zero
          {
            int hits=count.get(i);
            if (hits>=minCount)
            {
              BrowseFacet facet=new BrowseFacet(valList.get(i),hits);
              facetColl.add(facet);
            }
            if (facetColl.size()>=max) 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 valList.get(index);
            }

            public Object getRawValue(int index) {
              return valList.getRawValue(index);
            }

          }, count);
          facetColl=new LinkedList<BrowseFacet>();
          final int forbidden = -1;
          IntBoundedPriorityQueue pq=new IntBoundedPriorityQueue(comparator,max, forbidden);

          for (int i=1;i<countlength;++i)
          {
            int hits=count.get(i);
            if (hits>=minCount)
            {
              pq.offer(i);
            }
          }

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

              if (strict){
                if (directNode){
                  currentCount+=subCount;
                }
                else{
                  BrowseFacet ch=new BrowseFacet(currentPath,currentCount);
                  if (pq!=null){
                    pq.add(ch);
                  }
                  else{
                    if (list.size()<maxCount){
                        list.add(ch);
                    }
                  }
                  currentPath=wantedPath;
                  currentCount=subCount;
                }
              }
              else{
                if (!directNode){
                  BrowseFacet ch=new BrowseFacet(currentPath,currentCount);
                  if (pq!=null){
                    pq.add(ch);
                  }
                  else{
                    if (list.size()<maxCount){
                      list.add(ch);
                    }
                  }
                  currentPath=wantedPath;
                  currentCount=subCount;
                }
                else{
                  currentCount+=subCount;
                }
              }
            }
        }
        else{
          break;
        }
      }
    }
   
    if (currentPath!=null && currentCount>0){
      BrowseFacet ch=new BrowseFacet(currentPath,currentCount);
      if (pq!=null){
        pq.add(ch);
      }
      else{
        if (list.size()<maxCount){
          list.add(ch);
        }
      }
    }
   
    if (pq!=null){
      BrowseFacet val;
      while((val = pq.poll()) != null)
            {
              list.addFirst(val);
            }
    }
View Full Code Here

    Iterator<BrowseFacet> finalIter = ListMerger.mergeLists(
        iterList.toArray((Iterator<BrowseFacet>[])new Iterator[iterList.size()]),
        _comparatorFactory==null ? new FacetValueComparatorFactory().newComparator(): _comparatorFactory.newComparator());
    while (finalIter.hasNext())
      {
      BrowseFacet f = finalIter.next();
      finalList.addFirst(f);
      }
    return finalList;
  }
View Full Code Here

    Iterator<BrowseFacet> finalIter = ListMerger.mergeLists(
                                                            iterList.toArray((Iterator<BrowseFacet>[])new Iterator[iterList.size()]),
                                                            _comparatorFactory==null ? new FacetValueComparatorFactory().newComparator(): _comparatorFactory.newComparator());
    while (finalIter.hasNext())
    {
      BrowseFacet f = finalIter.next();
      finalList.add(f);
    }
    return new PathFacetIterator(finalList);
  }
View Full Code Here

  // get the facet of one particular bucket
  public BrowseFacet getFacet(String bucketValue)
  {
      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

   */
  public BrowseFacet getFacet(String value) {
    if(_predefinedRanges != null) {
      int index = 0;
      if((index = _predefinedRanges.indexOf(value)) != -1) {
        BrowseFacet choice = new BrowseFacet();
        choice.setHitCount(_count.get(index));
        choice.setValue(value);
        return choice;
      }
      else {
        // user specified an unknown range value. the overhead to calculate the count for an unknown range value is high,
        // in the sense it requires to go through each docid in the index. Till we get a better solution, this operation is
View Full Code Here

        List<BrowseFacet> facets = new ArrayList<BrowseFacet>();
        int countIndex = -1;
        for(String value : _predefinedRanges) {
          countIndex++;
          if(_count.get(countIndex) >= minHitCount) {
            BrowseFacet choice = new BrowseFacet();
            choice.setHitCount(_count.get(countIndex));
            choice.setValue(value);
            facets.add(choice);
          }
        }
        return facets;
      }
View Full Code Here

TOP

Related Classes of com.browseengine.bobo.api.BrowseFacet

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.