Export to GitHub

bobo-browse - issue #37

Reverse Sort on Non-Faceted lucene fields is broken


Posted on Oct 13, 2010 by Happy Horse

What steps will reproduce the problem? 1. Create a Bobo BrowseRequest with a SortField specified that is not-faceted. (default lucene field) 2. 3.

What is the expected output? What do you see instead? Verify if the BrowseHits are indeed sorted in reverse fashion. Hits are sorted in Ascending order (on the SortField)

What version of the product are you using? On what operating system? This is OS independent. Issue is verified on 2-5.0-rc1 But the code path seems to be the same in the trunk version as well.

Please provide any additional information below.

Potential Bug fix listed below: (SortCollector.java)

private static DocComparatorSource getComparatorSource(Browsable browser,SortField sf){ DocComparatorSource compSource = null; if (SortField.FIELD_DOC.equals(sf)){ compSource = new DocIdDocComparatorSource(); } else if (SortField.FIELD_SCORE.equals(sf)){ // we want to do reverse sorting regardless for relevance compSource = new ReverseDocComparatorSource(new RelevanceDocComparatorSource()); } else if (sf instanceof BoboCustomSortField){ BoboCustomSortField custField = (BoboCustomSortField)sf; DocComparatorSource src = custField.getCustomComparatorSource(); assert src!=null; compSource = src; } else{ Set<String> facetNames = browser.getFacetNames(); String sortName = sf.getField(); if (facetNames.contains(sortName)){ FacetHandler<?> handler = browser.getFacetHandler(sortName); assert handler!=null; // BUG BUG BUG //return handler.getDocComparatorSource();
// FIX FIX FIX compSource = handler.getDocComparatorSource();

        }
        else{       // default lucene field
                          // BUG BUG BUG
                          // return getNonFacetComparatorSource(sf);
              // FIX FIX FIX
                           compSource = getNonFacetComparatorSource(sf);
        }
    }

    boolean reverse = sf.getReverse();
    if (reverse){
        compSource = new ReverseDocComparatorSource(compSource);
    }

    compSource.setReverse(reverse);
    return compSource;
}

Comment #1

Posted on Mar 15, 2011 by Quick Horse

is this one fixed in version 2.5.1 ? see also: http://snaprojects.jira.com/browse/BOBO-20

Status: New

Labels:
Type-Defect Priority-Medium