Dev Indexing Structured Data

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.

For instance, an artist has records in different genres. With custom fields, you can define a custom field for the artist with the artist name, records with the record names, and genres with the genre names.

Instructions

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:

  • keyword: Default data type. It cannot be searched but can be used as filters.
  • text: Can be both searched and used as filters.
  • integer: Can be used with range filters.
  • double: Use point as decimal separator. Example: “5.74”. It can be used with range filters.
  • date: Holds date, time and time zone. It should be in ISO 8601 format. The time part is optional.
    Examples: “2019-11-19T00:00:00.000Z”, “2019-11-19”. Can be used with range filters.

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 can not be changed at a later date. If you need to do this, change the name of the field as well. 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.

Additional resources

Was this helpful?

Need more help?

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.