Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 527

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Accessing and Using Data
Refining your searches with zones and fields
One of the strengths of Verity is its ability to perform full-text searches on documents of many formats. However,
sometimes you want to restrict a search to certain portions of a document, to improve search relevance. If a Verity
collection contains some documents about baseball and other documents about caves, a search for the word bat can
retrieve several irrelevant results.
If the documents are structured documents, you can take advantage of the ability to search zones and fields. The
following are some examples of structured documents:
• Documents created with markup languages (XML, SGML, HTML)
• Internet Message Format documents
• Documents created by many word-processing applications
Note: Although your word processor opens with what appears to be a blank page, the document has many regions such
as title, subject, and author. Refer to the documentation of your application or online help system for how to view a
document's properties.
Zone searches
You can perform zone searches on markup language documents. The Verity zone filter includes built-in support for
HTML and several file formats; for a list of supported file formats, see
searches XML files by treating the XML tags as zones. When you use the zone filter, the Verity engine builds zone
information into the collection's full-word index. This index, enhanced with zone information, permits quick and
efficient searches over zones. The zone filter can automatically define a zone, or you can define it yourself in the
style.zon file. You can use zone searching to limit your search to a particular zone. This can produce more accurate,
but not necessarily faster, search results than searching an entire file.
Note: The contents of a zone cannot be returned in the results list of an application.
Examples
The following examples perform zone searching on XML files. In a list of rock bands, you could have XML files with
tags for the instruments and for comments. In the following XML file, the word Pete appears in a comment field:
<band.xml>
<Lead_Guitar>Dan</Lead_Guitar>
<Rhythm_Guitar>Jake</Rhythm_Guitar>
<Bass_Guitar>Mike</Bass_Guitar>
<Drums>Chris</Drums>
<COMMENT_A>Dan plays guitar, better than Pete.</COMMENT_A>
<COMMENT_B>Jake plays rhythm guitar.</COMMENT_B>
</band.xml>
The following CFML code shows a search for the word Pete:
<cfsearch name = "band_search"
collection="my_collection"
type = "simple"
criteria="Pete">
The above search for Pete returns this XML file because this search target is in the COMMENT_A field. In contrast,
Pete is the lead guitarist in the following XML file:
"Building a Search
Last updated 1/20/2012
Interface" on page 476. Verity
522

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents