diff options
author | gjoranv <gjoranv@gmail.com> | 2019-10-23 12:11:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-23 12:11:12 +0200 |
commit | d9f4351623e616f8df85e73b45f9e42bd221fb6f (patch) | |
tree | a0053a7e0af5515386b3b75f0bb521d9a096a34e /bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher.java | |
parent | dfec83cec5f464b09b72fc48ff1a5e114523aded (diff) |
Revert "Gjoranv/artifact version for exports3"
Diffstat (limited to 'bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher.java')
-rw-r--r-- | bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher.java b/bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher.java new file mode 100644 index 00000000000..dddca3f4d59 --- /dev/null +++ b/bundle-plugin-test/src/main/java/com/yahoo/test/SimpleSearcher.java @@ -0,0 +1,37 @@ +// Copyright 2017 Yahoo Holdings. 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; +import org.json.JSONException; +import org.json.JSONObject; + +/** + * A searcher adding a new hit. + * + * @author Joe Developer + */ +public class SimpleSearcher extends Searcher { + + public Result search(Query query,Execution execution) { + try { + BooleanParser.parseBoolean("true"); + XMLString xmlString = new XMLString("<sampleXmlString/>"); + + Hit hit = new Hit("Hello world!"); + hit.setField("json", new JSONObject().put("price", 42).toString()); + + Result result = execution.search(query); + result.hits().add(hit); + return result; + + } catch (JSONException e) { + throw new RuntimeException(e); + } + } +} |