Comment on page
Adding custom fields
The crawler extracts metadata from each page and condenses it into a standard set of fields to be added to the search index.
The crawler uses page metadata and content to construct a standardized set of fields:
- URL (
url). The full URL of the page
- Title (
title). The meta-title of the page
- Image (
image). URL for the page image
- Language (
lang). Language of the page content (
- Description (
description). The meta description of the page
- Keywords (
keywords). List of keywords for the page
- Modified Time (
modified_time). The time when the page was last modified
- Published Time (
published_time). The time when the page was first published
- Headings (
headings). List of headings from the body of the page
When multiple metadata types are used for a given field, the crawler will use OpenGraph values over others.
- Page title:
- Page description:
og:description over <meta type="description">
<body>is summarised to provide a more concise base for searching. This process discards text inside
Fields derived from the URL are also included for common queries (e.g. limiting to a domain or particular sub-URL structure of a site):
- Domain (
domain). The domain of the URL
- First directory (
dir1). The first directory of the URL, or empty if none
- Secondary directory (
dir2). The second directory of the URL, or empty if none
In addition to the above, the following metadata is also extracted if available:
- All meta tags within head
- OpenGraph tags
- Custom SJ tags
- Body content (
- 1.Add a schema field (e.g.
authors) and select the desired schema field type.
- 2.Add custom meta tags to your site (see below).
- 4.Re-crawl all domains so all records are updated.
Schema fields must begin with a letter and contain only letters, numbers or underscores
Filters and facets often use additional fields to provide better searching and filtering capabilities. For example, a news site might want to filter by topic or a documentation site by version.
Custom meta tags allow you to add those additional fields to your records. Meta tags are defined in HTML by adding
dataattributes to elements. To avoid name clashes with other systems, data attributes must contain the prefix
By default the crawler reads
<head>, but only keeps standard fields (title, description, keywords, etc). Add a
data-sj-field="fieldname"attribute to override this behaviour and create a custom field from the meta tag's
contentattribute. This example shows an otherwise ignored
<meta>tag being converted into a custom field
property="custom meta field"
To capture data already rendered within an element, add
<span data-sj-field="random">This text is the value</span>
This will set custom field
random="This text is the value".
If you don't want the data rendered on the page, then you can also set the field value using the data attribute.
<span data-sj-field="fieldname" data-sj-value="fieldvalue">
This text is not used because the data attribute has a value
It is possible to add a list of values by repeating the same tag multiple times. You just need to ensure that the schema field type is a 'List of String/Integers/etc'.
<meta data-sj-field="topics" content="Art"/>
<meta data-sj-field="topics" content="Biology"/>
<meta data-sj-field="topics" content="Chemistry"/>
In the example above, the strings "Art, Biology, Chemistry" will be stored as a list against the field
Note: If you have multiple meta tags on your page for a specific field but the schema field type is not a list, we will not index that webpage.
Problem: I have very locally targeted content and wish to recommend local content based on my site visitor location. Solution: On each "locally" targeted content page, add two pieces of meta information as follows. e.g.
<span data-sj-field="lat" data-sj-value="-33.867487"></span>
<span data-sj-field="lng" data-sj-value="181.3615434"></span>
In the above case, the prefix data-sj-field indicates this is information specific to the page. So
data-sj-field="lat"indicates this page has a property called "lat" with corresponding value -33.867487.
Processed metadata is the metadata that is stored in the index. Raw metadata is read by the crawler, but may not be indexed in the search index. An example of raw metadata is links on a webpage that may be useful for the crawler to find linked pages, but do not need to be recorded in the search index.