Search in sources :

Example 21 with QueryPacket

use of com.yahoo.fs4.QueryPacket in project vespa by vespa-engine.

the class CacheKeyTestCase method testSessionKeyIgnored.

@Test
public void testSessionKeyIgnored() {
    Query a = new Query("/?query=abcd");
    QueryPacket ap = QueryPacket.create(a);
    Query b = new Query("/?query=abcd&ranking.queryCache=true");
    QueryPacket bp = QueryPacket.create(b);
    CacheKey ak = new CacheKey(ap);
    CacheKey bk = new CacheKey(bp);
    assertEquals(ak, bk);
    assertEquals(ak.hashCode(), bk.hashCode());
    assertFalse(ap.getQueryPacketData().equals(bp.getQueryPacketData()));
}
Also used : Query(com.yahoo.search.Query) QueryPacket(com.yahoo.fs4.QueryPacket) CacheKey(com.yahoo.prelude.fastsearch.CacheKey) Test(org.junit.Test)

Example 22 with QueryPacket

use of com.yahoo.fs4.QueryPacket in project vespa by vespa-engine.

the class CacheKeyTestCase method testHitsOffsetEquality.

@Test
public void testHitsOffsetEquality() {
    Query a = new Query("/?query=abcd");
    QueryPacket p1 = QueryPacket.create(a);
    a.setWindow(100, 1000);
    QueryPacket p2 = QueryPacket.create(a);
    CacheKey k1 = new CacheKey(p1);
    CacheKey k2 = new CacheKey(p2);
    assertEquals(k1, k2);
    assertEquals(k1.hashCode(), k2.hashCode());
}
Also used : Query(com.yahoo.search.Query) QueryPacket(com.yahoo.fs4.QueryPacket) CacheKey(com.yahoo.prelude.fastsearch.CacheKey) Test(org.junit.Test)

Aggregations

QueryPacket (com.yahoo.fs4.QueryPacket)20 Query (com.yahoo.search.Query)15 Test (org.junit.Test)14 ByteBuffer (java.nio.ByteBuffer)8 GetDocSumsPacket (com.yahoo.fs4.GetDocSumsPacket)4 Result (com.yahoo.search.Result)4 BasicPacket (com.yahoo.fs4.BasicPacket)3 ChannelTimeoutException (com.yahoo.fs4.ChannelTimeoutException)3 Packet (com.yahoo.fs4.Packet)3 PingPacket (com.yahoo.fs4.PingPacket)3 PongPacket (com.yahoo.fs4.PongPacket)3 QueryResultPacket (com.yahoo.fs4.QueryResultPacket)3 IOException (java.io.IOException)3 BufferTooSmallException (com.yahoo.fs4.BufferTooSmallException)2 FS4Channel (com.yahoo.fs4.mplex.FS4Channel)2 InvalidChannelException (com.yahoo.fs4.mplex.InvalidChannelException)2 CacheKey (com.yahoo.prelude.fastsearch.CacheKey)2 Highlight (com.yahoo.prelude.query.Highlight)2 WordItem (com.yahoo.prelude.query.WordItem)2 CompressionType (com.yahoo.compress.CompressionType)1