Simple google site search code

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.