Results 1 to 4 of 4

Thread: improved serchlog

  1. #1
    tjoerg's Avatar
    tjoerg is offline Active Member
    Join Date
    Jul 2002
    Posts
    189

    Lightbulb improved serchlog

    Hello everyone,

    I did a nice hack for the search.php. Now it is possible to see not only search results which are hits (means that there are some results) but also search querys which are not found:

    search.php:

    insert into line 271 (- 278):

    // insert keyword to searchlog table
    if($record_log) {
    $date = date("Y-m-d <b>H</b>:i:s");
    $ip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
    $query = "insert into idx_searchlog (keyword,time,ip,result) values ('$keyword','$date','$ip','$num_links')";
    $result = $conn->Execute($query);
    }


    Please also note that there is a upper case "H". This is to get a correct search order. I posted this as bug report some month ago but I guess dody forgot about that!

    greets

    Joerg

  2. #2
    esm's Avatar
    esm
    esm is offline Active Member
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    could you expand a little bit on what this does/how it would be used?

    Here is what my search.php looks like at line 271

    265. if($num_categories==0 && $num_links==0) {
    266. $error_msg = $msg["10025"];
    267. $keyword = $keyword_org;
    268. DisplayTemplate($theme_path."search_error.html","\ $error_msg,\$keyword");
    269. DisplayTemplate($theme_path."footer.html","\$cat") ;
    270.
    271. exit();

    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  3. #3
    tjoerg's Avatar
    tjoerg is offline Active Member
    Join Date
    Jul 2002
    Posts
    189

    Default

    Sure,

    currently the search.php does only write data into the db when there are some search results. I added a piece of code (from somewhere below 380) again before the exit(); Thus the script also writes the search query even if there is no keyword found (hits=0).
    For me it's very usefull caus I see what people are looking for. On this I can do my categories, layout, etc.

    The upper case "H" sorts the search log in the right way. If you look into your logfiles you see that what further than 12:00:00 doesn't show up on top. With the "H" the script makes a 24 hours log so that it goes on with 13:00:00 => 24:00:00

    greets

    Joerg
    --------- applying hacks require a knack ---------

  4. #4
    dody is offline Administrator
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,731

    Default

    [query]Please also note that there is a upper case "H". This is to get a correct search order. I posted this as bug report some month ago but I guess dody forgot about that![/query] Sorry I didn't notice that earlier. But not at all, I read users feedback from this forum and write back to my todo list.

    Joerg your code is fix database query for search log. It would be a nice addition if you hack search log. Let me know if you have any problem.

    esm, that codes will intercept if there's no link and category found. Then will cause indexu displaying no link can category found. The text that will be displayed is in msg.php, $msg["10025"];
    www.nicecoder.com
    www.dodyrw.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •