diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-09-11 15:41:34 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2018-09-11 15:41:34 +0200 |
commit | 06da5945a006c2e5462e72bf6bb41335cc55397a (patch) | |
tree | 07aba4de3b2a409823b2d6a73d5948ed9201eb51 /docprocs | |
parent | da218c2b4b43987d887e94cbd9326e676ad7085c (diff) |
Avoid using deprecated API
Diffstat (limited to 'docprocs')
3 files changed, 12 insertions, 9 deletions
diff --git a/docprocs/src/main/java/com/yahoo/docprocs/indexing/DocumentScript.java b/docprocs/src/main/java/com/yahoo/docprocs/indexing/DocumentScript.java index f25603deee9..088d6d0ecaf 100644 --- a/docprocs/src/main/java/com/yahoo/docprocs/indexing/DocumentScript.java +++ b/docprocs/src/main/java/com/yahoo/docprocs/indexing/DocumentScript.java @@ -9,7 +9,6 @@ import com.yahoo.document.datatypes.Array; import com.yahoo.document.datatypes.FieldValue; import com.yahoo.document.datatypes.MapFieldValue; import com.yahoo.document.datatypes.StringFieldValue; -import com.yahoo.document.datatypes.Struct; import com.yahoo.document.datatypes.StructuredFieldValue; import com.yahoo.document.datatypes.WeightedSet; import com.yahoo.document.fieldpathupdate.AssignFieldPathUpdate; @@ -20,7 +19,11 @@ import com.yahoo.document.update.ValueUpdate; import com.yahoo.vespa.indexinglanguage.AdapterFactory; import com.yahoo.vespa.indexinglanguage.expressions.Expression; -import java.util.*; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; /** * @author Simon Thoresen Hult @@ -48,7 +51,7 @@ public class DocumentScript { } public DocumentUpdate execute(AdapterFactory adapterFactory, DocumentUpdate update) { - for (FieldUpdate fieldUpdate : update.getFieldUpdates()) { + for (FieldUpdate fieldUpdate : update.getFieldUpdatesCollection()) { requireThatFieldIsDeclaredInDocument(fieldUpdate.getField()); for (ValueUpdate<?> valueUpdate : fieldUpdate.getValueUpdates()) { removeAnyLinguisticsSpanTree(valueUpdate); diff --git a/docprocs/src/test/java/com/yahoo/docprocs/indexing/DocumentScriptTestCase.java b/docprocs/src/test/java/com/yahoo/docprocs/indexing/DocumentScriptTestCase.java index a47762bfbf3..41fd72e2336 100644 --- a/docprocs/src/test/java/com/yahoo/docprocs/indexing/DocumentScriptTestCase.java +++ b/docprocs/src/test/java/com/yahoo/docprocs/indexing/DocumentScriptTestCase.java @@ -230,7 +230,7 @@ public class DocumentScriptTestCase { DocumentUpdate update = f.executeWithUpdate("structfield", new AssignFieldPathUpdate(f.type, "structfield.title", newTitleValue)); assertEquals(1, update.getFieldPathUpdates().size()); - assertEquals(0, update.getFieldUpdates().size()); + assertEquals(0, update.getFieldUpdatesCollection().size()); assertTrue(update.getFieldPathUpdates().get(0) instanceof AssignFieldPathUpdate); AssignFieldPathUpdate assignUpdate = (AssignFieldPathUpdate)update.getFieldPathUpdates().get(0); assertEquals("structfield.title", assignUpdate.getOriginalFieldPath()); diff --git a/docprocs/src/test/java/com/yahoo/docprocs/indexing/IndexingProcessorTestCase.java b/docprocs/src/test/java/com/yahoo/docprocs/indexing/IndexingProcessorTestCase.java index cef020cd828..a0dd0ac9b89 100644 --- a/docprocs/src/test/java/com/yahoo/docprocs/indexing/IndexingProcessorTestCase.java +++ b/docprocs/src/test/java/com/yahoo/docprocs/indexing/IndexingProcessorTestCase.java @@ -63,15 +63,15 @@ public class IndexingProcessorTestCase { assertTrue(output instanceof DocumentUpdate); DocumentUpdate docUpdate = (DocumentUpdate) output; - assertEquals(3, docUpdate.getFieldUpdates().size()); + assertEquals(3, docUpdate.getFieldUpdatesCollection().size()); { - FieldUpdate fieldUpdate = docUpdate.getFieldUpdate(0); + FieldUpdate fieldUpdate = docUpdate.getFieldUpdate("song"); assertEquals("song", fieldUpdate.getField().getName()); assertEquals(1, fieldUpdate.getValueUpdates().size()); ValueUpdate<?> valueUpdate = fieldUpdate.getValueUpdate(0); assertTrue(valueUpdate instanceof AssignValueUpdate); assertEquals(new StringFieldValue("isbnmarker"), valueUpdate.getValue()); - fieldUpdate = docUpdate.getFieldUpdate(1); + fieldUpdate = docUpdate.getFieldUpdate("title"); assertEquals("title", fieldUpdate.getField().getName()); assertEquals(1, fieldUpdate.getValueUpdates().size()); valueUpdate = fieldUpdate.getValueUpdate(0); @@ -80,14 +80,14 @@ public class IndexingProcessorTestCase { } { - FieldUpdate fieldUpdate = docUpdate.getFieldUpdate(1); + FieldUpdate fieldUpdate = docUpdate.getFieldUpdate("title"); ValueUpdate<?> valueUpdate = fieldUpdate.getValueUpdate(0); assertEquals("title", fieldUpdate.getField().getName()); assertTrue(valueUpdate instanceof AssignValueUpdate); assertEquals(new StringFieldValue("69"), valueUpdate.getValue()); } { - FieldUpdate fieldUpdate = docUpdate.getFieldUpdate(2); + FieldUpdate fieldUpdate = docUpdate.getFieldUpdate("isbn"); ValueUpdate<?> valueUpdate = fieldUpdate.getValueUpdate(0); assertEquals("isbn", fieldUpdate.getField().getName()); assertTrue(valueUpdate instanceof AssignValueUpdate); |