Search in sources :

Example 6 with Sorting

use of com.yahoo.search.query.Sorting in project vespa by vespa-engine.

the class UniqueGroupingSearcherTestCase method testBuildGroupingExpression.

@Test
public void testBuildGroupingExpression() throws Exception {
    assertEquals("all(group(title) max(11) output(count() as(uniqueCount)) each(max(1) each(output(summary())) " + "as(uniqueHits)))", UniqueGroupingSearcher.buildGroupingExpression("title", 11, null, null).toString());
    assertEquals("all(group(fingerprint) max(5) output(count() as(uniqueCount)) each(max(1) " + "each(output(summary(attributeprefetch))) as(uniqueHits)))", UniqueGroupingSearcher.buildGroupingExpression("fingerprint", 5, "attributeprefetch", null).toString());
    assertEquals("all(group(fingerprint) max(5) order(neg(max(pubdate))) output(count() as(uniqueCount)) each(" + "all(group(neg(pubdate)) max(1) order(neg(max(pubdate))) each(each(output(summary())) " + "as(uniqueHits)) as(uniqueGroups))))", UniqueGroupingSearcher.buildGroupingExpression("fingerprint", 5, null, new Sorting("-pubdate")).toString());
    assertEquals("all(group(fingerprint) max(5) order(min(pubdate)) output(count() as(uniqueCount)) each(" + "all(group(pubdate) max(1) order(min(pubdate)) each(each(output(summary(attributeprefetch))) " + "as(uniqueHits)) as(uniqueGroups))))", UniqueGroupingSearcher.buildGroupingExpression("fingerprint", 5, "attributeprefetch", new Sorting("+pubdate")).toString());
}
Also used : Sorting(com.yahoo.search.query.Sorting) Test(org.junit.Test)

Aggregations

Sorting (com.yahoo.search.query.Sorting)6 Result (com.yahoo.search.Result)1 Group (com.yahoo.search.grouping.result.Group)1 GroupList (com.yahoo.search.grouping.result.GroupList)1 AttributeSorter (com.yahoo.search.query.Sorting.AttributeSorter)1 FieldOrder (com.yahoo.search.query.Sorting.FieldOrder)1 LowerCaseSorter (com.yahoo.search.query.Sorting.LowerCaseSorter)1 RawSorter (com.yahoo.search.query.Sorting.RawSorter)1 UcaSorter (com.yahoo.search.query.Sorting.UcaSorter)1 MatchPhase (com.yahoo.search.query.ranking.MatchPhase)1 NonNull (edu.umd.cs.findbugs.annotations.NonNull)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1