Skip to main content

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 (-)

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 TypeDescriptionSearchableFilterableNotes
keywordDefault type; exact values onlyNoYesCannot be searched
textFull text; supports search and filteringYesYes
integerInteger numbersNoYesSupports range filters
doubleDecimal numbers with a dot (e.g., 5.74)NoYesSupports range filters
dateDates/times in ISO 8601 formatNoYesTime 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 fieldname with 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