Package com.browseengine.bobo.api

Examples of com.browseengine.bobo.api.ComparatorFactory


    answer=new HashMap<String,List<BrowseFacet>>();
    answer.put("path", Arrays.asList(new BrowseFacet[]{new BrowseFacet("a-c-d",2),new BrowseFacet("a-e-f",1)}));
    doTest(br,3,answer,null);
   
    pathSpec.setOrderBy(FacetSortSpec.OrderByCustom);
    pathSpec.setCustomComparatorFactory(new ComparatorFactory(){

      public IntComparator newComparator(
          FieldValueAccessor fieldValueAccessor, final int[] counts) {
        return new IntComparator(){
View Full Code Here


  }
 
  public void testCustomFacetSort() throws Exception{
    BrowseRequest req = new BrowseRequest();
    FacetSpec numberSpec = new FacetSpec();
    numberSpec.setCustomComparatorFactory(new ComparatorFactory() {
     
      public IntComparator newComparator(final FieldValueAccessor fieldValueAccessor,
          final int[] counts) {
       
        return new IntComparator(){
View Full Code Here

          Arrays.asList(new BrowseFacet[] { new BrowseFacet("a-c-d", 2),
              new BrowseFacet("a-e-f", 1) }));
    doTest(br, 3, answer, null);

    pathSpec.setOrderBy(FacetSortSpec.OrderByCustom);
    pathSpec.setCustomComparatorFactory(new ComparatorFactory() {

      @Override
      public IntComparator newComparator(FieldValueAccessor fieldValueAccessor,
          final BigSegmentedArray counts) {
        return new IntComparator() {
View Full Code Here

  }

  public void testCustomFacetSort() throws Exception {
    BrowseRequest req = new BrowseRequest();
    FacetSpec numberSpec = new FacetSpec();
    numberSpec.setCustomComparatorFactory(new ComparatorFactory() {

      @Override
      public IntComparator newComparator(final FieldValueAccessor fieldValueAccessor,
          final BigSegmentedArray counts) {
View Full Code Here

            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);
            }
View Full Code Here

            }
            if (facetColl.size()>=max) break;
          }
        }
        else{
          ComparatorFactory comparatorFactory;
          if (sortspec == FacetSortSpec.OrderHitsDesc){
            comparatorFactory = new FacetHitcountComparatorFactory();
          }
          else{
            comparatorFactory = _fspec.getCustomComparatorFactory();
          }

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

          IntComparator comparator = comparatorFactory.newComparator(new FieldValueAccessor(){

            public String getFormatedValue(int index) {
              return getFacetString(index);
            }
View Full Code Here

            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);
              }
View Full Code Here

            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);
            }
View Full Code Here

            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);
              }
View Full Code Here

            }
            if (facetColl.size()>=max) break;
          }
        }
        else{
          ComparatorFactory comparatorFactory;
          if (sortspec == FacetSortSpec.OrderHitsDesc){
            comparatorFactory = new FacetHitcountComparatorFactory();
          }
          else{
            comparatorFactory = _fspec.getCustomComparatorFactory();
          }

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

          IntComparator comparator = comparatorFactory.newComparator(new FieldValueAccessor(){

            public String getFormatedValue(int index) {
              return getFacetString(index);
            }
View Full Code Here

TOP

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

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.