-
efficient searchs
From
Ragnarok@VERT/DOCKSUD to
DOVE-Net.Sync_JavaScript on Fri Nov 25 17:29:00 2005
hi !ãi begin to play with jsãi try to search in message base, but search one to one is poor performanceãdo you have another code that search in the base with more speed?ãmaybe some method more optimized?ãa global menssage base index?ãa gift from google? :)ããfor (grp in msg_area.grp_list) { ã for (sub in msg_area.grp_list[grp].sub_list) { ã msg = new MsgBase(msg_area.grp_list[grp].sub_list[sub].code); ã if (msg.open()) { ã for (i=0;i< msg.total_msgs;i++) { ã mensaje = msg.get_msg_header(true,i); ã if (mensaje != null) { ã if (mensaje.subject.indexOf("hola") >= 0) { ã writeln(mensaje.from); ã writeln("<br />"); ã writeln(mensaje.subject); ã writeln("<br />"); ã } ã } ã else ã writeln ("error getting message"); ã } ã msg.close(); ã } ã else { ã writeln ("Error al abrir la base de mensajes: " +ãmsg_base.grp_list[grp].ã } ã } ã}ãã---ã þ Synchronet þ Dock Sud BBS TLD 24 HS - www.docksud.com.arã
-
From
Digital Man@VERT to
Ragnarok on Sun Nov 27 01:19:13 2005
Re: efficient searchsã By: Ragnarok to DOVE-Net.Sync_JavaScript on Fri Nov 25 2005 05:29 pmãã > hi !ã > i begin to play with jsã > i try to search in message base, but search one to one is poor performanceã > do you have another code that search in the base with more speed?ã > maybe some method more optimized?ã > a global menssage base index?ã > a gift from google? :)ã > ã > for (grp in msg_area.grp_list) {ã > for (sub in msg_area.grp_list[grp].sub_list) {ã > msg = new MsgBase(msg_area.grp_list[grp].sub_list[sub].code);ã > if (msg.open()) {ã > for (i=0;i< msg.total_msgs;i++) {ã > mensaje = msg.get_msg_header(true,i);ã > if (mensaje != null) {ã > if (mensaje.subject.indexOf("hola") >= 0) {ã > writeln(mensaje.from);ã > writeln("<br />");ã > writeln(mensaje.subject);ã > writeln("<br />");ã > }ã > }ã > elseã > writeln ("error getting message");ã > }ã > msg.close();ã > }ã > else {ã > writeln ("Error al abrir la base de mensajes: " +ã > msg_base.grp_list[grp].ã > }ã > }ã > }ããYour script seems to just search the message subjects. This is slow?ãã digital manããSnapple "Real Fact" #176:ãThe first bike was called a hobbyhorse. ã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
-
From
Ragnarok@VERT/DOCKSUD to
Digital Man on Sun Nov 27 19:55:00 2005
Digital Man wrote:ãã> Re: efficient searchsã> By: Ragnarok to DOVE-Net.Sync_JavaScript on Fri Nov 25 2005 05:29 pmã> ã> > msg.close();ã> > }ã> > else {ã> > writeln ("Error al abrir la base de mensajes: " +ã> > msg_base.grp_list[grp].ã> > }ã> > }ã> > }ã> ã> Your script seems to just search the message subjects. This is slow?ã> ã> digital manãmy idea is search in to body of messages too(in future), to put it into aãweb page, but i think to this will be more slowãi can export the msgbase in timed events to mysql engine or make a cgi inãc++ usign the msgbase api, but i dont know. i searching for ideas =?ãã---ã þ Synchronet þ Dock Sud BBS TLD 24 HS - www.docksud.com.arã
-
From
Digital Man@VERT to
Ragnarok on Sun Nov 27 15:19:14 2005
Re: Re: efficient searchsã By: Ragnarok to Digital Man on Sun Nov 27 2005 07:55 pmãã > Digital Man wrote:ã > ã > > Re: efficient searchsã > > By: Ragnarok to DOVE-Net.Sync_JavaScript on Fri Nov 25 2005 05:29 pmã > >ã > > > msg.close();ã > > > }ã > > > else {ã > > > writeln ("Error al abrir la base de mensajes: " +ã > > > msg_base.grp_list[grp].ã > > > }ã > > > }ã > > > }ã > >ã > > Your script seems to just search the message subjects. This is slow?ã > >ã > > digital manã > my idea is search in to body of messages too(in future), to put it into aã > web page, but i think to this will be more slowã > i can export the msgbase in timed events to mysql engine or make a cgi inã > c++ usign the msgbase api, but i dont know. i searching for ideas =?ããI don't think any of that will be necessary.ããHere's a variation on your script:ãã// search.jsã// usage: jsexec search.js <msgbase_code> <search_string>ããvar msgbase_code = argv[0];ãvar search_string = argv[1];ãvar msgbase = new MsgBase(msgbase_code);ãif(!msgbase.open()) {ã alert("Error " + msgbase.error + " opening msgbase: " + msgbase_code);ã exit();ã}ããvar total_msgs = msgbase.total_msgs;ãfor(var i=0; i<total_msgs; i++) {ã var hdr = msgbase.get_msg_header(true,i);ã if(hdr.subject.indexOf(search_string)>=0)ã print(hdr.subject);ã}ãprint("Searched " + total_msgs + " messages.");ãmsgbase.close();ããRun with jsexec on a a message base with 5000+ messages:ããSearched 5007 messages.ãs:\sbbs\exec\search.js executed in 14.34 secondsããThat's about 350 message headers a second. Is that considered slow?ãã digital manããSnapple "Real Fact" #5:ãCamels have 3 eyelids.ã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã