aboutsummaryrefslogtreecommitdiffstats
path: root/bundle-plugin-test/test-bundles/main/src/main/java/com/yahoo/test/SimpleSearcher.java
blob: 01c650f587f28a208f3f485ae7be44f48631285a (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.test;

import com.yahoo.prelude.hitfield.XMLString;
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;
import com.yahoo.text.BooleanParser;

/**
 * A searcher adding a new hit.
 *
 * @author  Joe Developer
 */
public class SimpleSearcher extends Searcher {

    public Result search(Query query,Execution execution) {
            BooleanParser.parseBoolean("true");
            XMLString xmlString = new XMLString("<sampleXmlString/>");

            Hit hit = new Hit("Hello world!");

            Result result = execution.search(query);
            result.hits().add(hit);
            return result;
    }
}