Add hits, score fields to edge struct

This commit is contained in:
c9s 2014-05-22 16:37:53 +08:00
parent 2b331ecc8f
commit d6b2e52567
2 changed files with 10 additions and 3 deletions

View file

@ -37,8 +37,8 @@ typedef struct _node node;
typedef struct _route route;
struct _node {
edge ** edges;
route ** routes;
edge ** edges;
route ** routes;
uint32_t edge_len;
uint32_t edge_cap;
uint32_t route_len;
@ -60,13 +60,16 @@ struct _node {
void * data;
uint8_t endpoint;
};
struct _edge {
char * pattern;
int pattern_len;
bool has_slug;
node * child;
uint64_t hits;
float score;
bool has_slug:1;
};
typedef struct {

View file

@ -28,6 +28,10 @@ edge * r3_edge_create(char * pattern, int pattern_len, node * child) {
e->pattern = pattern;
e->pattern_len = pattern_len;
e->child = child;
// default stats
e->hits = 0;
e->score = 0;
return e;
}