You can define fields with custom names and values using meta tags on your web pages. Our API returns the names and values of the custom fields in search results, and you can filter the search results using them.
Please note that custom fields’ names may contain only the following characters: A-Z, a-z,_,-, and 0-9, and the maximum length of the custom field name is 256 characters.
For instance, an artist has songs in different genres. You can define a custom field for the artist with the artist name, records with the record names, and genres with the genre names.
To define custom fields on a web page, use addsearch-custom-field
meta tag as follows:
<html> <head> <meta name="description" content="This is a test page"/> <meta name="addsearch-custom-field" content="city=London"/> <meta name="addsearch-custom-field" content="genre=rock;genre=pop"/> <meta name="addsearch-custom-field" content="genre=hiphop"/> <meta name="addsearch-custom-field" data-type="text" content="description=This is a rock/pop event taking place in London"/> <meta name="addsearch-custom-field" data-type="date" content="event_date=2019-11-19"/> <meta name="addsearch-custom-field" data-type="integer" content="price_cents=599"/> <meta name="addsearch-custom-field" data-type="double" content="average_review=4.3"/> </head> <body> Lorem ipsum </body> </html>
You can assign multiple values to a single custom field name. Add multiple values to separate meta tags or combine multiple values by separating them with a semicolon.
Custom fields support the following data types:
For a specific custom field name, the data type will be locked after the first time the field is encountered by our crawler. Because of this, the data type of a custom field cannot be changed once it has been defined. If you need to use another the data type, you also need to change the field’s name. A custom field meta tag with unrecognized data type value will be ignored.
Search results can be filtered against custom fields in the Search API and Separate results page.
We’re always happy to help with code or other questions you might have. Search our documentation, contact support, or connect with our sales team.