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

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.



>>>>

Did you know Prato is Roberto Benigni's hometown?
Well ... now you know it ...
Oopps ... That's just where I come from. :-))
Thanks Roberto !!!

<<<<

-------------------------------------------------

Gabriele Bartolini
U.O. Rete Civica - Comune di Prato
Prato - Italia - Europa

e-mail: [EMAIL PROTECTED]
http://www.po-net.prato.it

-------------------------------------------------
------------------------------------
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