Defining Custom Fields
AddSearch lets you define custom fields for your web pages by using meta tags or HTTP headers. These fields appear in search results and enable filtering based on custom data.
Supported Custom Fields Characteristics
- Maximum custom fields per index: 200
- Maximum field name length: 256 characters
- Allowed characters in field names:
- Letters (
a-z,A-Z) - Digits (
0-9) - Underscores (
_) - Hyphens (
-)
- Letters (
Field values, when URL-encoded, must include only US ASCII characters (octets 0-127) excluding control characters and delimiters such as:
( ) < > @ , ; : \" / [ ] ? = { } SPACE TAB
Supported Data Types
| Data Type | Description | Searchable | Filterable | Notes |
|---|---|---|---|---|
| keyword | Default type; exact values only | No | Yes | Cannot be searched |
| text | Full text; supports search and filtering | Yes | Yes | |
| integer | Integer numbers | No | Yes | Supports range filters |
| double | Decimal numbers with a dot (e.g., 5.74) | No | Yes | Supports range filters |
| date | Dates/times in ISO 8601 format | No | Yes | Time part optional; supports range filters |
Note: The data type for each field name is locked after the crawler first encounters it. To change a field's data type, rename the field accordingly. Meta tags with unrecognized data types are ignored.
Define Custom Fields Using Meta Tags
Add custom fields on each web page by adding one or more meta tags with the name addsearch-custom-field. Use the format:
<meta name="addsearch-custom-field" content="fieldname_datatype=value" />
- Replace
fieldnamewith your custom field's name. - Specify the data type after an underscore (
_), e.g.,_keyword,_text,_integer,_double, or_date. - Assign the field value after the equals sign (
=).
Example
<meta name="addsearch-custom-field" content="genre_keyword=Rock" />
<meta name="addsearch-custom-field" content="release_date_date=2019-11-19" />
To assign multiple values to the same field, either add multiple meta tags with the same field name or separate values with semicolons:
<meta name="addsearch-custom-field" content="genre_keyword=Rock;Pop" />
<meta name="addsearch-custom-field" content="genre_keyword=Rock" />
<meta name="addsearch-custom-field" content="genre_keyword=Pop" />
You can filter search results by custom fields through the Search API or in the Separate results page settings.
Define Custom Fields Using HTTP Headers
You can also define custom fields using the Addsearch-Custom-Field HTTP header when serving your pages.
Single field example
Addsearch-Custom-Field: genre_keyword=Rock%20%26%20Roll
Multiple fields in one header
Addsearch-Custom-Field: genre=Rock%20%26%20Roll, genre=Pop, band_keyword=Wham%21
Multiple headers example
Addsearch-Custom-Field: genre=Rock%20%26%20Roll, genre=Pop
Addsearch-Custom-Field: band_keyword=Wham%21
Additional Resources
- Learn more about using custom fields
- Configure custom fields with the Custom Fields Manager