The xmltags index parameter

Use the xmltags parameter to specify which XML tags or XML paths are searchable in a column.

The XML tags or paths that you specify become the field names in the bts index. The text values within fields can be searched. In searches, the default field is the first tag or path in the field list. The Basic Text Search module does not check if the tags exist in the column, which means that you can specify fields for tags that you will add to the column after you have created the index.

The input for the field names for the xmltags parameter can be one of three forms:
  • inline comma-separated values
  • an external file
  • a table column

Input as inline comma-separated field names

Inline comma-separated field names are useful when you have only a few fields to index. For example, xmltags="(field1,field2,field3)" where fieldn specifies the tag or path to index.

If the xmltags parameter is enabled, you can specify paths for the xmltags values. For example
xmltags="(/text/book/title,/text/book/author,/text/book/date)"

XML tags are case-sensitive. When you use the inline comma-separated field names for input, the field names are transformed to lowercase characters. If the field names are uppercase or mixed case, use an external file or a table column for input instead.

Input from a file or a table column

Input from an external file has the format: xmltags="file:/directory/filename"

Input from a table column has the format: xmltags="table:table.column"

The file or table that contains the field names must be readable by the user creating the index. The file or table is read only when the index is created. If you want to add new field names to the index, you must drop and re-create the index. The field names in the file or table column can be separated by commas, white spaces, newlines, or a combination.

Following is an example of how field names can appear in the file or the table column:
title, author
date ISBN
If the xmlpath_processing parameter is enabled, you can specify paths or combination of paths and individual field names in the file or the table column:
/text/book/title
author

For information about using XML paths, see The xmlpath_processing index parameter.

If you want to index all the XML tags in a column, see The all_xmltags index parameter.

To view the fields that you have indexed, use the bts_index_fields() function. See bts_index_fields() function.