Setting up a search engine for your site

kirus

Junior Member
Dec 9, 2006
15
0
0
I need help adding a search field to a website that will look up a word and then give the definition.

Ex) www.dictionary.com I need to do something very similar to that for a website.

How would I do this? Do I need to create a new page for every word?


Thanks
 

homercles337

Diamond Member
Dec 29, 2004
6,340
3
71
PHP + mySQL FTW.

Edit: Poor man's search that is. Just make a table with all the words from your site and frequency of each word on each page. Then someone searches for pr0n and you provide all links to each page sorted by frequency. Pie...
 

homercles337

Diamond Member
Dec 29, 2004
6,340
3
71
What if word X exists on more than one page?

edit: or what if someone is looking for word X, but doesnt really know the word. That adds another layer of complexity (regex) to my "poor man's" search. Youre going to have to be more specific because dictonary.com does provide a list of pages based on best approximations, but if people are just looking for you pr0n page and they will always know that, you wont even need mySQL. You can do this with PHP and text parsing very simply.
 

homercles337

Diamond Member
Dec 29, 2004
6,340
3
71
To clarify there are 3 levels im seeing here:

User knows "name" of page: PHP only.
User knows a word, but not the "name" of page: PHP + mySQL.
User doesnt know "name," but may know what it starts with, sounds like, looks like, whatever: PHP (with regex) + mySQL + some mad SQL skills.

Of course, im not a professional in this area so im sure someone that knows more than me will chime in.
 

kirus

Junior Member
Dec 9, 2006
15
0
0
If it exists on more than one page, then that can come up. However, the word "dog" will only have one page for that definition.

Sorry if I'm unclear, but do you understand the search that I need?
 

kirus

Junior Member
Dec 9, 2006
15
0
0
Originally posted by: homercles337
To clarify there are 3 levels im seeing here:

User knows "name" of page: PHP only.
User knows a word, but not the "name" of page: PHP + mySQL.
User doesnt know "name," but may know what it starts with, sounds like, looks like, whatever: PHP (with regex) + mySQL + some mad SQL skills.

Of course, im not a professional in this area so im sure someone that knows more than me will chime in.


Thanks for the quick reply. All I really need is the bold one because user knows the word they want to enter but of course not the page title. Do you know how you would do this? I asked a computer programmer and he said it would take him 5 hours and $100, which I thought was absurd.

edit: I have bluehost for server and domain, and it comes with PHP and MySQL etc but I am too much of a n00b to know how to do this...
 

homercles337

Diamond Member
Dec 29, 2004
6,340
3
71
Originally posted by: kirus
If it exists on more than one page, then that can come up. However, the word "dog" will only have one page for that definition.

Sorry if I'm unclear, but do you understand the search that I need?

Yes, you want "dog" to go to one page that you predefine. If this is the case, then you would have to manually define these associations. This can be done with PHP only and will be a huge PIA if your site is large OR you want it to grow. But otherwise, this is really simple on the backend sorts of things. On the other hand, you could write an admin page that lets you modify these associations. Again, though, this is a lot of manual work and you want to avoid this. Automation is the reason we have computers now, ya know? What if you move your site to a new server, you have to basically rebuild from the ground up for linkage. I say that is a HORRIBLE way to do things.
 

kirus

Junior Member
Dec 9, 2006
15
0
0
Eh so there is no easy way to do this. Will I have to manually create a page for over say 1000 words or can I just have a database that will bring the words up on a page?
 

homercles337

Diamond Member
Dec 29, 2004
6,340
3
71
You will either have to uniquely define each page (yes, by hand) or you could create metadata for each page that a seach (PHP or any server side script, RDB for faster results) could key in on (this means you would have to go in and manually change just a small thing). This is a static solution that will have to be changed (by hand again) if you want to change it. Im sure i could come up with a solution, but basically this is a predefined (static) thing that you want to do. Relational databases dont just "create themselves" YOU have to do that. If you want that to change dynamically, YOU have to define how it is going to change (# of words in page, relevancy based on users rating, or whatever). How else is are your scripts supposed to know what page to serve? Im pretty bored, how about a use case scenario? If not, just bump this on monday afternoon and someone will have a better idea im sure.
 

kirus

Junior Member
Dec 9, 2006
15
0
0
Originally posted by: homercles337
You will either have to uniquely define each page (yes, by hand) or you could create metadata for each page that a seach (PHP or any server side script, RDB for faster results) could key in on (this means you would have to go in and manually change just a small thing). This is a static solution that will have to be changed (by hand again) if you want to change it. Im sure i could come up with a solution, but basically this is a predefined (static) thing that you want to do. Relational databases dont just "create themselves" YOU have to do that. If you want that to change dynamically, YOU have to define how it is going to change (# of words in page, relevancy based on users rating, or whatever). How else is are your scripts supposed to know what page to serve? Im pretty bored, how about a use case scenario? If not, just bump this on monday afternoon and someone will have a better idea im sure.

Thanks so much for the help. I admit I didn't fully understand everything you said but I now know that I can't create a page for each word.

The use case scenario, should I take this route (I'm not sure what it is). Also, my sn is manowar 245 if you want to access my control panel etc cause it says MySQL etc but I can't create one.
 

homercles337

Diamond Member
Dec 29, 2004
6,340
3
71
Originally posted by: kirus
Originally posted by: homercles337
To clarify there are 3 levels im seeing here:

User knows "name" of page: PHP only.
User knows a word, but not the "name" of page: PHP + mySQL.
User doesnt know "name," but may know what it starts with, sounds like, looks like, whatever: PHP (with regex) + mySQL + some mad SQL skills.

Of course, im not a professional in this area so im sure someone that knows more than me will chime in.


Thanks for the quick reply. All I really need is the bold one because user knows the word they want to enter but of course not the page title. Do you know how you would do this? I asked a computer programmer and he said it would take him 5 hours and $100, which I thought was absurd.

edit: I have bluehost for server and domain, and it comes with PHP and MySQL etc but I am too much of a n00b to know how to do this...

How do you presume to "create" the word -> page association?

Yes, you have to predefine this assocation. You want ONE word to go to ONE page based on a search. From a design prespective, just make every page unique based on your search terms. Ie. a seach for dog goes to dog.html, search for cat goes to cat.html. Your "search" function (which really isnt a search) goes to foo.html. This would be about two lines of code. Pie...

If you want to "rebuild" a site for this "feature" there is A LOT of manual work involved. You could write a script to make the associations and you could run it when you made a change, but writing that script would be a bit of work. Again, i dont know your goals, perspecitives, aims, etc. Clarity in what youre REALLY looking to do is key here.
 

kirus

Junior Member
Dec 9, 2006
15
0
0
What I want to do is to create basically a dictionary.com website where you enter a word in french and then can get the translation of that word into English. Creating a page for every word would take forever, but I can start working on it.
 

homercles337

Diamond Member
Dec 29, 2004
6,340
3
71
Originally posted by: kirus
The use case scenario, should I take this route (I'm not sure what it is). Also, my sn is manowar 245 if you want to access my control panel etc cause it says MySQL etc but I can't create one.

A use case scenario is, imagine youre a user that wants this feature. How does it work? Here is how i imagine your use case:
User foo goes to site bar.
User foo is looking for page dog.
Link to dog is not on main page.
User foo "searches" for page dog.
Serverside script "knows" term dog means serve page dog.html.

I use quotes on search and knows because if a function returns a predefined value, rather than looking for one, it is predefined not dynamic. Does this make sense at all?
 

kirus

Junior Member
Dec 9, 2006
15
0
0
I understand your post. I just didn't understand the making all the pages for terms manually part.
 

homercles337

Diamond Member
Dec 29, 2004
6,340
3
71
Originally posted by: kirus
What I want to do is to create basically a dictionary.com website where you enter a word in french and then can get the translation of that word into English. Creating a page for every word would take forever, but I can start working on it.

Ok, no you dont get it. In this case you would write a file that associates an english word with its french translation. This would be part of an include in a script that would take info from that file and dynamically generate a page. It would look like this:

user inputs foo and sends this to a script on your server (PHP)
the script receives foo and looks at a file (that you wrote) and picks the associated french word
the script takes these two words and generates a page (that you designed) and serves it
this page would be IDENTICAL to every word search, but would insert the necessary search terms, french conversions, ineresting thoughts, and pr0n you deem appropriate.

Does this help? Someone skilled in PHP, css, html, etc could do this in an hour or so.
 

homercles337

Diamond Member
Dec 29, 2004
6,340
3
71
Originally posted by: kirus
I understand your post. I just didn't understand the making all the pages for terms manually part.

Now that i understand your Q a bit more, YOU would make a single text file with english words in one column and french translation in the other. The server side script would take an input (one english word), search the text file for said word, retrieve french word, and insert them into a page. This would be the same for EVERY "search" term. Basically, the words would be variables and they would change, but everything else would be same on the page. I believe this is what you want, no?

In this case, you may not even have to write the text file, just write a dictionary.com query and retrieve then serve.
 

kirus

Junior Member
Dec 9, 2006
15
0
0
edit: I have the text file with over 1000 words in French in one column and the English words in the other column!
 

kirus

Junior Member
Dec 9, 2006
15
0
0
homercles, now that I have the textfile, how do I add it into the server side script so it could do what you said?

edit: just got your PM