blob: 3bef09454dea1033e5f5e0b8013aaee488407ecd (
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
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.example;
import com.yahoo.application.Application;
import com.yahoo.application.Networking;
import com.yahoo.application.container.Search;
import com.yahoo.component.ComponentSpecification;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.result.Hit;
import org.junit.Test;
import java.nio.file.Paths;
import static org.junit.Assert.assertEquals;
/**
* @author Joe Developer
*/
public class SubqueriesSearcherTest {
@Test
public void hit_is_added() throws Exception {
try (Application app = Application.fromApplicationPackage(
Paths.get("src/test/application"),
Networking.disable))
{
Search search = app.getJDisc("jdisc").search();
Result result = search.process(ComponentSpecification.fromString("default"), new Query("?query=ignored"));
assertEquals(3, result.hits().size());
Hit hit = result.hits().get(0);
assertEquals(null, hit.getField("summaryfeatures")); // Summaryfeatures was removed by searcher
assertEquals(0x100000003L, hit.getField("subqueries(target)"));
}
}
}
|