13 |
#include <estnode.h> |
#include <estnode.h> |
14 |
|
|
15 |
/* backward compatibility for 0.5.4 */ |
/* backward compatibility for 0.5.4 */ |
16 |
|
/* |
17 |
#ifndef ESTCONDAGITO |
#ifndef ESTCONDAGITO |
18 |
#define ESTCONDAGITO ESTCONDAGIT |
#define ESTCONDAGITO ESTCONDAGIT |
19 |
#endif |
#endif |
20 |
|
*/ |
21 |
|
|
22 |
namespace estraier { |
namespace estraier { |
23 |
|
|
417 |
if (!db) throw IOError("closed database"); |
if (!db) throw IOError("closed database"); |
418 |
return est_mtdb_size(db); |
return est_mtdb_size(db); |
419 |
} |
} |
420 |
void set_cache_size(size_t size, int anum, int tnum) { |
void set_cache_size(size_t size, int anum, int tnum, int rnum) { |
421 |
/** |
/** |
422 |
* set the maximum size of the cache memory of a database |
* set the maximum size of the cache memory of a database |
423 |
*/ |
*/ |
424 |
if (!db) throw IOError("closed database"); |
if (!db) throw IOError("closed database"); |
425 |
est_mtdb_set_cache_size(db, size, anum, tnum); |
est_mtdb_set_cache_size(db, size, anum, tnum, rnum); |
426 |
} |
} |
427 |
void set_special_cache(const char *name, int num) { |
void set_special_cache(const char *name, int num) { |
428 |
/** |
/** |
457 |
return vs; |
return vs; |
458 |
} |
} |
459 |
|
|
460 |
class NodeDocument { |
class ResultDocument { |
|
private: |
|
|
ESTRESDOC *rdoc; |
|
461 |
public: |
public: |
462 |
NodeDocument(ESTNODERES *nres, int index) { |
ESTRESDOC *rdoc; |
463 |
rdoc = est_noderes_get_doc(nres, index); |
ResultDocument(ESTRESDOC *_rdoc) { |
464 |
|
rdoc = _rdoc; |
465 |
} |
} |
466 |
const char *uri(void) { |
const char *uri(void) { |
467 |
return est_resdoc_uri(rdoc); |
return est_resdoc_uri(rdoc); |
487 |
private: |
private: |
488 |
ESTNODERES *nres; |
ESTNODERES *nres; |
489 |
public: |
public: |
490 |
NodeRes(ESTNODE *node, ESTCOND *cond, int depth) { |
NodeRes(ESTNODE *node, Condition *cond, int depth) { |
491 |
nres = est_node_search(node, cond, depth); |
nres = est_node_search(node, cond->cond, depth); |
492 |
} |
} |
493 |
~NodeRes() { |
~NodeRes() { |
494 |
est_noderes_delete(nres); |
est_noderes_delete(nres); |
506 |
int doc_num(void) { |
int doc_num(void) { |
507 |
return est_noderes_doc_num(nres); |
return est_noderes_doc_num(nres); |
508 |
} |
} |
509 |
NodeDocument * get_doc(int index) { |
ResultDocument * get_doc(int index) { |
510 |
return new NodeDocument(nres, index); |
ESTRESDOC *rdoc = est_noderes_get_doc(nres, index); |
511 |
|
if (rdoc) { |
512 |
|
return new ResultDocument(rdoc); |
513 |
|
} else { |
514 |
|
return NULL; |
515 |
|
} |
516 |
} |
} |
517 |
}; |
}; |
518 |
|
|
600 |
double size(void) { |
double size(void) { |
601 |
return est_node_size(node); |
return est_node_size(node); |
602 |
} |
} |
603 |
NodeRes * search(ESTCOND *cond, int depth) { |
NodeRes * search(Condition *cond, int depth) { |
604 |
return new NodeRes(node, cond, depth); |
return new NodeRes(node, cond, depth); |
605 |
} |
} |
606 |
int set_user(const char *name, int mode) { |
int set_user(const char *name, int mode) { |