Search in sources :

Example 31 with Hit

use of com.yahoo.search.result.Hit in project vespa by vespa-engine.

the class SecondSearcher method search.

public Result search(com.yahoo.search.Query query, Execution execution) {
    Result result = execution.search(query);
    result.hits().add(new Hit("searcher:2", 996));
    return result;
}
Also used : Hit(com.yahoo.search.result.Hit) Result(com.yahoo.search.Result)

Example 32 with Hit

use of com.yahoo.search.result.Hit in project vespa by vespa-engine.

the class HttpTestCase method test_that_ip_address_set_on_meta_hit.

public void test_that_ip_address_set_on_meta_hit() {
    Result result = searchUsingLocalhost();
    Hit metaHit = getFirstMetaHit(result.hits());
    String ip = (String) metaHit.getField(HTTPSearcher.LOG_IP_ADDRESS);
    assertEquals(ip, "127.0.0.1");
}
Also used : Hit(com.yahoo.search.result.Hit) Result(com.yahoo.search.Result)

Example 33 with Hit

use of com.yahoo.search.result.Hit in project vespa by vespa-engine.

the class DummySearcher method search.

public Result search(com.yahoo.search.Query query, Execution execution) {
    Result result = new Result(query);
    result.hits().add(new Hit("http://a.com/b", 100));
    return result;
}
Also used : Hit(com.yahoo.search.result.Hit) Result(com.yahoo.search.Result)

Example 34 with Hit

use of com.yahoo.search.result.Hit in project vespa by vespa-engine.

the class QuerySnapshotSearcherTestCase method test.

public void test() {
    Searcher searcher = new QuerySnapshotSearcher();
    Result result = doSearch(searcher, new Query(), 0, 10);
    Hit hit = result.hits().get(0);
    assertEquals(String.valueOf(Double.POSITIVE_INFINITY), hit.getRelevance().toString());
}
Also used : Hit(com.yahoo.search.result.Hit) Query(com.yahoo.search.Query) Searcher(com.yahoo.search.Searcher) QuerySnapshotSearcher(com.yahoo.prelude.searcher.QuerySnapshotSearcher) QuerySnapshotSearcher(com.yahoo.prelude.searcher.QuerySnapshotSearcher) Result(com.yahoo.search.Result)

Example 35 with Hit

use of com.yahoo.search.result.Hit in project vespa by vespa-engine.

the class QuotingSearcherTestCase method testBasicQuotingWithNoisyStrings.

public void testBasicQuotingWithNoisyStrings() {
    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 &jo& nes");
    r.hits().add(hit);
    docsource.addResultSet(q, r);
    Result check = doSearch(s, q, 0, 10, chained);
    assertEquals("&amp;smith &amp;jo&amp; nes", 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

Hit (com.yahoo.search.result.Hit)127 Result (com.yahoo.search.Result)72 Query (com.yahoo.search.Query)52 FastHit (com.yahoo.prelude.fastsearch.FastHit)42 Test (org.junit.Test)41 Execution (com.yahoo.search.searchchain.Execution)25 HitGroup (com.yahoo.search.result.HitGroup)21 Searcher (com.yahoo.search.Searcher)17 JSONString (com.yahoo.prelude.hitfield.JSONString)13 GroupingListHit (com.yahoo.prelude.fastsearch.GroupingListHit)12 ErrorHit (com.yahoo.search.result.ErrorHit)10 Relevance (com.yahoo.search.result.Relevance)10 HashMap (java.util.HashMap)9 DocumentSourceSearcher (com.yahoo.prelude.searcher.DocumentSourceSearcher)8 Group (com.yahoo.search.grouping.result.Group)8 ComponentId (com.yahoo.component.ComponentId)7 Chain (com.yahoo.component.chain.Chain)7 FS4Hit (com.yahoo.searchlib.aggregation.FS4Hit)6 VdsHit (com.yahoo.searchlib.aggregation.VdsHit)6 GroupList (com.yahoo.search.grouping.result.GroupList)5