Field Searching

When you index a database or other file containing fields, dtSearch saves the field information so you can perform searches limited to a particular field.  For example, if you index an Access database with a Name field and a Description field, then you could search for apple in the Name field like this:

Name contains apple

In addition to databases, dtSearch automatically recognizes metadata in supported file types.  For a list of supported metadata formats, see "What file formats does dtSearch support" at https://support.dtsearch.com.

To see a list of all of the fields defined in your index, click the fields... button in the Search dialog box.

Field searches can be combined using AND, OR, and NOT, like this:

(City contains (Portland or Seattle)) and (Address contains (Washington))

The parenthesis are necessary to ensure that dtSearch interprets the search request correctly.

To search for text that is not in any field, search for //text contains (search request). The //text field name means "not in any field".

Alternative field searching syntax

An alternative syntax for field searches is to add the field name and :: in front of each word, like this:

(City::Portland or City::Seattle) and (Address::Washington)

The alternative syntax can be used where the boolean syntax is not possible, such as in "all words" or "any words" searches and file conditions.

Nested Fields

Some file formats such as XML support nesting of fields.  Example:

<record>

     <name>John Smith</name>

     <address>

           <street>123 Oak Street</street>
           <city>Middleton</city>

           ...

In dtSearch, a search of a field includes any fields that are nested inside of the field, so the XML file above would be retrieved in a search for any of the following:

record contains oak

address contains oak

street contains oak

To specify a specific subfield of a field, use / to separate the field names, like this:

record/address contains oak

address/street contains oak

record/address/street contains oak

Put a / at the front of the field name to specify that it cannot be a sub-field of another field:

/record/name contains Smith

/name contains Smith

The second search request above would not match the XML example because, while it contains a "name" field, the name field is a sub-field of the record-field.  A search for /name specifies a "name" field at the top of the field hierarchy.

Finally, you can use // to specify any number of unspecified intervening fields, like this:

/record//city contains Middleton

Segment Searches

You can also define a field at the time of a search by designating words that begin and end the field, like this:

(beginning to end) contains (something)

The beginning TO end part defines the boundaries of the field.  The CONTAINS part indicates the words or phrases you are searching for in the field.  The only connector allowed in the beginning and end expressions in a field definition is OR.  Examples:

(name to address) contains john smith

(name to (address or xlastword)) contains (oak w/10 lane)

The field boundaries are not considered hits in a search.  Only the words being searched for (john smith, oak, lane) are marked as hits.