blob: a2391b5c6e20f34843c946b305684a830a3e62cf (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.semantics.test;
import com.yahoo.search.Query;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Tests parameter matching and production
*
* @author bratseth
*/
public class Parameter2TestCase extends RuleBaseAbstractTestCase {
public Parameter2TestCase() {
super("parameter2.sr");
}
/** Tests parameter production */
@Test
void testParameterProduction() {
assertRankParameterSemantics("WEAKAND(100) a", "a&ranking=usrank", "date", 0);
}
private void assertRankParameterSemantics(String producedQuery,String inputQuery,
String rankParameterValue,int tracelevel) {
Query query=new Query("?query=" + inputQuery + "&tracelevel=0&tracelevel.rules=" + tracelevel);
query.properties().set("tracelevel.rules", tracelevel);
assertSemantics(producedQuery, query);
assertEquals(rankParameterValue,query.getRanking().getProfile());
}
}
|