Re: htdig... splitting up htsearch...


Gerald Kropitz (gkropitz@Austria.EU.net)
Mon, 17 Nov 1997 19:15:31 +0100


> > first: your program is great!
> >
> > second: how about splitting the htsearch-component in two parts...
> >
> > - a database-server part which returns the matched results
> > - a web-server part for handling the in/output
> >
> > so that i can run htdig in a distributed environment with dedicated
> > database and web servers...
> >
> > -gerald
>
> Great idea, but a lot of work.... :-(

i looked over the source... it seems there is a good encapsulation...

"ResultList *htsearch(char *, List &, Parser *)" is the (only?) function which
need to run on the database-server side...

RPC?

> Actually, I was thinking of rewriting ht://Dig to use an external database
> engine like Oracle or MySQL. I guess that would kinda solve your problem,
> right?

yep, i recommend MySQL... we use it for many perl/web-databases here...
very good performance and nearly all sql statments are available...

-gerald

PS: i missed the function to display the results ordered by percent...
    attached is a the small patch for it...

--- Display.cc Fri Feb 7 10:25:17 1997
+++ Display.cc.orig Mon Nov 17 19:12:03 1997
@@ -160,6 +160,7 @@
     vars.Add("TITLE", new String(title));
     vars.Add("STARSRIGHT", generateStars(ref, 1));
     vars.Add("STARSLEFT", generateStars(ref, 0));
+ vars.Add("PERCENT", generatePercent(ref));
     vars.Add("SIZE", new String(form("%d", ref->DocSize())));
     vars.Add("SIZEK", new String(form("%d",
                                           (ref->DocSize() + 1023) / 1024)));
@@ -508,6 +509,29 @@
 }
 
 //*****************************************************************************
+
+String *
+Display::generatePercent(DocumentRef *ref)
+{
+ int percent;
+ String *result = new String();
+
+ if (maxScore != 0)
+ {
+ percent = ref->DocScore() / ((double)maxScore / 100);
+ }
+ else
+ {
+ maxScore = ref->DocScore();
+ percent = 100;
+ }
+
+ *result << form("%d",percent) << "\n";
+ return result;
+}
+
+//*****************************************************************************
+
 String *
 Display::readFile(char *filename)
 {
--- Display.h Fri Feb 7 10:25:23 1997
+++ Display.h.orig Mon Nov 17 19:12:09 1997
@@ -141,6 +141,7 @@
     char *hilight(char *, char *);
     void setupImages();
     String *generateStars(DocumentRef *, int);
+ String *generatePercent(DocumentRef *);
     void displayParsedFile(char *);
     void setVariables(int, List *);
     void createURL(String &, int);



This archive was generated by hypermail 2.0b3 on Sat Jan 02 1999 - 16:25:12 PST