array ov = s->query("select id from object_versions");
foreach(ov; ; mapping v)
{
mixed err = catch(s->query("select contents from object_versions where id=:id", ([":id":(int)v["object_versions.id"]])));
if(err) // ah, a row with a problem. let's fix it...
{
werror("failed to fetch id %dn", (int)v["object_versions.id"]);
mixed t = s->query("select CAST(contents as blob) as v from object_versions where id=:id", ([":id":(int)v["object_versions.id"]]));
s->query("update object_versions set contents=:contents where id=:id", ([":id":(int)v["object_versions.id" , ":contents": t[0]["object_versions.v"]]));
}
}
object x = Protocols.XMLRPC.Client("http://localhost:8081/xmlrpc/processor");
// input data is an array whose length is a multiple of 4.
// each document input has 4 fields, so document n can be found at
// inputdata[(4*n) .. (4*n) + 3]
//
// all 4 fields are required and are:
// [0]id, [1]url, [2]title, [3]excerpt
//
// the sample data contains 1 input document.
array inputdata = ({"id0", "http://www.google.com", "google", "the google search engine"});
array clusters = x["cluster.doCluster"]("test query",
(["dcs.clusters.only":0]), ([]), inputdata)[0];
foreach(clusters;; mapping cl)
write("%s (%d)n", cl->label, sizeof(cl->documents));
No comments | Post a Comment| RSS Feed | BackLinks