According to Gabriele Bartolini:
> I suggest you this patch again, as Geoff told me some days ago.
> 
> With this patch when I set "use_meta_description" to true, htsearch shows
> the description (if found). Else, it uses the top of the document if
> "excerpt_show_top" is on. Else (again), i tries to search the 1st
> occurrence of the word inside the document and acts as default.
> 
> Give it a look. I'm sure it works fine (cos that's what is currently
> running on my site) ...
> 
> Ciao to all my dear diggers
> Gabriele

Well, if we're putting it to a Geoff-style vote, I'll give it

+1

My intial concern was the same as Geoff's - that this would prevent
highlighting of matched words.  I see now that it doesn't, but rather
it just makes sure the meta description is always shown right from
the beginning, rather than part-way in.  Works for me.  I also like
the fact that you don't call ref->DocHead() if you're going to use
ref->DocMetaDsc().  That operation used to be just a pointer assignment,
but now it may involve decompression of the DocHead, and eventually may
involve fetching it from a separate database record.

> Here is the patch generated by diff:
> 
> --- Display.cc.old    Fri Mar 26 17:27:34 1999
> +++ Display.cc        Fri Mar 26 17:38:17 1999
> @@ -957,12 +957,19 @@ Display::excerpt(DocumentRef *ref, Strin
>  {
>      // It is necessary to keep alive the String you .get() a char * from,
>      // as long as you use the char *.
> +
>      String head_string;
> +    char     *head;
> +    int              use_meta_description=0;
>  
> -    char     *head = ref->DocHead();
>      if (config.Boolean("use_meta_description",0) 
>       && strlen(ref->DocMetaDsc()) != 0)
> -     head = ref->DocMetaDsc();
> +    {
> +             // Set the head to point to description
> +             head = ref->DocMetaDsc();
> +             use_meta_description=1;
> +    }
> +    else head = ref->DocHead(); // head points to the top
>  
>      head_string = HtSGMLCodec::instance()->decode(head);
>  
> @@ -973,10 +980,18 @@ Display::excerpt(DocumentRef *ref, Strin
>      String   part;
>      String   *text = new String();
>  
> -    first = allWordsPattern->FindFirstWord(head, which, length);
>  
> -    if (config.Boolean("excerpt_show_top", 0))
> +    // htsearch displays the description when:
> +    // 1) a description has been found
> +    // 2) the option "use_meta_description" is set to true
> +
> +    // If previous conditions are false and "excerpt_show_top" is set to true
> +    // it shows the whole head. Else, it acts as default.
> +
> +    if (config.Boolean("excerpt_show_top", 0) || use_meta_description ) 
>       first = 0;
> +    else
> +        first = allWordsPattern->FindFirstWord(head, which, length);
>  
>      if (first < 0 && config.Boolean("no_excerpt_show_top"))
>        first = 0;  // No excerpt, but we want to show the top.
> 


-- 
Gilles R. Detillieux              E-mail: <[EMAIL PROTECTED]>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930
------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
[EMAIL PROTECTED] containing the single word "unsubscribe" in
the SUBJECT of the message.

Reply via email to