Run the sample program
This section explains how to run the sample program to index your first document.
Java Code
import com.exalead.papi.helper.Document;
import com.exalead.papi.helper.Meta;
import com.exalead.papi.helper.Part;
// [...]
final PushAPI papi = createConnection(...);
//new document (uri , stamp)
final Document doc = new Document("doc1", "2014-03-15");
// create the metas
doc.addMeta(new Meta("title", "My document's title"));
doc.addMeta(new Meta("date", "2014-03-20"));
doc.addMeta(new Meta("size", "5493"));
doc.addMeta(new Meta("approved", "false"));
// master part
final byte[] bytes = new String("the text to index...").getBytes("UTF-8");
// if you don't specify part name, the part is considered as Master part
final Part masterPart = new Part(bytes);
masterPart.setEncoding("UTF-8");
masterPart.setFileName("filename.txt")
doc.addPart(masterPart);
// another part
final Part part = new Part("Second part",bytes);
part.setEncoding("UTF-8");
part.setExtension("txt");
doc.addPart(part);
// push the document
papi.addDocument(doc); 
		C# Code
This code snippet demonstrates how to send the document.
//How to send a document.
void IndexDocument()
{
    Document doc = new Document("doc1");
    // the stamp associated to the document
    doc.Stamp = "2014-03-15";
    // create the metas
    MetaContainer metaContainer = new MetaContainer();
    metaContainer.AddMeta(new Meta("title", "My document's title"));
    metaContainer.AddMeta(new Meta("date", "2014-03-20"));
    metaContainer.AddMeta(new Meta("size", "5493"));
    metaContainer.AddMeta(new Meta("approved", "false"));
    doc.MetaContainer = metaContainer;
    PartContainer partContainer = new PartContainer();
    // master part
    byte[] bytes = new UTF8Encoding().GetBytes("the text to index...");
    Part masterPart = new Part(bytes);
    masterPart.Encoding = "UTF-8";
    masterPart.Filename = "foo.txt";
    partContainer.AddPart(masterPart);
    Part part = new Part(bytes);
    part.Encoding = "UTF-8";
    part.Filename = "foo.txt";
    partContainer.AddPart(part);
    doc.PartContainer = partContainer;
    // push the document
    papi.AddDocument(doc);
}