Next: Fields and XML, Previous: Multiple documents in a file, Up: Tutorial

### 1.7 Fields

Amberfish allows searching on specific fields within documents. Support for various file formats is provided by document type modules. The document type must be specified to `af` at the time of indexing, using the `-t` option. Each document is individually associated with a document type as it gets added to the database. The default document type (if none is specified) is `text`, which does not recognize any fields and therefore does not support field searching.

Here is an example of searching on a field:

         $ af -s -d mydb -q 'Title/cat'

This means, “Find all documents that contain the word, ‘`cat`’, in the ‘`Title`’ field.”

Unlike search words, field names may be case-sensitive, so that ‘`Title`’ and ‘`title`’ might be two different fields. Whether or not fields are case-sensitive is determined by the document type. For example, XML elements and attributes are case-sensitive; therefore an XML document type would most likely have case-sensitive fields. As we shall discuss later, it is best not to mix document types within a single database if those document types have incompatible views about case-sensitivity.