blob: f465112fbafa4382f6a95ac678defb8f7e728ea2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchdefinition;
import com.yahoo.searchlib.rankingexpression.RankingExpression;
import com.yahoo.searchlib.rankingexpression.parser.ParseException;
/**
* A low-cost ranking profile to use for watcher queries etc.
*
* @author <a href="mailto:vegardh@yahoo-inc.com">Vegard Havdal</a>
*/
public class UnrankedRankProfile extends RankProfile {
public UnrankedRankProfile(Search search, RankProfileRegistry rankProfileRegistry) {
super("unranked", search, rankProfileRegistry);
try {
RankingExpression exp = new RankingExpression("value(0)");
this.setFirstPhaseRanking(exp);
} catch (ParseException e) {
throw new IllegalArgumentException("Could not parse the ranking expression 'value(0)' when setting up " +
"the 'unranked' rank profile");
}
this.setIgnoreDefaultRankFeatures(true);
this.setKeepRankCount(0);
this.setRerankCount(0);
}
}
|