blob: 01c861b879e628757947f50d98aaf9d79f3f218f (
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
36
37
38
39
40
|
// Copyright 2016 Yahoo Inc. 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 com.yahoo.search.query.Properties;
import com.yahoo.search.query.profile.types.FieldDescription;
import com.yahoo.search.query.profile.types.QueryProfileType;
import java.util.Map;
/**
* Default values for properties that are meant to be customized in query profiles.
* @author tonytv
*/
public final class DefaultProperties extends Properties {
public static final CompoundName MAX_OFFSET = new CompoundName("maxOffset");
public static final CompoundName MAX_HITS = new CompoundName("maxHits");
public static final QueryProfileType argumentType = new QueryProfileType("DefaultProperties");
static {
argumentType.setBuiltin(true);
argumentType.addField(new FieldDescription(MAX_OFFSET.toString(), "integer"));
argumentType.addField(new FieldDescription(MAX_HITS.toString(), "integer"));
argumentType.freeze();
}
@Override
public Object get(CompoundName name, Map<String, String> context, com.yahoo.processing.request.Properties substitution) {
if (MAX_OFFSET.equals(name)) {
return 1000;
} else if (MAX_HITS.equals(name)) {
return 400;
} else {
return super.get(name, context, substitution);
}
}
}
|