aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/searchchain/example/ExampleSearcher.java
blob: 06a4096dc687cd3c9c0e8ffe3ceb06bc34763b67 (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
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.searchchain.example;

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

/**
 * An example searcher which adds a hit
 *
 * @author bratseth
 */
public class ExampleSearcher extends Searcher {

    public @Override Result search(Query query,Execution execution) {
        Result result=execution.search(query);
        result.hits().add(new Hit("example",1.0,"examplesearcher"));
        return result;
    }

}