1

Scenario: I've been stuck on this for way to long and I think solution might be easy but I just can't see it, this is the scenario:

cURL POST to http://localhost:8080/my_imports (raw JSON data on body)
 ->
   MyImportsCustomHandler (extends ThreadedHttpRequestHandler [Validations]
    ->
      MyObjectProcessor (extends Processor) [JSON deserialize and data massage]
       ->
         MyFirstDocumentProcessor (extends DocumentProcessor) [Set some fields and save]

Problem is that execution never reaches MyFirstDocumentProcessor, likely because request didn't started from the document_api endpoints (intentionaly). There are no errors thrown, just processing route never reaches the document processor chain, I think it should because on MyObjectProcessor I'm doing:

DocumentType type = 
localDocHandler.getDocumentTypeManager().getDocumentType("my_doc");
DocumentId id = new DocumentId("id:default:my_doc::2");
Document document = new Document(type, id);
DocumentPut docPut = new DocumentPut(document);

Processing proc = com.yahoo.docproc.Processing.of(docPut);

I got this idea from here: https://github.com/vespa-engine/vespa/blob/master/docproc/src/test/java/com/yahoo/docproc/util/SplitterJoinerTestCase.java but on that test I see this line splitter.process(p);, which I'm not able to find a suitable replacement that works inside a Processor, in that context I only have the Request, Execution and DocumentProcessingHandler

I hope somebody versed on Vespa con shine some light on this, is just the last hop on the processing chain that I can't bridge :|

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
AGuereca
  • 13
  • 3

1 Answers1

0

To write documents from Java code, you need to use the Document Access API: http://docs.vespa.ai/documentation/document-api-guide.html#document-access

A working solution is in https://github.com/vespa-engine/sample-apps/pull/44

Jon
  • 2,043
  • 11
  • 9