Forum Moderators: coopster

Message Too Old, No Replies

First time search engine

How the heck to a make a keyword search engine? using php and mysql

         

bono667

9:06 am on Jul 20, 2003 (gmt 0)

10+ Year Member



Hi,

Im on to my latest project,,,,learning how to make a search engine type thing. I want to be able to search through multiple fields, eg 'title' & 'description' for keywords that a user types in,, much like google or something. I dont really have a clue how to do this so if anyone wants to help id be glad of some comments.

hakre

9:23 am on Jul 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi bono667, welcome to webmasterworld [webmasterworld.com].

just a question: are you using a mysql database for this and you're looking for a sql query string to search the fields?

bono667

9:58 am on Jul 20, 2003 (gmt 0)

10+ Year Member



yeah im using a mysql database for this with php... Just wondered if it was easier than i imagine it is,,

hakre

10:12 am on Jul 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



use the like keyword in your sql query and combine these multiple fields with OR.

here is a related thread on another forum [forums.devshed.com] about this where i found this peace of code:

SELECT product_id FROM products 
WHERE (product_name LIKE "%some%" OR product_description LIKE "%some%")
AND (product_name LIKE"%product%" OR product_description LIKE "%product%");

-hakre

killroy

10:47 am on Jul 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've just build a search engine that searches full text with relevancy ranking and proximity ranking. If you'Re interested in the algo'S and sql queries and table structures sticky me. I can enable the ranking display in my test version so you can compare how it ranks words for importance and relevance.

SN

henry0

11:30 am on Jul 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Mine allows you to enter your own keywords per page or segment and rank them
then the query results in order of ranking
and point to the title of a section
the last part is not done yet although quite simple
instead of pointing to a section I will make the result linking to the section

it is contained in only a few code pages, if you want it stick mail me

Be advised that you will either need to change you table structure to fit for any search engine or rebuilt it to fit your table structure

bono667

11:57 am on Jul 20, 2003 (gmt 0)

10+ Year Member



thanks hakre,

ill probably need to split up the user entered data as well wont i? say if some one writes

web designer

in the keywords field ill have to split it into "'web' or 'designer'" ,, or "'web' and 'designer'" depending on what the user asks for in a drop down box.

I havnt started building this yet this is just research at the mo,, better to get it all out first i think,, then ask questions on porblems i have with it later..

bono667

7:11 pm on Jul 22, 2003 (gmt 0)

10+ Year Member



how do i split the keywords up in my search field?

oilman

7:15 pm on Jul 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It might be worth while to look at the search engine section at Hotscripts [hotscripts.com]. You might find something that works for you are maybe something that you could pull apart to see how they do certain functions.

bono667

2:28 pm on Jul 23, 2003 (gmt 0)

10+ Year Member



ok,, so i know how to split ,,, explode() the test field up. So now i have an array that i want to use to test against my database.

select * from products where product name like all or any of those words in that list..

does ne1 have a clue?