Search in sources :

Example 16 with Relevance

use of com.yahoo.search.result.Relevance 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

Relevance (com.yahoo.search.result.Relevance)16 Hit (com.yahoo.search.result.Hit)10 Result (com.yahoo.search.Result)9 FastHit (com.yahoo.prelude.fastsearch.FastHit)8 Query (com.yahoo.search.Query)6 DocumentSourceSearcher (com.yahoo.prelude.searcher.DocumentSourceSearcher)4 QuotingSearcher (com.yahoo.prelude.searcher.QuotingSearcher)4 Searcher (com.yahoo.search.Searcher)4 Group (com.yahoo.search.grouping.result.Group)4 RootGroup (com.yahoo.search.grouping.result.RootGroup)4 HashMap (java.util.HashMap)4 Test (org.junit.Test)4 JSONString (com.yahoo.prelude.hitfield.JSONString)3 GroupList (com.yahoo.search.grouping.result.GroupList)3 StringId (com.yahoo.search.grouping.result.StringId)3 Continuation (com.yahoo.search.grouping.Continuation)2 HitList (com.yahoo.search.grouping.result.HitList)2 HitGroup (com.yahoo.search.result.HitGroup)2 DocsumDefinitionSet (com.yahoo.prelude.fastsearch.DocsumDefinitionSet)1 GroupingListHit (com.yahoo.prelude.fastsearch.GroupingListHit)1