Choosing How to Search the Catalog
As always, there are a few things we need to think about before starting to code. When designing
each new feature, we begin by analyzing that feature from the end user??™s perspective.
For the visual part of the catalog search feature, we??™ll use a text box in which the visitor
can enter one or more words to search for in the product names and descriptions. The text
entered by the visitor can be searched for in several ways:
Exact-match search: If the visitor enters a search string composed of more than one word,
they will be searched for in the catalog as is, without splitting up the words and searching
for them separately.
All-words search: The search string entered by the visitor is split into individual words,
causing a search for each product that contains all the words entered by the visitor. This is
like the exact-match search in that it still searches for all the entered words, but in this
case, the order of the words is not important.
Any-words search: This kind of search returns the products that contain at least one of the
words of the search string.
221
C H A P T E R 8
This simple classification isn??™t by any means complete. The search engine can be as complex
as the one offered by modern Internet search engines, which provide many options and
features and show a ranked list of results, or as simple as searching the database for the exact
string provided by the visitor.
Pages:
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331