A marker interface for processing components providing documents for further
processing. The general process of implementing
IDocumentSource
s is the
following following:
- Create a class that implements
IDocumentSource
and annotate it with
Bindable
. You may want to extend ProcessingComponentBase
to get empty
implementations of the IProcessingComponent
life cycle methods.
- For each input parameter of your document source (e.g. query, number of results,
custom filtering etc.) declare a field and annotate it with
Attribute
and
Input
. Also, add either Init
or Processing
annotation depending
on the intended scope of the parameter. See IProcessingComponent
for
information when these fields will be populated with values passed by the caller.
- For each output value produced by your document source declare a field and annotate
it with
Attribute
, Output
and Processing
annotations. For the
Document
s fetched by your source declare a List
< Document
> field whose Attribute.key()
is AttributeNames.DOCUMENTS
- Implement the
IProcessingComponent.process()
method to fetch the documents
(based on the values read from fields annotated with Input
which will have
already been populated with values passed by the caller) and assign the results to the
fields annotated with Output
(which Carrot2 core will collect and
pass for further processing).