steinm          Tue Mar 20 23:58:20 2001 EDT

  Modified files:              
    /php4/ext/hyperwave hg_comm.c 
  Log:
  - fulltext query are working now
  
  
Index: php4/ext/hyperwave/hg_comm.c
diff -u php4/ext/hyperwave/hg_comm.c:1.40 php4/ext/hyperwave/hg_comm.c:1.41
--- php4/ext/hyperwave/hg_comm.c:1.40   Fri Mar 16 09:40:37 2001
+++ php4/ext/hyperwave/hg_comm.c        Tue Mar 20 23:58:20 2001
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: hg_comm.c,v 1.40 2001/03/16 17:40:37 steinm Exp $ */
+/* $Id: hg_comm.c,v 1.41 2001/03/21 07:58:20 steinm Exp $ */
 
 /* #define HW_DEBUG */
 
@@ -4392,6 +4392,9 @@
                return -1;
        }
        if(*ptr++ == 0) {
+               char *cptr, tmp[20];
+               float weight;
+               int j;
                *count = (*ptr < maxhits) ? *ptr : maxhits;
                ptr++;
                if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
@@ -4399,8 +4402,18 @@
                        if(NULL != (*weights = emalloc(*count * sizeof(float)))) {
                                ptr2 = *weights;
                                for(i=0; i<*count; i++) {
-                                       ptr1[i] = *ptr++;
-                                       ptr2[i] = (float) *ptr++;
+                                       ptr1[i] = *ptr++; /* Object id */
+                                       cptr = (char *) ptr;
+                                       j = 0;
+                                       while(*cptr != ' ') {
+                                               tmp[j++] = *cptr++;
+                                       }
+                                       cptr++; /* Skip space after weight */
+                                       tmp[j] = '\0';
+                                       sscanf(tmp, "%f", &weight);
+                                       ptr2[i] = weight;
+                                       ptr = (int *) cptr;
+                                       ptr++; /* Skip 0-Integer after weight string */
                                }
                                efree(retmsg->buf);
                                efree(retmsg);
@@ -4464,6 +4477,9 @@
                return -4;
        }
        if(*ptr++ == 0) {
+               char *cptr, tmp[20];
+               float weight;
+               int j;
                *count = (*ptr < maxhits) ? *ptr : maxhits;
                ptr++;
                if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
@@ -4471,8 +4487,18 @@
                        if(NULL != (*weights = emalloc(*count * sizeof(float)))) {
                                ptr2 = *weights;
                                for(i=0; i<*count; i++) {
-                                       ptr1[i] = *ptr++;
-                                       ptr2[i] = (float) *ptr++;
+                                       ptr1[i] = *ptr++; /* Object id */
+                                       cptr = (char *) ptr;
+                                       j = 0;
+                                       while(*cptr != ' ') {
+                                               tmp[j++] = *cptr++;
+                                       }
+                                       cptr++; /* Skip space after weight */
+                                       tmp[j] = '\0';
+                                       sscanf(tmp, "%f", &weight);
+                                       ptr2[i] = weight;
+                                       ptr = (int *) cptr;
+                                       ptr++; /* Skip 0-Integer after weight string */
                                }
                                efree(retmsg->buf);
                                efree(retmsg);
@@ -4600,6 +4626,9 @@
                return -1;
        }
        if(*ptr++ == 0) {
+               char *cptr, tmp[20];
+               float weight;
+               int j;
                *count = (*ptr < maxhits) ? *ptr : maxhits;
                ptr++;
                if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
@@ -4607,8 +4636,18 @@
                        if(NULL != (*weights = emalloc(*count * sizeof(float)))) {
                                ptr2 = *weights;
                                for(i=0; i<*count; i++) {
-                                       ptr1[i] = *ptr++;
-                                       ptr2[i] = (float) *ptr++;
+                                       ptr1[i] = *ptr++; /* Object id */
+                                       cptr = (char *) ptr;
+                                       j = 0;
+                                       while(*cptr != ' ') {
+                                               tmp[j++] = *cptr++;
+                                       }
+                                       cptr++; /* Skip space after weight */
+                                       tmp[j] = '\0';
+                                       sscanf(tmp, "%f", &weight);
+                                       ptr2[i] = weight;
+                                       ptr = (int *) cptr;
+                                       ptr++; /* Skip 0-Integer after weight string */
                                }
                        } else {
                                efree(*childIDs);
@@ -4673,6 +4712,9 @@
                return -1;
        }
        if(*ptr++ == 0) {
+               char *cptr, tmp[20];
+               float weight;
+               int j;
                *count = (*ptr < maxhits) ? *ptr : maxhits;
                ptr++;
                if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
@@ -4680,8 +4722,18 @@
                        if(NULL != (*weights = emalloc(*count * sizeof(float)))) {
                                ptr2 = *weights;
                                for(i=0; i<*count; i++) {
-                                       ptr1[i] = *ptr++;
-                                       ptr2[i] = (float) *ptr++;
+                                       ptr1[i] = *ptr++; /* Object id */
+                                       cptr = (char *) ptr;
+                                       j = 0;
+                                       while(*cptr != ' ') {
+                                               tmp[j++] = *cptr++;
+                                       }
+                                       cptr++; /* Skip space after weight */
+                                       tmp[j] = '\0';
+                                       sscanf(tmp, "%f", &weight);
+                                       ptr2[i] = weight;
+                                       ptr = (int *) cptr;
+                                       ptr++; /* Skip 0-Integer after weight string */
                                }
                                efree(retmsg->buf);
                                efree(retmsg);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to