--- trunk/perl/HyperEstraierWrapper.cpp 2005/09/08 21:22:10 11 +++ trunk/perl/HyperEstraierWrapper.cpp 2005/09/08 22:51:10 12 @@ -455,12 +455,11 @@ return vs; } - class NodeDocument { - private: - ESTRESDOC *rdoc; + class ResultDocument { public: - NodeDocument(ESTNODERES *nres, int index) { - rdoc = est_noderes_get_doc(nres, index); + ESTRESDOC *rdoc; + ResultDocument(ESTRESDOC *_rdoc) { + rdoc = _rdoc; } const char *uri(void) { return est_resdoc_uri(rdoc); @@ -486,8 +485,8 @@ private: ESTNODERES *nres; public: - NodeRes(ESTNODE *node, ESTCOND *cond, int depth) { - nres = est_node_search(node, cond, depth); + NodeRes(ESTNODE *node, Condition *cond, int depth) { + nres = est_node_search(node, cond->cond, depth); } ~NodeRes() { est_noderes_delete(nres); @@ -505,8 +504,14 @@ int doc_num(void) { return est_noderes_doc_num(nres); } - NodeDocument * get_doc(int index) { - return new NodeDocument(nres, index); + ResultDocument * get_doc(int index) { + ESTRESDOC *rdoc = est_noderes_get_doc(nres, index); + if (rdoc) { + return new ResultDocument(rdoc); + } else { + throw IOError("wtf? no document?"); + return NULL; + } } }; @@ -594,7 +599,7 @@ double size(void) { return est_node_size(node); } - NodeRes * search(ESTCOND *cond, int depth) { + NodeRes * search(Condition *cond, int depth) { return new NodeRes(node, cond, depth); } int set_user(const char *name, int mode) {