PDA

View Full Version : search



IanMarlowe
07-17-2005, 05:27 AM
does anyone around here know how to make a search engine? I don't get how you make a text box and the text input is searched for throughout your website...

Twey
07-17-2005, 09:43 AM
You can use a server-side tool (grep -ir), or you can use a seperate search engine, like so:

<form method="get" action="www.google.com/custom">
<input type="text" name="q"/>
<input type="hidden" name="sitesearch" value="www.mysite.com"/>
<input type="hidden" name="domains" value="www.mysite.com"/>
<input type="submit" value="Search!"/>
</form>
This is what a lot of sites do, including php.net and the W3C.
As you may have noticed, Google provide a "custom search" page. You can also use a hidden input named "cof" to select certain options about the style of the search page, such as a custom icon to display and the colour scheme. I've yet to figure out what all the options do (in the form of option:value;option:value;) as they all have obscure names like "L" and "T".
See http://www.google.com/custom?q=gfgg&sa=Go&cof=T%3Ablack%3BLW%3A72%3BALC%3A%23ff3300%3BL%3Ahttp%3A%2F%2Fwww.w3.org%2FIcons%2Fw3c_home%3BLC%3A%23000099%3BLH%3A48%3BBGC%3Awhite%3BAH%3Aleft%3BVLC%3A%2366006 6%3BGL%3A0%3BAWFID%3A0b9847e42caf283e%3B&sitesearch=www.w3.org&domains=www.w3.org for an example. Experiment.

/edit: Have a butcher's at http://www.google.com/faq_freewebsearch.html.

IanMarlowe
07-17-2005, 11:43 AM
thanks. I had a "butcher's hook ;)"

Twey
07-17-2005, 04:03 PM
Heh - I was wondering if any of y'all Americans out there would get it :p