Page 1 of 1
Searching Engine
Posted: Mon Jun 21, 2004 4:39 pm
by artfhc
I am wondering if someone can explain to me how searching engine works in php. DO I have to put every single information into my database, since I used mysql, so it would be easier for me to make one? I am sure that there should be some smarter and more advance way to do so. Thankyou!!!

Posted: Mon Jun 21, 2004 4:47 pm
by markl999
Well, it really depends on what you're searching for exactly and what you're searching on.
The 2 common types of search are:
1) SELECT * FROM foo WHERE something LIKE '%somesearchterm%';
2) Use MySQL's
FULLTEXT search
Posted: Mon Jun 21, 2004 7:05 pm
by artfhc
so the only way to search things is to save every imformation in the database, then use the utility of mysql or other database language to search it, right? I am actually hoping if there are some other way whether than using all database. I don't understand the fact that yahoo and google can search things freely without saving everything in database. I want to know how they work.
Posted: Mon Jun 21, 2004 7:10 pm
by McGruff
Dynamic pages will (usually) have content stored in a db for which you obviously have to do a db search.
If you also have a lot of static pages, you can use php file fns & regex to look for search terms in the html files.
Posted: Mon Jun 21, 2004 8:33 pm
by Yonderknight
Can't you use a database to store the names of all your files, then use PHP to open the files and look using a string search?
Posted: Mon Jun 21, 2004 9:10 pm
by McGruff
I don't think there's a need to store filenames in the db: the filesystem IS the db.
Some kind of recursive tree iterator might be used to hunt through folders & sub-folders, starting at the web root. You may want to exclude some folders from the search.
Posted: Mon Jun 21, 2004 9:48 pm
by d3ad1ysp0rk
artfhc wrote:so the only way to search things is to save every imformation in the database, then use the utility of mysql or other database language to search it, right? I am actually hoping if there are some other way whether than using all database. I don't understand the fact that yahoo and google can search things freely without saving everything in database. I want to know how they work.
Last time I checked, Google stored everything in a database.
Yes, EVERYTHING. (besides images of course).
Imagine having that kind of space in your PC.

Posted: Tue Jun 22, 2004 2:12 am
by lazy_yogi
artfhc wrote:so the only way to search things is to save every imformation in the database, then use the utility of mysql or other database language to search it, right? I am actually hoping if there are some other way whether than using all database. I don't understand the fact that yahoo and google can search things freely without saving everything in database. I want to know how they work.
There are algorithms for searching. I don't know them tho.
Using db's 'like' command is the slow way. You can use that for a small search space, but need much better stuff for bigger search. Like if google used that, there is no way they could search 5 billion texts in under 0.1 seconds.
Posted: Tue Jun 22, 2004 3:52 pm
by artfhc
This is kind of frustrating though, about the way to store everg single thing in database. So that means that google can only search things that are stored in their database? This is so unbelievable...but oh well.
Posted: Tue Jun 22, 2004 3:55 pm
by feyd
google's database is stored almost entirely in RAM at all times. Their bot is continually crawling their systems to update their cache, as well as spidering the links on the pages. We may
see some of how Google works internally, soon..
