comparison libtests/test_utils_lib.h @ 672:a35ca2d5f238

Extend results structure to include a key for the query. Fill that key from the query datum, if given, defaulting to ""; patch up bindings and tests. This is so that (Instance x Instance) operations such as querying and sampling can be supported.
author mas01cr
date Fri, 05 Mar 2010 16:00:53 +0000
parents e18843dc0aea
children
comparison
equal deleted inserted replaced
671:537bfd7e15a1 672:a35ca2d5f238
29 29
30 int result_position(adb_query_results_t *r, const char *key, float dist, uint32_t qpos, uint32_t ipos) { 30 int result_position(adb_query_results_t *r, const char *key, float dist, uint32_t qpos, uint32_t ipos) {
31 for(uint32_t k = 0; k < r->nresults; k++) { 31 for(uint32_t k = 0; k < r->nresults; k++) {
32 adb_result_t result = r->results[k]; 32 adb_result_t result = r->results[k];
33 if(close_enough(dist, result.dist, 1e-4) && (qpos == result.qpos) && 33 if(close_enough(dist, result.dist, 1e-4) && (qpos == result.qpos) &&
34 (ipos == result.ipos) && !(strcmp(key, result.key))) { 34 (ipos == result.ipos) && !(strcmp(key, result.ikey))) {
35 return k; 35 return k;
36 } 36 }
37 } 37 }
38 return -1; 38 return -1;
39 } 39 }