aboutsummaryrefslogtreecommitdiffstats
path: root/docprocs/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'docprocs/src/main/java/com')
-rw-r--r--docprocs/src/main/java/com/yahoo/docprocs/indexing/IndexingProcessor.java50
-rw-r--r--docprocs/src/main/java/com/yahoo/docprocs/indexing/ScriptManager.java7
2 files changed, 29 insertions, 28 deletions
diff --git a/docprocs/src/main/java/com/yahoo/docprocs/indexing/IndexingProcessor.java b/docprocs/src/main/java/com/yahoo/docprocs/indexing/IndexingProcessor.java
index a55159cdaa0..657c8a161f7 100644
--- a/docprocs/src/main/java/com/yahoo/docprocs/indexing/IndexingProcessor.java
+++ b/docprocs/src/main/java/com/yahoo/docprocs/indexing/IndexingProcessor.java
@@ -95,56 +95,56 @@ public class IndexingProcessor extends DocumentProcessor {
return docTypeMgr;
}
- private void processDocument(DocumentPut prev, List<DocumentOperation> out) {
- DocumentType hadType = prev.getDocument().getDataType();
+ private void processDocument(DocumentPut input, List<DocumentOperation> out) {
+ DocumentType hadType = input.getDocument().getDataType();
DocumentScript script = scriptMgr.getScript(hadType);
if (script == null) {
- log.log(Level.FINE, "No indexing script for document '%s'.", prev.getId());
- out.add(prev);
+ log.log(Level.FINE, "No indexing script for document '%s'.", input.getId());
+ out.add(input);
return;
}
- log.log(Level.FINE, "Processing document '%s'.", prev.getId());
+ log.log(Level.FINE, "Processing document '%s'.", input.getId());
DocumentType wantType = docTypeMgr.getDocumentType(hadType.getName());
- Document prevDoc = prev.getDocument();
+ Document inputDocument = input.getDocument();
if (hadType != wantType) {
// this happens when you have a concrete document; we need to
// convert back to a "normal" Document for indexing of complex structures
// to work properly.
GrowableByteBuffer buffer = new GrowableByteBuffer(64 * 1024, 2.0f);
DocumentSerializer serializer = DocumentSerializerFactory.createHead(buffer);
- serializer.write(prevDoc);
+ serializer.write(inputDocument);
buffer.flip();
- prevDoc = docTypeMgr.createDocument(buffer);
+ inputDocument = docTypeMgr.createDocument(buffer);
}
- Document next = script.execute(adapterFactory, prevDoc);
- if (next == null) {
- log.log(Level.FINE, "Document '%s' produced no output.", prev.getId());
+ Document output = script.execute(adapterFactory, inputDocument);
+ if (output == null) {
+ log.log(Level.FINE, "Document '%s' produced no output.", input.getId());
return;
}
- out.add(new DocumentPut(prev, next));
+ out.add(new DocumentPut(input, output));
}
- private void processUpdate(DocumentUpdate prev, List<DocumentOperation> out) {
- DocumentScript script = scriptMgr.getScript(prev.getType());
+ private void processUpdate(DocumentUpdate input, List<DocumentOperation> out) {
+ DocumentScript script = scriptMgr.getScript(input.getType());
if (script == null) {
- log.log(Level.FINE, "No indexing script for update '%s'.", prev.getId());
- out.add(prev);
+ log.log(Level.FINE, "No indexing script for update '%s'.", input.getId());
+ out.add(input);
return;
}
- log.log(Level.FINE, "Processing update '%s'.", prev.getId());
- DocumentUpdate next = script.execute(adapterFactory, prev);
- if (next == null) {
- log.log(Level.FINE, "Update '%s' produced no output.", prev.getId());
+ log.log(Level.FINE, "Processing update '%s'.", input.getId());
+ DocumentUpdate output = script.execute(adapterFactory, input);
+ if (output == null) {
+ log.log(Level.FINE, "Update '%s' produced no output.", input.getId());
return;
}
- next.setCondition(prev.getCondition());
- out.add(next);
+ output.setCondition(input.getCondition());
+ out.add(output);
}
- private void processRemove(DocumentRemove prev, List<DocumentOperation> out) {
- log.log(Level.FINE, "Not processing remove '%s'.", prev.getId());
- out.add(prev);
+ private void processRemove(DocumentRemove input, List<DocumentOperation> out) {
+ log.log(Level.FINE, "Not processing remove '%s'.", input.getId());
+ out.add(input);
}
private Map<String, Embedder> toMap(ComponentRegistry<Embedder> embedders) {
diff --git a/docprocs/src/main/java/com/yahoo/docprocs/indexing/ScriptManager.java b/docprocs/src/main/java/com/yahoo/docprocs/indexing/ScriptManager.java
index de3a429e357..acc5a2066c9 100644
--- a/docprocs/src/main/java/com/yahoo/docprocs/indexing/ScriptManager.java
+++ b/docprocs/src/main/java/com/yahoo/docprocs/indexing/ScriptManager.java
@@ -72,6 +72,10 @@ public class ScriptManager {
return null;
}
+ /**
+ * Returns an unmodifiable map from document type name to a map of the scripts which must be run given an update
+ * to each possible field in that type.
+ */
private static Map<String, Map<String, DocumentScript>> createScriptsMap(DocumentTypeManager docTypeMgr,
IlscriptsConfig config,
Linguistics linguistics,
@@ -106,11 +110,8 @@ public class ScriptManager {
List<StatementExpression> appendedList = new ArrayList<>(((ScriptExpression)prev.getExpression()).asList());
appendedList.add(statement);
script = new ScriptExpression(appendedList);
- log.log(Level.FINE, "Appending script for field '" + fieldName + "' = " + statement);
- log.log(Level.FINE, "Full script for field '" + fieldName + "' = " + appendedList);
} else {
script = new ScriptExpression(statement);
- log.log(Level.FINE, "Setting script for field '" + fieldName + "' = " + statement);
}
DocumentScript documentScript = new DocumentScript(ilscript.doctype(), inputFieldNameExtractor.getInputFieldNames(), script);
fieldScripts.put(fieldName, documentScript);