aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/prelude/test/DummySearcher.java
blob: e64b1d65888058a8954b664351e115d498170c5c (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.test;

import com.yahoo.component.ComponentId;
import com.yahoo.search.Result;
import com.yahoo.search.Searcher;
import com.yahoo.search.result.Hit;
import com.yahoo.search.searchchain.Execution;

/**
 * Only returns the first hit for a query.
 *
 * @author <a href="mailto:Steinar.Knutsen@europe.yahoo-inc.com">Steinar Knutsen</a>
 */
public class DummySearcher extends Searcher {

    public DummySearcher() {
    }

    public DummySearcher(ComponentId id) {
        super(id);
    }

    public Result search(com.yahoo.search.Query query, Execution execution) {
        Result result=new Result(query);
        result.hits().add(new Hit("http://a.com/b", 100));

        return result;
    }
}