In this chapter, we??™ll look at how search should work for the user and then look at how the
Zend_Search_Lucene component works. We will then integrate search into an example website, looking at
how to index a model and how to present results to the user.
8.1 Benefits of search
For most of us, we get the best from a web site when we successfully read the information we came for. For an
e-commerce site, this generally means finding the item and purchasing it.
8.1.1 Key usability issue for users
Users want only one thing from their search: to find the right thing with the minimum amount of effort.
Obviously, this isn??™t easy and is a major reason why Google is the number one search engine. Generally, a
single text field is all that is required. The user enters their search term, presses the submit button and gets a
list of answers.
8.1.2 Ranking results is important
For a search system to be any good, it is important that the relevant results are displayed. The way to do this is
for each results to be ranked in order of relevance to the search query. In order to do this a full text search
engine is used. Full text search engines work by creating a list of keywords for each page of the site. The list of
keywords is known as the index. Along with the list of keywords, other relevant data is also stored, such as a
title, date of document, author and information on how to retrieve the page, such as the url.
Pages:
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212