blob: d089283a4b96728b30245eb55f9d5e3bc75d2700 (
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
29
30
31
32
33
34
35
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.properties;
import com.yahoo.processing.request.CompoundName;
import java.util.Map;
/**
* Property aliases which contains some hardcoded unaliasing of prefixes of
* rankfeature and rankproperty maps.
*
* @author bratseth
*/
public class QueryPropertyAliases extends PropertyAliases {
/**
* Creates an instance with a set of aliases. The given aliases will be used directly by this class.
* To make this class immutable and thread safe, relinquish ownership of the parameter map.
*/
public QueryPropertyAliases(Map<String,CompoundName> aliases) {
super(aliases);
}
@Override
protected CompoundName unalias(CompoundName nameOrAlias) {
if (nameOrAlias.first().equalsIgnoreCase("rankfeature")
|| nameOrAlias.first().equalsIgnoreCase("input")
|| nameOrAlias.first().equalsIgnoreCase("featureoverride")) // deprecated: TODO Remove on Vespa 8
return nameOrAlias.rest().prepend("ranking", "features");
else if (nameOrAlias.first().equalsIgnoreCase("rankproperty"))
return nameOrAlias.rest().prepend("ranking", "properties");
return super.unalias(nameOrAlias);
}
}
|