diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-04-27 16:09:46 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-04-27 16:09:46 +0200 |
commit | 1e2668f0db7043dd44add1775b2e96fcfec33bc3 (patch) | |
tree | 69849fbc57e3dda1058d343c7ff9781d4ab7cb51 /container-search | |
parent | 482b085d278875ec99b2c7442a4255ed86f78d21 (diff) |
Remove LazyField (not used)
Diffstat (limited to 'container-search')
-rw-r--r-- | container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java | 56 | ||||
-rw-r--r-- | container-search/src/test/java/com/yahoo/search/rendering/JsonRendererTestCase.java | 20 |
2 files changed, 7 insertions, 69 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java index 9ab84845d9c..48b35eb7d63 100644 --- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java +++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java @@ -21,13 +21,14 @@ public class FastHit extends Hit { private static final GlobalId emptyGlobalId = new GlobalId(new byte[GlobalId.LENGTH]); - /** The global id of this document in the backend node which produced it */ - private GlobalId globalId = emptyGlobalId; + /** The index of the content node this hit originated at */ + private int distributionKey = 0; + /** The local identifier of the content store for this hit on the node it originated at */ private int partId; - /** The index of the content node this hit originated at*/ - private int distributionKey = 0; + /** The global id of this document in the backend node which produced it */ + private GlobalId globalId = emptyGlobalId; /** Full information pointing to the location of further data for this hit. Lazily set */ private URI indexUri = null; @@ -198,20 +199,12 @@ public class FastHit extends Hit { return false; } - /** - * Only needed when fetching summaries in 2 phase. - * - * @return distribution key of node where the hit originated from - */ + /** Returns the index of the node this hit originated at */ public int getDistributionKey() { return distributionKey; } - /** - * Only needed when fetching summaries in 2 phase. - * - * @param distributionKey Of node where you find this hit. - */ + /** Returns the index of the node this hit originated at */ public void setDistributionKey(int distributionKey) { this.distributionKey = distributionKey; } @@ -235,20 +228,6 @@ public class FastHit extends Hit { } /** - * Set a field to behave like a string type summary field, not decoding raw - * data till actually used. Added to make testing lazy docsum functionality - * easier. This is not a method to be used for efficiency, as it causes - * object allocations. - * - * @param fieldName the name of the field to insert undecoded UTF-8 into - * @param value an array of valid UTF-8 data - */ - @Beta - public void setLazyStringField(String fieldName, byte[] value) { - setField(fieldName, new LazyString(new StringField(fieldName), new StringValue(value))); - } - - /** * Add the binary data common for the query packet to a Vespa backend and a * summary fetch packet to a Vespa backend. This method can only be called * once for a single hit. @@ -318,25 +297,4 @@ public class FastHit extends Hit { abstract RawField getFieldAsUtf8(String fieldName); } - private static class LazyString extends LazyValue { - - private final Inspector value; - private final DocsumField fieldType; - - LazyString(DocsumField fieldType, Inspector value) { - assert(value.type() == Type.STRING); - this.value = value; - this.fieldType = fieldType; - } - - Object getValue(String fieldName) { - return value.asString(); - } - - RawField getFieldAsUtf8(String fieldName) { - return new RawField(fieldType, value.asUtf8()); - } - - } - } diff --git a/container-search/src/test/java/com/yahoo/search/rendering/JsonRendererTestCase.java b/container-search/src/test/java/com/yahoo/search/rendering/JsonRendererTestCase.java index 791e95403ab..defabc7463b 100644 --- a/container-search/src/test/java/com/yahoo/search/rendering/JsonRendererTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/rendering/JsonRendererTestCase.java @@ -680,26 +680,6 @@ public class JsonRendererTestCase { } @Test - public void testLazyDecoding() throws IOException { - FastHit f = new FastHit("http://a.b/c", 0.5); - String checkWeCanDecode = "bamse"; - String dontCare = "don't care"; - final String fieldName = "checkWeCanDecode"; - f.setLazyStringField(fieldName, Utf8.toBytes(checkWeCanDecode)); - final String fieldName2 = "dontCare"; - f.setLazyStringField(fieldName2, Utf8.toBytes(dontCare)); - assertEquals(checkWeCanDecode, f.getField(fieldName)); - - JsonGenerator mock = Mockito.mock(JsonGenerator.class); - - renderer.setGenerator(mock); - assertTrue(renderer.tryDirectRendering(fieldName2, f)); - - byte[] expectedBytes = Utf8.toBytes(dontCare); - Mockito.verify(mock, times(1)).writeUTF8String(expectedBytes, 0, expectedBytes.length); - } - - @Test public void testHitWithSource() throws IOException, InterruptedException, ExecutionException { String expected = "{\n" + " \"root\": {\n" |