How to integrate Google Custom Search into my website?
I want to integrate Google Custom Search into my website searching box.
The problem is I still want to keep my searching box. In addition, if the keywords are stock symbols, will use my site search engine. If the input is not stock symbol, will use Google Custom Search to search my website.
I want to use google custom search to search my whole site. The search result should be on my website but not jump to google search.
There is a JSON/Atom Custom Search API 开发者_如何学编程provided by google. Is this the only way to do this?
Please advice!
Don
Start here http://www.google.com/cse/manage/create. Then you will receive a original custom google search bar. Then you can grep the query which it produces and force your own form to result in the same query.
The paid version of the Custom Search Engine has a very clean XML implementation. You could pre-process the query and check whether it's a stock ticker symbol. If it is, handle it yourself, if not, send it to the CSE, get the XML, and format as you like. I wish they had it in the free version, but they don't.
As an alternate option, there are many free open source search engines, Solr/Lucene (implementations by SearchBlox, Constellio, Lucid Imagination, etc.), Sphinx, OpenSearchServer, Elastic Search, Xapian...
精彩评论