summaryrefslogtreecommitdiffstats
path: root/application/src/test/scala/com/yahoo/application/container/searchers/AddHitSearcher.scala
blob: e3a6cd031bcba7c7ce6c26837f5256c6e8c8462b (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 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.application.container.searchers

import com.yahoo.search.{Searcher, Result, Query}
import com.yahoo.search.searchchain.Execution
import com.yahoo.search.result.Hit


class AddHitSearcher extends Searcher {

  override def search(query: Query, execution: Execution) : Result = {
    val result = execution.search(query)
    result.hits().add(dummyHit)

    result
  }

  private def dummyHit = {
    val hit = new Hit("dummy")
    hit.setField("title", getId.getName)
    hit
  }
}