htdig: File names patch for htsearch


Sylvain Wallez (s.wallez.alcatel@e-mail.com)
Wed, 01 Apr 1998 14:33:08 +0200


Hi, htdig lovers !

Some of you asked me to send the patch to display the file name instead
of "[No title]" for text files. So, here it is (for htdig 3.0.8b2) !
In file htsearch/Display.cc, the beginning of method
Display::displayMatch (line 150) should be changed as follows :

void
Display::displayMatch(ResultMatch *match)
{
    String *str;
        
    DocumentRef *ref = match->getRef();

    if (needExcerpt)
    {
        vars.Add("EXCERPT", excerpt(ref));
    }

// Change - begin
// Old code: vars.Add("URL", new String(match->getURL()));
        char *url = match->getURL();
        vars.Add("URL", new String(url));
// Change - end

    vars.Add("SCORE", new String(form("%d", match->getScore())));
    char *title = ref->DocTitle();
    if (!title || !*title)

// Change - begin
// Old code: title = "[No title]";
// Old code: vars.Add("TITLE", new String(title));
    {
        title = strrchr(url, '/');
        if (title)
        {
            title++; // Skip slash
            str = new String(form("[%s]", title));
        }
        else
            // URL without '/' ??
            str = new String("[No title]");
    }
    else
        str = new String(title);
    vars.Add("TITLE", str);
// Change - end

    vars.Add("STARSRIGHT", generateStars(ref, 1));
    ...

That's all. Now, you will have "[foo_bar.txt]" instead of "[No title]".

By the way, I'm still interested in indexing PDF files. Does somebody
know where I can find a simple PDF parser ? It just has to give the list
of words, so that I can build an external file parser for htdig.

Best regards.

-- 
----------------------------------------------------------------------
Sylvain Wallez                  Software engineer / Intranet Webmaster
Alcatel Espace
Toulouse, France                    mailto:s.wallez.alcatel@e-mail.com
----------------------------------------------------------------------
----------------------------------------------------------------------
To unsubscribe from the htdig mailing list, send a message to
htdig-request@sdsu.edu containing the single word "unsubscribe" in
the body of the message.



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