What is the best way to code a search for my website developed in tapestry?
I have the following code in my layout.tml:
<div id="search" >
<form method="get" action="#">
<div>
<input type="text" name="s" id="search-text" value="" />
<input type="submit" id="search-submit" value="GO" />
</div>
</form>
I am just unsure of how to actually implement the search. If anyone can help or point me in the right direction it would be greatly appreciated.开发者_如何转开发
How to create a search engine depends completely on what type of site you have.
If you've got a blog or other collection of articles that are accessible to anyone you could simply add Google SiteSearch and let Google index your site.
If you've got a product database with titles/descriptions, you should probably go for Lucene. If you're already using Hibernate, it's easy to use Lucene through Hibernate Search (there's also book).
You need to index the content and keywords in some database and then fire SQL queries on it the smart way. That's going to be a lot of work to get it decently to work. Given the skillset shown as far by you, I would rather recommend to just use a 3rd party search API for this, such as Apache Lucene. Alternatively you can also just use Google Sitesearch.
精彩评论