server-php-xml-class-xindice-class-xindice.php / php
<? //#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
###
// Title : class_xindice.php // Version : 1.0 // Author : Luis Argerich (lrargerich@yahoo.com) // Last modification date : 05-15-2002 // Description : This class allows you to use an Xindice server // from PHP using the XML-RPC API. //#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
###
// History: // 05-15-2002 First release of this class //#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
###
// To-Dos: //#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
###
// How to use it: // Check the example <test.php> for several examples about how to use this class // usage is straightforward. //#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
###
include_once("xmlrpc/xmlrpc.inc"); class Xindice { var error; function getError() { return debug) { debug); } function Xindice(server_port=4080) { server_uri,// Collection management functions function listCollections(collection) { collection); paths[1].'.'."listCollections"; method,array(new xmlrpcval(this->sendMsg(collectionPath) { collectionPath); paths[1].'.'."getDocumentCount"; method,array(new xmlrpcval(this->sendMsg(base,paths=split('/',method=msg=new xmlrpcmsg(base,"string"),new xmlrpcval(this->sendMsg(collectionPath) { collectionPath); paths[1].'.'."dropCollection"; method,array(new xmlrpcval(this->sendMsg(// Document management functions function insertDocument(collection,content) { collection); paths[1].'.'."insertDocument"; method,array(new xmlrpcval(id,"string"),new xmlrpcval(this->sendMsg(collection,content) { } function getDocument(id) { collection); paths[1].'.'."getDocument"; method,array(new xmlrpcval(id,"string"))); return msg); } function listDocuments(paths=split('/',method=msg=new xmlrpcmsg(collection,"string"))); return msg); } function removeDocument(id) { collection); paths[1].'.'."removeDocument"; method,array(new xmlrpcval(id,"string"))); return msg); } // Index management functions function createIndexer(indexName,paths=split('/',method=msg=new xmlrpcmsg(collection,"string"),new xmlrpcval(pattern,"string"))); return msg); } function dropIndexer(indexName) { collection); paths[1].'.'."dropIndexer"; method,array(new xmlrpcval(indexName,"string"))); return msg); } function listIndexers(paths=split('/',method=msg=new xmlrpcmsg(collection,"string"))); return msg); } // Query functions function queryDocument(type,id) { collection); paths[1].'.'."queryDocument"; method,array(new xmlrpcval(type,"string"),new xmlrpcval(id,"string"))); return msg); } function queryCollection(type,paths=split('/',method=msg=new xmlrpcmsg(collection,"string"),new xmlrpcval(query),new xmlrpcval(Array(),"struct"))); return msg); } // PRIVATE METHODS function getBase(paths=split('/',paths[0]; } function sendMsg(result=msg); if(!this->error='Cannot send xmlrpc message to the server'; return 0; } if(this->error=ret=xmlrpc_decode(ret; } } ?>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.