Simple google site search code
As the website data volume increases, tens of millions of data records will be added in the future, and the website's own search will increase the occupation of server resources, in addition to setting up a search engine on the server to reduce queries on the database of the website itself, I plan to use the google index as the default site search entry.
The quality of data resources on my website is relatively high. With the help of google's website administrator tool, google indexing has always contained more than 90% entries, therefore, google indexing is ideal for intra-site search.
Here we will change the code for searching in my site to google for intra-site search. The following is a concise code:
<Form id = "search-form" action = "http://www.google.com/search" method =" get ">
<Input name = "sitesearch" value = "companylist. biz" type = "hidden">
<Input id = "s" type = "text" name = "q" placeholder = "Search & hellip;" style = "display: none;">
<Input id = "search-submit" type = "submit" name = "s" value = "Search">
You can change it at will, and add more attributes:
Parameter reference:
Name = "sitesearch": inform Google of the specified website or domain name you want to search
Name = "ie": Tell Google to send the Web code of the search term, the default value is "UTF-8", because many websites in China are using GB2312 Encoding
Name = "oe": Tell Google to display the search page code, the default value is "UTF-8", because most modern machines can support "UTF-8" error, therefore, you probably do not need to adjust the parameters;
Name = "hl": Tell Google to display the search webpage language ." En-CN is simplified Chinese, zh-TW is traditional Chinese, and en is English.