diff options
Diffstat (limited to 'container-search')
7 files changed, 42 insertions, 404 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinitionSet.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinitionSet.java index 04667f9b53f..b02701f5c8b 100644 --- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinitionSet.java +++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinitionSet.java @@ -4,16 +4,13 @@ package com.yahoo.prelude.fastsearch; import com.yahoo.slime.BinaryFormat; import com.yahoo.slime.Slime; import com.yahoo.data.access.slime.SlimeAdapter; -import com.yahoo.vespa.config.search.SummaryConfig; import com.yahoo.prelude.ConfigurationException; import com.yahoo.container.search.LegacyEmulationConfig; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; -import java.util.Set; import java.util.logging.Logger; /** @@ -27,7 +24,6 @@ public final class DocsumDefinitionSet { public static final int SLIME_MAGIC_ID = 0x55555555; private final static Logger log = Logger.getLogger(DocsumDefinitionSet.class.getName()); - private final HashMap<Long, DocsumDefinition> definitions = new HashMap<>(); private final HashMap<String, DocsumDefinition> definitionsByName = new HashMap<>(); private final LegacyEmulationConfig emulationConfig; @@ -41,14 +37,6 @@ public final class DocsumDefinitionSet { configure(config); } - /** Returns a docsum definition by id - * @param id document summary class id - * @return a DocsumDefinition for the id, if found. - */ - public final DocsumDefinition getDocsumDefinition(long id) { - return definitions.get(new Long(id)); - } - /** * Returns a docsum definition by name, or null if not found * @@ -74,26 +62,11 @@ public final class DocsumDefinitionSet { buffer.order(ByteOrder.LITTLE_ENDIAN); long docsumClassId = buffer.getInt(); if (docsumClassId != SLIME_MAGIC_ID) { - log.warning("Only expecting SchemaLess docsums"); - // TODO: Not used, remove - bratseth 2017-01-016 - DocsumDefinition docsumDefinition = lookupDocsum(docsumClassId); - Docsum docsum = new Docsum(docsumDefinition, data); - hit.addSummary(docsum); - } else { - DocsumDefinition docsumDefinition = lookupDocsum(summaryClass); - Slime value = BinaryFormat.decode(buffer.array(), buffer.arrayOffset()+buffer.position(), buffer.remaining()); - hit.addSummary(docsumDefinition, new SlimeAdapter(value.get())); - } - } - - private DocsumDefinition lookupDocsum(long docsumClassId) { - DocsumDefinition docsumDefinition = getDocsumDefinition(docsumClassId); - if (docsumDefinition == null) { - throw new ConfigurationException("Received hit with summary id " + docsumClassId + - ", but this summary class is not in current summary config (" + toString() + ")" + - " (that is, the system is in an inconsistent state)"); + throw new IllegalArgumentException("Only expecting SchemaLess docsums - summary class:" + summaryClass + " hit:" + hit); } - return docsumDefinition; + DocsumDefinition docsumDefinition = lookupDocsum(summaryClass); + Slime value = BinaryFormat.decode(buffer.array(), buffer.arrayOffset()+buffer.position(), buffer.remaining()); + hit.addSummary(docsumDefinition, new SlimeAdapter(value.get())); } private DocsumDefinition lookupDocsum(String summaryClass) { @@ -111,32 +84,26 @@ public final class DocsumDefinitionSet { public String toString() { StringBuilder sb = new StringBuilder(); - Set<Map.Entry<Long, DocsumDefinition>> entrySet = definitions.entrySet(); - boolean first = true; - for (Iterator<Map.Entry<Long, DocsumDefinition>> itr = entrySet.iterator(); itr.hasNext(); ) { - if (!first) { + for (Map.Entry<String, DocsumDefinition> e : definitionsByName.entrySet() ) { + if (sb.length() != 0) { sb.append(","); - } else { - first = false; } - Map.Entry<Long, DocsumDefinition> entry = itr.next(); - sb.append("[").append(entry.getKey()).append(",").append(entry.getValue().getName()).append("]"); + sb.append("[").append(e.getKey()).append(",").append(e.getValue().getName()).append("]"); } return sb.toString(); } public int size() { - return definitions.size(); + return definitionsByName.size(); } private void configure(DocumentdbInfoConfig.Documentdb config) { for (int i = 0; i < config.summaryclass().size(); ++i) { DocumentdbInfoConfig.Documentdb.Summaryclass sc = config.summaryclass(i); DocsumDefinition docSumDef = new DocsumDefinition(sc, emulationConfig); - definitions.put((long) sc.id(), docSumDef); definitionsByName.put(sc.name(), docSumDef); } - if (definitions.size() == 0) { + if (definitionsByName.size() == 0) { log.warning("No summary classes found in DocumentdbInfoConfig.Documentdb"); } } 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 f86db1439e1..aab8aae6025 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 @@ -267,14 +267,6 @@ public class FastHit extends Hit { this.distributionKey = distributionKey; } - public void addSummary(Docsum docsum) { - LazyDocsumValue lazyDocsumValue = new LazyDocsumValue(docsum); - reserve(docsum.getDefinition().getFieldCount()); - for (DocsumField field : docsum.getDefinition().getFields()) { - setDocsumFieldIfNotPresent(field.getName(), lazyDocsumValue); - } - } - void addSummary(DocsumDefinition docsumDef, Inspector value) { reserve(docsumDef.getFieldCount()); for (DocsumField field : docsumDef.getFields()) { @@ -386,33 +378,6 @@ public class FastHit extends Hit { abstract RawField getFieldAsUtf8(String fieldName); } - /** - * Represents a value that resides in the docsum. - */ - private static class LazyDocsumValue extends LazyValue { - - private final Docsum docsum; - - LazyDocsumValue(Docsum docsum) { - this.docsum = docsum; - } - - Object getValue(String fieldName) { - return docsum.decode(getFieldIndex(fieldName)); - } - - private int getFieldIndex(String fieldName) { - Integer index = docsum.getFieldIndex(fieldName); - if (index == null) throw new AssertionError("Invalid fieldName " + fieldName); - return index; - } - - RawField getFieldAsUtf8(String fieldName) { - return docsum.fetchFieldAsUtf8(getFieldIndex(fieldName)); - } - - } - private static class LazyString extends LazyValue { private final Inspector value; diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/DocsumDefinitionTestCase.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/DocsumDefinitionTestCase.java index 9536a664b88..132f15d2061 100644 --- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/DocsumDefinitionTestCase.java +++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/DocsumDefinitionTestCase.java @@ -1,12 +1,10 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.prelude.fastsearch.test; - import com.yahoo.config.subscription.ConfigGetter; import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig; import com.yahoo.prelude.fastsearch.ByteField; import com.yahoo.prelude.fastsearch.DataField; -import com.yahoo.prelude.fastsearch.Docsum; import com.yahoo.prelude.fastsearch.DocsumDefinition; import com.yahoo.prelude.fastsearch.DocsumDefinitionSet; import com.yahoo.prelude.fastsearch.FastHit; @@ -14,6 +12,12 @@ import com.yahoo.prelude.fastsearch.IntegerField; import com.yahoo.prelude.fastsearch.StringField; import com.yahoo.document.DocumentId; import com.yahoo.document.GlobalId; +import com.yahoo.slime.BinaryFormat; +import com.yahoo.slime.Cursor; +import com.yahoo.slime.Slime; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; /** @@ -31,16 +35,16 @@ public class DocsumDefinitionTestCase extends junit.framework.TestCase { String summary_cf = "file:src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg"; DocsumDefinitionSet set = createDocsumDefinitionSet(summary_cf); - String[] defs = new String[] { "[0,default]", "[1,version1]", - "[237,withranklog]", "[2,version2]", "[3,version3]", - "[4,version4]", "[5,version5]" }; + String[] defs = new String[] { "[default,default]", "[version1,version1]", + "[withranklog,withranklog]", "[version2,version2]", "[version3,version3]", + "[version4,version4]", "[version5,version5]" }; String setAsString = set.toString(); for (String d : defs) { assertFalse(setAsString.indexOf(d) == -1); } assertEquals(7, set.size()); - DocsumDefinition docsum0 = set.getDocsumDefinition(0); + DocsumDefinition docsum0 = set.getDocsumDefinition("default"); assertNotNull(docsum0); assertEquals("default", docsum0.getName()); @@ -59,7 +63,7 @@ public class DocsumDefinitionTestCase extends junit.framework.TestCase { DocsumDefinitionSet set = createDocsumDefinitionSet(summary_cf); FastHit hit = new FastHit(); - set.lazyDecode(null, docsum4, hit); + set.lazyDecode(null, makeDocsum(), hit); assertEquals("Arts/Celebrities/Madonna", hit.getField("TOPIC")); assertEquals("1", hit.getField("EXTINFOSOURCE").toString()); assertEquals("10", hit.getField("LANG1").toString()); @@ -67,325 +71,28 @@ public class DocsumDefinitionTestCase extends junit.framework.TestCase { assertEquals("index:0/0/0/" + FastHit.asHexString(hit.getGlobalId()), hit.getId().toString()); } - public void testDecodingCompressed() { - String summary_cf = "file:src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg"; - DocsumDefinitionSet set = createDocsumDefinitionSet(summary_cf); - FastHit hit = new FastHit(); - - set.lazyDecode(null, docsum5, hit); - assertEquals("Madonna", hit.getField("TITLE")); - assertEquals(561, ((String) hit.getField("DYNTEASER")).length()); - } - - public void testLazyDecoding() { - String summary_cf = "file:src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg"; - DocsumDefinitionSet set = createDocsumDefinitionSet(summary_cf); - DocsumDefinition def = set.getDocsumDefinition(4); - Docsum sum = new Docsum(def, docsum4); - FastHit hit = new FastHit(); - hit.addSummary(sum); - - assertEquals("Arts/Celebrities/Madonna", hit.getField("TOPIC").toString()); - assertEquals("1", hit.getField("EXTINFOSOURCE").toString()); - assertEquals("10", hit.getField("LANG1").toString()); - assertEquals("352", hit.getField("WORDS").toString()); - assertEquals("index:0/0/0/" + FastHit.asHexString(hit.getGlobalId()), hit.getId().toString()); - } - - public void testLazyDecodingCompressed() { - String summary_cf = "file:src/test/java/com/yahoo/prelude/fastsearch/test/documentdb-info.cfg"; - DocsumDefinitionSet set = createDocsumDefinitionSet(summary_cf); - DocsumDefinition def = set.getDocsumDefinition(5); - Docsum sum = new Docsum(def, docsum5); - FastHit hit = new FastHit(); - hit.addSummary(sum); - - assertEquals("Madonna", hit.getField("TITLE")); - assertEquals(561, ((String) hit.getField("DYNTEASER")).length()); - - } - public static GlobalId createGlobalId(int docId) { return new GlobalId((new DocumentId("doc:test:" + docId)).getGlobalId()); } - public static byte[] docsum4 = { - (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x1e, (byte) 0x00, - (byte) 0x68, // 4, 104, 0, 'h' - (byte) 0x74, (byte) 0x74, (byte) 0x70, (byte) 0x3a, (byte) 0x2f, - (byte) 0x2f, (byte) 0x77, (byte) 0x77, (byte) 0x77, (byte) 0x2e, - (byte) 0x73, (byte) 0x74, (byte) 0x75, (byte) 0x64, (byte) 0x79, - (byte) 0x6f, (byte) 0x66, (byte) 0x6d, (byte) 0x61, (byte) 0x64, - (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, (byte) 0x61, (byte) 0x2e, - (byte) 0x63, (byte) 0x6f, (byte) 0x6d, (byte) 0x2f, (byte) 0x00, - (byte) 0x00, (byte) 0x4d, (byte) 0x00, (byte) 0x53, (byte) 0x74, - (byte) 0x75, (byte) 0x64, (byte) 0x79, (byte) 0x4f, (byte) 0x66, - (byte) 0x4d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x6e, (byte) 0x61, (byte) 0x2e, (byte) 0x63, (byte) 0x6f, - (byte) 0x6d, (byte) 0x20, (byte) 0x2d, (byte) 0x20, (byte) 0x49, - (byte) 0x6e, (byte) 0x74, (byte) 0x65, (byte) 0x72, (byte) 0x76, - (byte) 0x69, (byte) 0x65, (byte) 0x77, (byte) 0x73, (byte) 0x2c, - (byte) 0x20, (byte) 0x41, (byte) 0x72, (byte) 0x74, (byte) 0x69, - (byte) 0x63, (byte) 0x6c, (byte) 0x65, (byte) 0x73, (byte) 0x2c, - (byte) 0x20, (byte) 0x52, (byte) 0x65, (byte) 0x76, (byte) 0x69, - (byte) 0x65, (byte) 0x77, (byte) 0x73, (byte) 0x2c, (byte) 0x20, - (byte) 0x51, (byte) 0x75, (byte) 0x6f, (byte) 0x74, (byte) 0x65, - (byte) 0x73, (byte) 0x2c, (byte) 0x20, (byte) 0x45, (byte) 0x73, - (byte) 0x73, (byte) 0x61, (byte) 0x79, (byte) 0x73, (byte) 0x20, - (byte) 0x61, (byte) 0x6e, (byte) 0x64, (byte) 0x20, (byte) 0x6d, - (byte) 0x6f, (byte) 0x72, (byte) 0x65, (byte) 0x2e, (byte) 0x2e, - (byte) 0xfd, (byte) 0x00, (byte) 0x6d, (byte) 0x61, (byte) 0x64, - (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, (byte) 0x61, (byte) 0x20, - (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, (byte) 0x61, - (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, (byte) 0x61, - (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, - (byte) 0x6e, (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, - (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, - (byte) 0x61, (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, - (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, (byte) 0x61, (byte) 0x20, - (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, (byte) 0x61, - (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, (byte) 0x61, - (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, - (byte) 0x6e, (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, - (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, - (byte) 0x61, (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, - (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, (byte) 0x61, (byte) 0x20, - (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, (byte) 0x61, - (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, (byte) 0x61, - (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, - (byte) 0x6e, (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, - (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, - (byte) 0x61, (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, - (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, (byte) 0x61, (byte) 0x20, - (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, (byte) 0x61, - (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, (byte) 0x61, - (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, - (byte) 0x6e, (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, - (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, - (byte) 0x61, (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, - (byte) 0x6f, (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, - (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x61, - (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, - (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, (byte) 0x61, - (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x61, (byte) 0x20, - (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x61, (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, - (byte) 0x6f, (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, - (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x61, - (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, - (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, (byte) 0x61, - (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x61, (byte) 0x20, - (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x61, (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, - (byte) 0x6f, (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, - (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x61, - (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, - (byte) 0x6e, (byte) 0x61, (byte) 0x2e, (byte) 0x2e, (byte) 0x2e, - (byte) 0x18, (byte) 0x00, (byte) 0x41, (byte) 0x72, (byte) 0x74, - (byte) 0x73, (byte) 0x2f, (byte) 0x43, (byte) 0x65, (byte) 0x6c, - (byte) 0x65, (byte) 0x62, (byte) 0x72, (byte) 0x69, (byte) 0x74, - (byte) 0x69, (byte) 0x65, (byte) 0x73, (byte) 0x2f, (byte) 0x4d, - (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, - (byte) 0x61, (byte) 0x13, (byte) 0x00, (byte) 0x43, (byte) 0x65, - (byte) 0x6c, (byte) 0x65, (byte) 0x62, (byte) 0x72, (byte) 0x69, - (byte) 0x74, (byte) 0x69, (byte) 0x65, (byte) 0x73, (byte) 0x2f, - (byte) 0x4d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x6e, (byte) 0x61, (byte) 0x4f, (byte) 0x00, (byte) 0x55, - (byte) 0x73, (byte) 0x65, (byte) 0x73, (byte) 0x20, (byte) 0x69, - (byte) 0x6e, (byte) 0x74, (byte) 0x65, (byte) 0x72, (byte) 0x76, - (byte) 0x69, (byte) 0x65, (byte) 0x77, (byte) 0x73, (byte) 0x2c, - (byte) 0x20, (byte) 0x61, (byte) 0x72, (byte) 0x74, (byte) 0x69, - (byte) 0x63, (byte) 0x6c, (byte) 0x65, (byte) 0x73, (byte) 0x2c, - (byte) 0x20, (byte) 0x61, (byte) 0x6e, (byte) 0x64, (byte) 0x20, - (byte) 0x71, (byte) 0x75, (byte) 0x6f, (byte) 0x74, (byte) 0x65, - (byte) 0x73, (byte) 0x20, (byte) 0x74, (byte) 0x6f, (byte) 0x20, - (byte) 0x73, (byte) 0x74, (byte) 0x75, (byte) 0x64, (byte) 0x79, - (byte) 0x20, (byte) 0x68, (byte) 0x6f, (byte) 0x77, (byte) 0x20, - (byte) 0x4d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x68, (byte) 0x61, - (byte) 0x73, (byte) 0x20, (byte) 0x63, (byte) 0x68, (byte) 0x61, - (byte) 0x6e, (byte) 0x67, (byte) 0x65, (byte) 0x64, (byte) 0x20, - (byte) 0x63, (byte) 0x75, (byte) 0x6c, (byte) 0x74, (byte) 0x75, - (byte) 0x72, (byte) 0x65, (byte) 0x2e, (byte) 0x01, (byte) 0x00, - (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x76, (byte) 0x16, - (byte) 0x32, (byte) 0x00, (byte) 0xe6, (byte) 0x23, (byte) 0x00, - (byte) 0x00, (byte) 0x60, (byte) 0x01, (byte) 0x00, (byte) 0x00, - (byte) 0x2c, (byte) 0xcb, (byte) 0x70, (byte) 0x3e, (byte) 0x2c, - (byte) 0xcb, (byte) 0x70, (byte) 0x3e, (byte) 0x0a, (byte) 0xff, - (byte) 0xff, (byte) 0xff, (byte) 0x2e, (byte) 0xd3, (byte) 0x3a, - (byte) 0xa1, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, - (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xfd, - (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x1c, (byte) 0x69, - (byte) 0x6e, (byte) 0x74, (byte) 0x6f, (byte) 0x20, (byte) 0x6f, - (byte) 0x6e, (byte) 0x65, (byte) 0x20, (byte) 0x77, (byte) 0x65, - (byte) 0x62, (byte) 0x73, (byte) 0x69, (byte) 0x74, (byte) 0x65, - (byte) 0x20, (byte) 0x6f, (byte) 0x6e, (byte) 0x20, (byte) 0x68, - (byte) 0x6f, (byte) 0x77, (byte) 0x20, (byte) 0x02, (byte) 0x4d, - (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, - (byte) 0x61, (byte) 0x03, (byte) 0x20, (byte) 0x68, (byte) 0x61, - (byte) 0x73, (byte) 0x20, (byte) 0x61, (byte) 0x6e, (byte) 0x64, - (byte) 0x20, (byte) 0x63, (byte) 0x6f, (byte) 0x6e, (byte) 0x74, - (byte) 0x69, (byte) 0x6e, (byte) 0x75, (byte) 0x65, (byte) 0x73, - (byte) 0x20, (byte) 0x74, (byte) 0x6f, (byte) 0x20, (byte) 0x73, - (byte) 0x68, (byte) 0x61, (byte) 0x70, (byte) 0x65, (byte) 0x1c, - (byte) 0x74, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x73, - (byte) 0x69, (byte) 0x74, (byte) 0x65, (byte) 0x20, (byte) 0x66, - (byte) 0x75, (byte) 0x6c, (byte) 0x6c, (byte) 0x20, (byte) 0x6a, - (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x69, (byte) 0x63, - (byte) 0x65, (byte) 0x20, (byte) 0x2e, (byte) 0x2e, (byte) 0x20, - (byte) 0x54, (byte) 0x68, (byte) 0x69, (byte) 0x73, (byte) 0x20, - (byte) 0x4f, (byte) 0x72, (byte) 0x69, (byte) 0x67, (byte) 0x69, - (byte) 0x6e, (byte) 0x61, (byte) 0x6c, (byte) 0x20, (byte) 0x02, - (byte) 0x4d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x6e, (byte) 0x61, (byte) 0x03, (byte) 0x20, (byte) 0x57, - (byte) 0x65, (byte) 0x62, (byte) 0x72, (byte) 0x69, (byte) 0x6e, - (byte) 0x67, (byte) 0x20, (byte) 0x73, (byte) 0x69, (byte) 0x74, - (byte) 0x65, (byte) 0x20, (byte) 0x6f, (byte) 0x77, (byte) 0x6e, - (byte) 0x65, (byte) 0x64, (byte) 0x20, (byte) 0x62, (byte) 0x79, - (byte) 0x20, (byte) 0x4a, (byte) 0x65, (byte) 0x6e, (byte) 0x6e, - (byte) 0x69, (byte) 0x66, (byte) 0x65, (byte) 0x72, (byte) 0x20, - (byte) 0x57, (byte) 0x61, (byte) 0x6c, (byte) 0x6c, (byte) 0x72, - (byte) 0x61, (byte) 0x66, (byte) 0x66, (byte) 0x1c, (byte) 0x02, - (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x6e, (byte) 0x61, (byte) 0x03, (byte) 0x20, (byte) 0x02, - (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x6e, (byte) 0x61, (byte) 0x03, (byte) 0x20, (byte) 0x02, - (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x6e, (byte) 0x61, (byte) 0x03, (byte) 0x20, (byte) 0x02, - (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x6e, (byte) 0x61, (byte) 0x03, (byte) 0x20, (byte) 0x02, - (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x6e, (byte) 0x61, (byte) 0x03, (byte) 0x20, (byte) 0x02, - (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x6e, (byte) 0x61, (byte) 0x03, (byte) 0x20, (byte) 0x6d, - (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x61, - (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, - (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, (byte) 0x61, - (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x61, (byte) 0x20, - (byte) 0x6d, (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, - (byte) 0x61, (byte) 0x20, (byte) 0x6d, (byte) 0x61, (byte) 0x64, - (byte) 0x6f, (byte) 0x6e, (byte) 0x61, (byte) 0x20, (byte) 0x6d, - (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x61, - (byte) 0x1c}; - - // this has compressed fields - public static byte[] docsum5 = { - (byte) 0x05, (byte) 0x00, (byte) 0x00, (byte) 0x00, // 5, 41, 0, 'h', 't', 't' - (byte) 0x29, (byte) 0x00, (byte) 0x68, (byte) 0x74, (byte) 0x74, - (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f, (byte) 0x77, - (byte) 0x77, (byte) 0x77, (byte) 0x2e, (byte) 0x68, (byte) 0x75, - (byte) 0x6e, (byte) 0x67, (byte) 0x61, (byte) 0x72, (byte) 0x69, - (byte) 0x61, (byte) 0x6e, (byte) 0x62, (byte) 0x65, (byte) 0x73, - (byte) 0x74, (byte) 0x2e, (byte) 0x63, (byte) 0x6f, (byte) 0x6d, - (byte) 0x2f, (byte) 0x4a, (byte) 0x6f, (byte) 0x7a, (byte) 0x73, - (byte) 0x61, (byte) 0x2f, (byte) 0x37, (byte) 0x2e, (byte) 0x68, - (byte) 0x74, (byte) 0x6d, (byte) 0x6c, (byte) 0x00, (byte) 0x00, - (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0x00, (byte) 0x4d, - (byte) 0x61, (byte) 0x64, (byte) 0x6f, (byte) 0x6e, (byte) 0x6e, - (byte) 0x61, (byte) 0x79, (byte) 0x00, (byte) 0x41, (byte) 0x6d, - (byte) 0x65, (byte) 0x6e, (byte) 0x6e, (byte) 0x79, (byte) 0x69, - (byte) 0x62, (byte) 0x65, (byte) 0x6e, (byte) 0x20, (byte) 0x6d, - (byte) 0xc3, (byte) 0xa1, (byte) 0x73, (byte) 0x20, (byte) 0x6f, - (byte) 0x72, (byte) 0x73, (byte) 0x7a, (byte) 0xc3, (byte) 0xa1, - (byte) 0x67, (byte) 0x62, (byte) 0x61, (byte) 0x20, (byte) 0x6b, - (byte) 0xc3, (byte) 0xad, (byte) 0x76, (byte) 0xc3, (byte) 0xa1, - (byte) 0x6e, (byte) 0x6a, (byte) 0x61, (byte) 0x20, (byte) 0x20, - (byte) 0x20, (byte) 0x20, (byte) 0x20, (byte) 0x20, (byte) 0x20, - (byte) 0x61, (byte) 0x20, (byte) 0x74, (byte) 0x65, (byte) 0x72, - (byte) 0x6d, (byte) 0xc3, (byte) 0xa9, (byte) 0x6b, (byte) 0x65, - (byte) 0x74, (byte) 0x20, (byte) 0x6b, (byte) 0xc3, (byte) 0xbc, - (byte) 0x6c, (byte) 0x64, (byte) 0x65, (byte) 0x6e, (byte) 0x69, - (byte) 0x2c, (byte) 0x20, (byte) 0x6b, (byte) 0xc3, (byte) 0xa9, - (byte) 0x72, (byte) 0x6a, (byte) 0xc3, (byte) 0xbc, (byte) 0x6b, - (byte) 0x20, (byte) 0x65, (byte) 0x2d, (byte) 0x6d, (byte) 0x61, - (byte) 0x69, (byte) 0x6c, (byte) 0x2d, (byte) 0x62, (byte) 0x65, - (byte) 0x6e, (byte) 0x20, (byte) 0x76, (byte) 0x65, (byte) 0x67, - (byte) 0x79, (byte) 0x65, (byte) 0x20, (byte) 0x66, (byte) 0x65, - (byte) 0x6c, (byte) 0x20, (byte) 0x76, (byte) 0x65, (byte) 0x6c, - (byte) 0xc3, (byte) 0xbc, (byte) 0x6e, (byte) 0x6b, (byte) 0x20, - (byte) 0x20, (byte) 0x20, (byte) 0x20, (byte) 0x20, (byte) 0x20, - (byte) 0x20, (byte) 0x61, (byte) 0x20, (byte) 0x6b, (byte) 0x61, - (byte) 0x70, (byte) 0x63, (byte) 0x73, (byte) 0x6f, (byte) 0x6c, - (byte) 0x61, (byte) 0x74, (byte) 0x6f, (byte) 0x74, (byte) 0x00, - (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, - (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, - (byte) 0x05, (byte) 0x27, (byte) 0x01, (byte) 0x00, (byte) 0xc2, - (byte) 0x11, (byte) 0x00, (byte) 0x00, (byte) 0x3e, (byte) 0x00, - (byte) 0x00, (byte) 0x00, (byte) 0xc1, (byte) 0x00, (byte) 0x58, - (byte) 0x3d, (byte) 0xc1, (byte) 0x00, (byte) 0x58, (byte) 0x3d, - (byte) 0x17, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x2f, - (byte) 0xf0, (byte) 0xe4, (byte) 0xc3, (byte) 0x00, (byte) 0x00, - (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, - (byte) 0x00, (byte) 0x42, (byte) 0x01, (byte) 0x00, (byte) 0x80, - (byte) 0x49, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x78, - (byte) 0x9c, (byte) 0xad, (byte) 0x91, (byte) 0xb1, (byte) 0x6e, - (byte) 0xc2, (byte) 0x40, (byte) 0x0c, (byte) 0x86, (byte) 0x5f, - (byte) 0xc5, (byte) 0xdd, (byte) 0x09, (byte) 0x4d, (byte) 0x04, - (byte) 0x41, (byte) 0x88, (byte) 0xa9, (byte) 0xd0, (byte) 0x16, - (byte) 0xb5, (byte) 0x48, (byte) 0x08, (byte) 0xa9, (byte) 0xd0, - (byte) 0x85, (byte) 0xcd, (byte) 0x81, (byte) 0x6b, (byte) 0x08, - (byte) 0xb9, (byte) 0xbb, (byte) 0xa0, (byte) 0x9c, (byte) 0x83, - (byte) 0x94, (byte) 0x6c, (byte) 0x7d, (byte) 0x80, (byte) 0x4e, - (byte) 0x7d, (byte) 0x82, (byte) 0x8c, (byte) 0x19, (byte) 0x58, - (byte) 0x3b, (byte) 0xb1, (byte) 0xf9, (byte) 0xc5, (byte) 0x7a, - (byte) 0x51, (byte) 0xa1, (byte) 0x64, (byte) 0x40, (byte) 0xea, - (byte) 0x52, (byte) 0x4f, (byte) 0xff, (byte) 0xd9, (byte) 0xf7, - (byte) 0x7f, (byte) 0xbe, (byte) 0xb3, (byte) 0x27, (byte) 0xfc, - (byte) 0xb9, (byte) 0x9c, (byte) 0x0f, (byte) 0xe1, (byte) 0x12, - (byte) 0x93, (byte) 0xd7, (byte) 0x87, (byte) 0xe7, (byte) 0x45, - (byte) 0xe3, (byte) 0xfc, (byte) 0xe4, (byte) 0x78, (byte) 0x6e, - (byte) 0xdf, (byte) 0x87, (byte) 0x16, (byte) 0x8c, (byte) 0xb2, - (byte) 0x35, (byte) 0xee, (byte) 0x84, (byte) 0xa1, (byte) 0x16, - (byte) 0xcc, (byte) 0x89, (byte) 0xcb, (byte) 0x8d, (byte) 0xcc, - (byte) 0x21, (byte) 0x6b, (byte) 0x83, (byte) 0xe7, (byte) 0xb7, - (byte) 0x2f, (byte) 0x57, (byte) 0x17, (byte) 0x42, (byte) 0x0e, - (byte) 0xdc, (byte) 0x9e, (byte) 0xe3, (byte) 0xdd, (byte) 0x76, - (byte) 0x3a, (byte) 0x7d, (byte) 0xa7, (byte) 0xdb, (byte) 0xeb, - (byte) 0xf6, (byte) 0xe1, (byte) 0x5f, (byte) 0x62, (byte) 0x08, - (byte) 0xf3, (byte) 0xe5, (byte) 0x6c, (byte) 0x34, (byte) 0x7b, - (byte) 0x81, (byte) 0x7b, (byte) 0xfe, (byte) 0x98, (byte) 0x3e, - (byte) 0x0e, (byte) 0x9a, (byte) 0xa5, (byte) 0x29, (byte) 0xae, - (byte) 0x13, (byte) 0xad, (byte) 0xf1, (byte) 0xba, (byte) 0xaf, - (byte) 0xe3, (byte) 0xc2, (byte) 0x4a, (byte) 0x81, (byte) 0xc2, - (byte) 0x10, (byte) 0x4d, (byte) 0x33, (byte) 0xed, (byte) 0xf9, - (byte) 0x75, (byte) 0xda, (byte) 0x14, (byte) 0x5c, (byte) 0x49, - (byte) 0x61, (byte) 0xae, (byte) 0x3b, (byte) 0x4f, (byte) 0x7d, - (byte) 0x0b, (byte) 0xe0, (byte) 0x32, (byte) 0x05, (byte) 0xac, - (byte) 0x11, (byte) 0x39, (byte) 0xa6, (byte) 0x49, (byte) 0x6a, - (byte) 0x3d, (byte) 0x65, (byte) 0x18, (byte) 0x41, (byte) 0x1c, - (byte) 0xd5, (byte) 0x42, (byte) 0x4a, (byte) 0x3e, (byte) 0xd8, - (byte) 0x39, (byte) 0x18, (byte) 0x88, (byte) 0xf9, (byte) 0x4b, - (byte) 0x92, (byte) 0xe1, (byte) 0x2a, (byte) 0xe4, (byte) 0x8a, - (byte) 0x7e, (byte) 0x8c, (byte) 0x5c, (byte) 0x19, (byte) 0x40, - (byte) 0x6b, (byte) 0x7e, (byte) 0x1f, (byte) 0x0f, (byte) 0x1d, - (byte) 0x82, (byte) 0xc8, (byte) 0x00, (byte) 0x61, (byte) 0x4a, - (byte) 0x28, (byte) 0x15, (byte) 0x16, (byte) 0x05, (byte) 0xde, - (byte) 0x9c, (byte) 0xe1, (byte) 0x4a, (byte) 0x68, (byte) 0x9d, - (byte) 0x47, (byte) 0x81, (byte) 0xd0, (byte) 0xa0, (byte) 0x6a, - (byte) 0xca, (byte) 0x89, (byte) 0x1e, (byte) 0xa0, (byte) 0xe5, - (byte) 0x1d, (byte) 0xf6, (byte) 0x5c, (byte) 0xea, (byte) 0xed, - (byte) 0xf9, (byte) 0x57, (byte) 0x08, (byte) 0x24, (byte) 0x52, - (byte) 0xc5, (byte) 0x55, (byte) 0x2c, (byte) 0xc8, (byte) 0xd6, - (byte) 0x8e, (byte) 0x72, (byte) 0x2d, (byte) 0x74, (byte) 0xd4, - (byte) 0xb2, (byte) 0xaa, (byte) 0x4a, (byte) 0xb7, (byte) 0x7c, - (byte) 0x8c, (byte) 0x41, (byte) 0x38, (byte) 0x0a, (byte) 0x23, - (byte) 0xe9, (byte) 0xd4, (byte) 0xa0, (byte) 0xbd, (byte) 0x08, - (byte) 0x73, (byte) 0x01, (byte) 0x6f, (byte) 0x42, (byte) 0x5a, - (byte) 0x25, (byte) 0xf9, (byte) 0xa8, (byte) 0xe3, (byte) 0x5f, - (byte) 0x42, (byte) 0x8c, (byte) 0xbb, (byte) 0x95, (byte) 0x49, - (byte) 0x24, (byte) 0x52, (byte) 0x42, (byte) 0xa7, (byte) 0x07, - (byte) 0x6c, (byte) 0x32, (byte) 0x1d, (byte) 0xd8, (byte) 0x65, - (byte) 0xde, (byte) 0x29, (byte) 0x24, (byte) 0xdc, (byte) 0x6b, - (byte) 0x41, (byte) 0xed, (byte) 0x4d, (byte) 0xf6, (byte) 0xc7, - (byte) 0x12, (byte) 0x4c, (byte) 0x91, (byte) 0x04, (byte) 0x49, - (byte) 0x5a, (byte) 0x8f, (byte) 0x04, (byte) 0x9b, (byte) 0x3b, - (byte) 0xf0, (byte) 0x7b, (byte) 0xae, (byte) 0xeb, (byte) 0xc2, - (byte) 0x98, (byte) 0xbe, (byte) 0x01, (byte) 0xd3, (byte) 0xfa, - (byte) 0xa2, (byte) 0x8f }; + public static byte[] makeDocsum() { + Slime slime = new Slime(); + Cursor docsum = slime.setObject(); + docsum.setString("TOPIC", "Arts/Celebrities/Madonna"); + docsum.setString("TITLE", "StudyOfMadonna.com - Interviews, Articles, Reviews, Quotes, Essays and more.."); + docsum.setString("DYNTEASER", "dynamic teaser"); + docsum.setLong("EXTINFOSOURCE", 1); + docsum.setLong("LANG1", 10); + docsum.setLong("WORDS", 352); + docsum.setLong("BYTES", 9190); + byte[] tmp = BinaryFormat.encode(slime); + ByteBuffer buf = ByteBuffer.allocate(tmp.length + 4); + buf.order(ByteOrder.LITTLE_ENDIAN); + buf.putInt(DocsumDefinitionSet.SLIME_MAGIC_ID); + buf.order(ByteOrder.BIG_ENDIAN); + buf.put(tmp); + return buf.array(); + } public static DocsumDefinitionSet createDocsumDefinitionSet(String configID) { DocumentdbInfoConfig config = new ConfigGetter<>(DocumentdbInfoConfig.class).getConfig(configID); diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/fs4mock/MockFDispatch.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/fs4mock/MockFDispatch.java index b5db5a47926..6956f288d1a 100644 --- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/fs4mock/MockFDispatch.java +++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/fs4mock/MockFDispatch.java @@ -48,7 +48,7 @@ public class MockFDispatch { 25, 0, 0, 0, 111, 0, 0, 0, 97, 0, 0, 0, 3, 0, 0, 0, 23, 0, 0, 0, 7, 0, 0, 0, 36, 0, 0, 0, 4, 0, 0, 0, 21, 0, 0, 0, 8, 0, 0, 0, 37}; - private static byte[] docsumData = DocsumDefinitionTestCase.docsum4; + private static byte[] docsumData = DocsumDefinitionTestCase.makeDocsum(); private static byte[] docsumHeadPacketData = new byte[] { 0, 0, 3, 39, 0, 0, diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/fs4mock/MockFSChannel.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/fs4mock/MockFSChannel.java index a78172d96cd..8d705406774 100644 --- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/fs4mock/MockFSChannel.java +++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/fs4mock/MockFSChannel.java @@ -136,8 +136,7 @@ public class MockFSChannel extends FS4Channel { 123, 456, 789, 789, 789, 789, 789, 789, 789, 789, 789, 789 }; - buffer = createDocsumPacketData(docids[i], - DocsumDefinitionTestCase.docsum4); + buffer = createDocsumPacketData(docids[i], DocsumDefinitionTestCase.makeDocsum()); } buffer.position(0); packets.add(PacketDecoder.decode(buffer)); diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/HitConverterTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/HitConverterTestCase.java index abdcc93965e..e5fe0111655 100644 --- a/container-search/src/test/java/com/yahoo/search/grouping/vespa/HitConverterTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/HitConverterTestCase.java @@ -119,7 +119,7 @@ public class HitConverterTestCase { 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[] { 0, 0, 0, 0 }, 1); + VdsHit lowHit = new VdsHit("doc:scheme:", new byte[] { 0x55, 0x55, 0x55, 0x55 }, 1); lowHit.setContext(context); Hit hit = converter.toSearchHit("69", lowHit); assertNotNull(hit); diff --git a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java index 83e46f5f5d1..d0b23e62e16 100644 --- a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java +++ b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java @@ -89,7 +89,7 @@ public class VdsStreamingSearcherTestCase { if (emptyDocsum) { summary = new byte[] {}; } else { - summary = new byte[] { 0, 0, 0, 0 }; // Fake docsum data + summary = new byte[] { 0x55, 0x55, 0x55, 0x55 }; // Fake docsum data } hits.add(new SearchResult.Hit(docId, 1.0)); summaryMap.put(docId, new DocumentSummary.Summary(docId, summary)); |