blob: 440f067dd0033100d62b76f28dbb1eb6ed1ebbb3 (
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
41
42
43
44
45
46
47
48
49
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchdefinition.derived;
import com.yahoo.config.model.application.provider.BaseDeployLogger;
import com.yahoo.config.model.test.MockApplicationPackage;
import com.yahoo.document.DataType;
import com.yahoo.searchdefinition.RankProfileRegistry;
import com.yahoo.searchdefinition.Schema;
import com.yahoo.searchdefinition.document.SDDocumentType;
import com.yahoo.searchdefinition.document.SDField;
import com.yahoo.searchdefinition.processing.Processing;
import com.yahoo.vespa.model.container.search.QueryProfiles;
import org.junit.Test;
import java.util.Set;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
/**
* Tests that documents ids are treated as they should
*
* @author bratseth
*/
public class IdTestCase extends AbstractExportingTestCase {
@Test
public void testExplicitUpperCaseIdField() {
Schema schema = new Schema("test", MockApplicationPackage.createEmpty());
SDDocumentType document = new SDDocumentType("test");
schema.addDocument(document);
SDField uri = new SDField("URI", DataType.URI);
uri.parseIndexingScript("{ summary | index }");
document.addField(uri);
new Processing().process(schema, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(),
true, false, Set.of());
assertNull(document.getField("uri"));
assertNull(document.getField("Uri"));
assertNotNull(document.getField("URI"));
}
@Test
public void testCompleteDeriving() throws Exception {
assertCorrectDeriving("id");
}
}
|