O'Reilly logo

Hibernate Search by Example by Steve Perkins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing the search query code

Our VAPORware Marketplace web application will be based on a Servlet 3.0 controller/model class, rendering a JSP/JSTL view. The goal is to make things simple, so that we can focus on the Hibernate Search aspects. After reviewing this example application, it should be easy to adapt the same logic in JSF or Spring MVC, or even newer JVM-based frameworks, such as Play or Grails.

To start, we will write a trivial index.html page, containing a text box for users to enter search keywords:

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>VAPORware Marketplace</title> </head> <body> <h1>Welcome to the VAPORware Marketplace</h1> Please enter keywords to search: <form action="search" method="post"> <div id="search"> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required