Date: 10/12/00
- Next message: Paolo.Brutti <email protected>: "[PHP-DEV] PHP 4.0 Bug #7153: Failed static linking with Apache"
- Previous message: Stanislav Malyshev: "Re: [PHP-DEV] Big numbers"
- In reply to: Andi Gutmans: "Re: [PHP-DEV] Rasmus"
- Next in thread: Alexander Barkov: "[PHP-DEV] UdmSearch"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello!
I'm learning a possibility to add UdmSearch extension into PHP.
Please find udmsearch.c in attach. This program demonstrates
typical UdmSearch session.
Could anybody give a suggestions on how to make PHP interface.
It is almost clean for me how to implement stages 0,1,2,4, and 6.
I need interface tips for stages 3 and 5 where one need to have a deal
with structures members.
Any ideas?
Thanks!
P.S.
It would be also great if somebody can give general plan
on how to implement this all.
P.P.S.
BTW. Where I can find Rasmus?
-- Alexander Barkov IZHCOM, Izhevsk email: bar <email protected> | http://www.izhcom.ru Phone: +7 (3412) 51-32-11 | Fax: +7 (3412) 51-20-80 ICQ: 7748759
#include <stdio.h> #include "udmsearch.h"
int main(){ UDM_ENV * Env; UDM_AGENT * Agent; UDM_DOCUMENT * Doc;
/* Stage 0: initialize library*/ UdmInit();
/* Stage 1: Initialize session */ Env=UdmAllocEnv(); Agent=UdmAllocAgent(Env,0,0);
/* Stage 2: Set up database parameters */ UdmEnvSetDBAddr(Env,"mysql://foo:bar <email protected>/bar/"); UdmEnvSetDBMode(Env,"single");
/* Stage 3: Choose search parameters */ Agent->search_mode=UDM_MODE_ANY; /* Query type: all words,any word, boolean seacrh */ Agent->page_number=0; /* Which page to display */ Agent->page_size=50; /* Number of docs per page */ Agent->charset=UDM_CHARSET_KOI8R; /* Choose charset */ Agent->group_mask=0xffffffff;
/* Stage 4: Do query */ Doc=UdmFind(Agent,"apache web server");
/* Stage 5: Display results */ printf("Word information: %s\n",Agent->wordinfo);/* Display word info */
if(Doc){ printf("%d documents found\n",Agent->total_found); while(Doc->url_id){ printf(" URL : %s\n",Doc->url); printf(" Title : %s\n",Doc->title); printf(" Content-Type: %s\n",Doc->content_type); printf(" Size : %d\n",Doc->size); printf(" Score : %d\n",Doc->rating); printf(" Last-Modified : %d\n",(int)Doc->last_mod_time); printf("---------------\n"); Doc++; } }else{ int DBError; if((DBError=UdmDBErrorCode(Agent->db))){ printf("Error #%d(%s)\n",UdmDBErrorCode(Agent->db), UdmDBErrorMsg(Agent->db)); }else{ printf("Sorry, nothing was found\n"); } }
/* Stage 6: Deinitialize session */ UdmFreeAgent(Agent); UdmFreeEnv(Env); return(0); }
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Paolo.Brutti <email protected>: "[PHP-DEV] PHP 4.0 Bug #7153: Failed static linking with Apache"
- Previous message: Stanislav Malyshev: "Re: [PHP-DEV] Big numbers"
- In reply to: Andi Gutmans: "Re: [PHP-DEV] Rasmus"
- Next in thread: Alexander Barkov: "[PHP-DEV] UdmSearch"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

