Search in sources :

Example 11 with DocumentSourceSearcher

use of com.yahoo.prelude.searcher.DocumentSourceSearcher in project vespa by vespa-engine.

the class QuotingSearcherTestCase method testBasicQuoting.

public void testBasicQuoting() {
    Map<Searcher, Searcher> chained = new HashMap<>();
    Searcher s = createQuotingSearcher("file:src/test/java/com/yahoo/prelude/" + "searcher/test/testquoting.cfg");
    DocumentSourceSearcher docsource = new DocumentSourceSearcher();
    chained.put(s, docsource);
    Query q = new Query("?query=a");
    Result r = new Result(q);
    Hit hit = new FastHit();
    hit.setId("http://abc.html");
    hit.setRelevance(new Relevance(1));
    hit.setField("title", "smith & jones");
    r.hits().add(hit);
    docsource.addResultSet(q, r);
    Result check = doSearch(s, q, 0, 10, chained);
    assertEquals("smith &amp; jones", check.hits().get(0).getField("title").toString());
    assertTrue(check.hits().get(0).fields().containsKey("title"));
}
Also used : Relevance(com.yahoo.search.result.Relevance) FastHit(com.yahoo.prelude.fastsearch.FastHit) Hit(com.yahoo.search.result.Hit) FastHit(com.yahoo.prelude.fastsearch.FastHit) Query(com.yahoo.search.Query) HashMap(java.util.HashMap) Searcher(com.yahoo.search.Searcher) QuotingSearcher(com.yahoo.prelude.searcher.QuotingSearcher) DocumentSourceSearcher(com.yahoo.prelude.searcher.DocumentSourceSearcher) DocumentSourceSearcher(com.yahoo.prelude.searcher.DocumentSourceSearcher) Result(com.yahoo.search.Result)

Aggregations

DocumentSourceSearcher (com.yahoo.prelude.searcher.DocumentSourceSearcher)11 FastHit (com.yahoo.prelude.fastsearch.FastHit)10 Query (com.yahoo.search.Query)10 Result (com.yahoo.search.Result)10 Hit (com.yahoo.search.result.Hit)8 Execution (com.yahoo.search.searchchain.Execution)5 Test (org.junit.Test)5 FillSearcher (com.yahoo.prelude.searcher.FillSearcher)4 QuotingSearcher (com.yahoo.prelude.searcher.QuotingSearcher)4 Searcher (com.yahoo.search.Searcher)4 Relevance (com.yahoo.search.result.Relevance)4 HashMap (java.util.HashMap)4 QrSearchersConfig (com.yahoo.container.QrSearchersConfig)1 HitField (com.yahoo.prelude.hitfield.HitField)1 CachingSearcher (com.yahoo.prelude.searcher.CachingSearcher)1 Iterator (java.util.Iterator)1 Before (org.junit.Before)1