Node score should be a int32_t.

This commit is contained in:
Kishore Nallan 2017-09-21 19:40:41 +05:30
parent b2f0ca495d
commit e24e0fae5d
4 changed files with 9 additions and 9 deletions

View File

@ -60,12 +60,12 @@
- ~~json::parse must be wrapped in try catch~~
- ~~Collection Manager collections map should store plain collection name~~
- ~~init_collection of Collection manager should probably take seq_id as param~~
- node score should be int32, no longer uint16 like in document struct
- ~~node score should be int32, no longer uint16 like in document struct~~
- Typo in prefix search
- Proper logging
- https support
- Validate before string to int conversion in the http api layer
- When field of "id" but not string, what happens?
- Typo in prefix search
- test for num_documents
- test for string filter comparison: title < "foo"
- test for token ranking on float field

View File

@ -44,7 +44,7 @@ typedef struct {
uint8_t num_children;
uint8_t partial_len;
unsigned char partial[MAX_PREFIX_LEN];
uint32_t max_score;
int32_t max_score;
uint32_t max_token_count;
} art_node;
@ -98,7 +98,7 @@ typedef struct {
* `offsets` refer to the index locations where a token appeared in the document
*/
typedef struct {
uint16_t score;
int32_t score;
uint32_t id;
uint32_t offsets_len;
uint32_t* offsets;
@ -110,7 +110,7 @@ typedef struct {
*/
typedef struct {
art_values* values;
uint32_t max_score;
int32_t max_score;
uint32_t key_len;
unsigned char key[];
} art_leaf;

View File

@ -67,7 +67,7 @@ bool compare_art_node_frequency(const art_node *a, const art_node *b) {
}
bool compare_art_node_score(const art_node* a, const art_node* b) {
uint32_t a_value = 0, b_value = 0;
int32_t a_value = 0, b_value = 0;
if(IS_LEAF(a)) {
art_leaf* al = (art_leaf *) LEAF_RAW(a);
@ -542,7 +542,7 @@ static void add_child4(art_node4 *n, art_node **ref, unsigned char c, void *chil
memmove(n->children+idx+1, n->children+idx,
(n->n.num_children - idx)*sizeof(void*));
uint16_t child_max_score = IS_LEAF(child) ? ((art_leaf *) LEAF_RAW(child))->max_score : ((art_node *) child)->max_score;
int32_t child_max_score = IS_LEAF(child) ? ((art_leaf *) LEAF_RAW(child))->max_score : ((art_node *) child)->max_score;
uint32_t child_token_count = IS_LEAF(child) ? ((art_leaf *) LEAF_RAW(child))->values->ids.getLength() : ((art_node *) child)->max_token_count;
n->n.max_score = MAX(n->n.max_score, child_max_score);
@ -648,7 +648,7 @@ static void* recursive_insert(art_node *n, art_node **ref, const unsigned char *
return NULL;
}
n->max_score = (uint16_t) MAX(n->max_score, (const uint16_t &) document->score);
n->max_score = MAX(n->max_score, document->score);
n->max_token_count = MAX(n->max_token_count, num_hits);
// Check if given node has a prefix

View File

@ -11,7 +11,7 @@
art_document get_document(uint32_t id) {
art_document document;
document.score = (uint16_t) id;
document.score = id;
document.id = id;
document.offsets = new uint32_t[1]{0};
document.offsets_len = 1;