#76
  1. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: I don't understand this script at all


    Actually, this is one of the clearest tutorials I've found. Try reading the comments he put inside of the code.
  2. #77
  3. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: a simpler search engine - for those who like it the easy way


    dgssearch is absolutely fabulous. I also highly recommend it.
  4. #78
  5. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Here is an idea


    Okay, search the word table with a comma delimited field containing all the article ID's.
    As you loop through the results using mysql_fetch_array ()
    you would doi something like::

    while ($row = mysql_fetch_array ($result) {
    $row = explode (",", $row['arrayfield']);
    $array = array_merge ($array, $row);
    }

    Then reset ($array) and then you would loop through this::

    while (list ($key, $val) = each ($array)) {
    $array2[$val] ++;
    }

    then sort this array by the values and then you have a relevancy test :)

    Just make sure, for articles with multiple instances of a word, that you put multiple instances of the qid.
    i hope that works, as i just thghout of it in my head then and thought i would post it :) i havent tested it but it seems like it would work :)
  6. #79
  7. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)
    I had the same problem recently but i've got the solution, try this one :
    - uninstall mysql,mysql-server nad mysql- devel

    - try to install it again

    - edit file /etc/my.cnf
    [client]
    socket = /tmp/mysql.sock (to change /var/lib/mysql)

    [mysqld]
    socket = /tmp/mysql.sock
    user = root
    port = 3306

    - safe my.cnf
    - type : mysql_install_db
    - chmod 700 /etc/var/lib/mysql/mysql (this is where your database files placed by mysql)

    - type safe_mysqld &

    - type mysql -u root -p password 'newpass'

    - if you get the message then 'access denied for root@localhost' then read the mysql manual about how to add new user (including root) and how to give them privileges

    - by the way you still be able to access mysql without using user or password just type 'mysql'

    - hope this can get rid off your problem..

    - if this way failed just keep trying, don't give up ...just like i did
  8. #80
  9. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Word Relevance.


    There is still the problem of word relevance with the search engine though. One of the major features of a search engine is taking the keywords and finding the number of occurrences of the keywords in the database record compared to how long the record is. I still can think of any way to make this efficiently possible though.
  10. #81
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Location
    North Carolina
    Posts
    187
    Rep Power
    19

    Highlighting Words Returned


    Firstly I think your' code is great!

    I was wondering if anybody knows how to highlight the word searched for in the paragraph returned?

    For example, if I searched for 'php' and the following textblob was returned as a result from the database then I would like 'php' to be highlighted in red:

    "for years now people have choosen <red font tag!>php</end red font!> as their number one database language"

    If you do not know the code, but know of an article/tutorial that would point me in the right direction then I would appreciate if you could post the url here!

    Thanks a million
  12. #82
  13. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Advanced Search Engine/Spider


    Hiya,

    I work for the Univeristy of Minnesota as a web aplications dork. Our programming group has been developing some cool things including one of the most extensible content management systems i have ever ran acrossed. Man i love XML...
    <BR>
    One of the code snippets that he developed is a search engine spider combo. The search engine makes use of mySQL's Match...Against() functions,which allow fulltext key searches for lightning fast searches of massive databases. phpMyAdmin isn't the most friendly when it comes to making FULLTEXT Indexes, but with a little research it is not hard at all.

    The engine uses mysql's default relevanc stuff, but also keeps track of "clicks" on results and gives those a slightly higher relevacny. Super awesome...
    A quick writeup is located at: http://artattack.to/wwwboard.php?msg_id=2825

    I currently use the search on my art gallery website. Source code located at: http://artattack.to/source.php?code=search.php

    It is ment to be used with the spider that my boss wrote, but i am currently working on the spider at the moment and therefor do not have any code to post.

    Hope this helps some people out. It is a really nice engine. In the future i plan to add the boolean searches, as well as soundex() and similar spelling support to "suggest" results.


    Oh, and feel free to poke around on the art site, every page is open sourced like at php.net, so please tell me how i can improve my slop *** code.

    thanks and goodluck
    --
    BLaine Garrett
    WEb Master of the Art attack...

    http://artattack.to/?zombie
  14. #83
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    NY-USA
    Posts
    2
    Rep Power
    0

    Re: I don't understand this script at all


    I am having a problem right out of the gate with the filter of word script error:

    "Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/newflash/public_html/test/php54_search_db/index1.php on line 8"

    I think I know what these guys mean with they don't under stand this tutorial.

    I don't see where he shows us prepair this script for conecting to our database. Where is the finished sample of these scipts contecting to a database?

    Please help because I think I prep my script right but I could be wrong.
  16. #84
  17. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    NY-USA
    Posts
    2
    Rep Power
    0

    Re: I don't understand this script at all


    I am having a problem right out of the gate with the filter of word script error:

    "Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/newflash/public_html/test/php54_search_db/index1.php on line 8"

    I think I know what these guys mean when they say they don't under stand this tutorial.

    I don't see where he shows us how to prepair the script for connecting to our database. Where is the finished sample of these scipts contecting to a database?

    Please help because I think I prep my script right but I could be wrong.
  18. #85
  19. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: I don't understand this script at all


    am3 - *shrug* Try putting in your connect prepare yourself. The tutorial is a guide, not a pre-prepared program.
  20. #86
  21. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    OKC, OK USA
    Posts
    2
    Rep Power
    0

    Re: Highlighting Words Returned


    I use eregi_replace for this. Here is the function I use::
    ($found would be the blob of text, and $keyword would the word to highlight)

    function bold($found,$keyword){
    if ($keyword) {
    $replace="<span class=\"keyword\">$keyword</span>";
    $bold=eregi_replace($keyword,$replace,$found);
    return $bold;
    }
    }
  22. #87
  23. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Great Script!


    Thanks so much for this script. It saved me DAYS of development time.

    I had to replace three lines to get it to work with PHP 4.2.3

    You must escape the ? ( and . characters:

    $querywords = ereg_replace("\?","",$querywords);
    $querywords = ereg_replace("\(","",$querywords);
    $querywords = ereg_replace("\.","",$querywords);
  24. #88
  25. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    preventing repeated entries


    If you run the script that inserts keywords into the search_table more than once, it'll have double entries.

    So before Inserting the words into search_table, I run this:

    //delete old entries
    $deleteword = "DELETE FROM search_table where qid=$qid";
    mysql_query($deleteword);

    I don't know if it's the most efficient, but when you update/edit an article, you can delete and insert, rather than update the search_table.
  26. #89
  27. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Get stuck at beginning


    On the very first page of this article I get stuck. When I tried to execute the first script on my server (modified to my preferences of course). I just get "Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /usr/home201/k/y/kyocorp/public_html/searchengine/grab_sticky.php on line 5"
  28. #90
  29. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    searching more than one table


    Hi i read your article and it sounds great ro me cuz i was looking for a search engine scripts. But I don't know how this will work for more than one table? or can it?

IMN logo majestic logo threadwatch logo seochat tools logo