Search in sources :

Example 71 with Query

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

the class HitConverterTestCase method requireThatSummaryClassIsSet.

@Test
public void requireThatSummaryClassIsSet() {
    Searcher searcher = new MySearcher();
    HitConverter converter = new HitConverter(searcher, new Query());
    Hit hit = converter.toSearchHit("69", new FS4Hit(1, createGlobalId(2), 3).setContext(new Hit("hit:ctx")));
    assertNotNull(hit);
    assertTrue(hit instanceof FastHit);
    assertEquals("69", hit.getSearcherSpecificMetaData(searcher));
}
Also used : FS4Hit(com.yahoo.searchlib.aggregation.FS4Hit) FS4Hit(com.yahoo.searchlib.aggregation.FS4Hit) GroupingListHit(com.yahoo.prelude.fastsearch.GroupingListHit) FastHit(com.yahoo.prelude.fastsearch.FastHit) Hit(com.yahoo.search.result.Hit) VdsHit(com.yahoo.searchlib.aggregation.VdsHit) FastHit(com.yahoo.prelude.fastsearch.FastHit) Query(com.yahoo.search.Query) Searcher(com.yahoo.search.Searcher) Test(org.junit.Test)

Example 72 with Query

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

the class HitConverterTestCase method requireThatUnsupportedHitClassThrows.

@Test
public void requireThatUnsupportedHitClassThrows() {
    HitConverter converter = new HitConverter(new MySearcher(), new Query());
    try {
        converter.toSearchHit("69", new com.yahoo.searchlib.aggregation.Hit() {
        });
        fail();
    } catch (UnsupportedOperationException e) {
    }
}
Also used : Query(com.yahoo.search.Query) Test(org.junit.Test)

Example 73 with Query

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

the class HitConverterTestCase method requireThatContextDataIsCopied.

@Test
public void requireThatContextDataIsCopied() {
    Hit ctxHit = new Hit("hit:ctx");
    ctxHit.setSource("69");
    ctxHit.setSourceNumber(69);
    Query ctxQuery = new Query();
    ctxHit.setQuery(ctxQuery);
    HitConverter converter = new HitConverter(new MySearcher(), new Query());
    Hit hit = converter.toSearchHit("default", new FS4Hit(1, createGlobalId(2), 3).setContext(ctxHit));
    assertNotNull(hit);
    assertTrue(hit instanceof FastHit);
    assertEquals(1, ((FastHit) hit).getPartId());
    assertEquals(createGlobalId(2), ((FastHit) hit).getGlobalId());
    assertSame(ctxQuery, hit.getQuery());
    assertEquals(ctxHit.getSource(), hit.getSource());
    assertEquals(ctxHit.getSourceNumber(), hit.getSourceNumber());
}
Also used : FS4Hit(com.yahoo.searchlib.aggregation.FS4Hit) FS4Hit(com.yahoo.searchlib.aggregation.FS4Hit) GroupingListHit(com.yahoo.prelude.fastsearch.GroupingListHit) FastHit(com.yahoo.prelude.fastsearch.FastHit) Hit(com.yahoo.search.result.Hit) VdsHit(com.yahoo.searchlib.aggregation.VdsHit) FastHit(com.yahoo.prelude.fastsearch.FastHit) Query(com.yahoo.search.Query) Test(org.junit.Test)

Example 74 with Query

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

the class HitConverterTestCase method requireThatVdsHitCanBeConverted.

@Test
public void requireThatVdsHitCanBeConverted() {
    HitConverter converter = new HitConverter(new MySearcher(), new Query());
    GroupingListHit context = new GroupingListHit(null, new DocsumDefinitionSet(sixtynine()));
    VdsHit lowHit = new VdsHit("doc:scheme:", new byte[] { 0x55, 0x55, 0x55, 0x55 }, 1);
    lowHit.setContext(context);
    Hit hit = converter.toSearchHit("69", lowHit);
    assertNotNull(hit);
    assertTrue(hit instanceof FastHit);
    assertEquals(new Relevance(1), hit.getRelevance());
    assertTrue(hit.isFilled("69"));
}
Also used : Relevance(com.yahoo.search.result.Relevance) FS4Hit(com.yahoo.searchlib.aggregation.FS4Hit) GroupingListHit(com.yahoo.prelude.fastsearch.GroupingListHit) FastHit(com.yahoo.prelude.fastsearch.FastHit) Hit(com.yahoo.search.result.Hit) VdsHit(com.yahoo.searchlib.aggregation.VdsHit) FastHit(com.yahoo.prelude.fastsearch.FastHit) Query(com.yahoo.search.Query) DocsumDefinitionSet(com.yahoo.prelude.fastsearch.DocsumDefinitionSet) VdsHit(com.yahoo.searchlib.aggregation.VdsHit) GroupingListHit(com.yahoo.prelude.fastsearch.GroupingListHit) Test(org.junit.Test)

Example 75 with Query

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

the class CachingSearcherTestCase method readyResult.

public void readyResult(String q) {
    Query query = new Query(q);
    Result r = new Result(query);
    for (int i = 0; i < 10; ++i) {
        FastHit h = new FastHit("http://127.0.0.1/" + i, 1.0 - ((double) i) / 10.0);
        r.hits().add(h);
    }
    hits.addResultSet(query, r);
}
Also used : FastHit(com.yahoo.prelude.fastsearch.FastHit) Query(com.yahoo.search.Query) Result(com.yahoo.search.Result)

Aggregations

Query (com.yahoo.search.Query)689 Test (org.junit.Test)415 Result (com.yahoo.search.Result)229 Execution (com.yahoo.search.searchchain.Execution)184 Searcher (com.yahoo.search.Searcher)82 QueryProfile (com.yahoo.search.query.profile.QueryProfile)63 Hit (com.yahoo.search.result.Hit)52 Chain (com.yahoo.component.chain.Chain)47 IndexFacts (com.yahoo.prelude.IndexFacts)44 CompiledQueryProfileRegistry (com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry)37 AndItem (com.yahoo.prelude.query.AndItem)33 WordItem (com.yahoo.prelude.query.WordItem)33 FastHit (com.yahoo.prelude.fastsearch.FastHit)31 CompiledQueryProfile (com.yahoo.search.query.profile.compiled.CompiledQueryProfile)27 HitGroup (com.yahoo.search.result.HitGroup)24 Item (com.yahoo.prelude.query.Item)21 HashMap (java.util.HashMap)20 CacheKey (com.yahoo.prelude.fastsearch.CacheKey)18 GroupingRequest (com.yahoo.search.grouping.GroupingRequest)18 ArrayList (java.util.ArrayList)18