4

I get this error from the Google RichSnippets testing tool:

Error: Page contains property "query-input" which is not part of the schema.

But where did I make a mistake?

HTML:

<div id="dkAjaxSearch">
<input id="ajaxSearch" type="text" value="" name="search_term" itemprop="query-input">
Press Enter to search
</div>

JSON-LD:

<script type="application/ld+json">
{
   "@context": "http://schema.org",
   "@type": "WebSite",
   "url": "https://domain.com/",
   "potentialAction": {
     "@type": "SearchAction",
     "target": "http://domain.com/search/{search_term_string}",
     "query-input": "required name=search_term_string"
   }
}
</script>

Documentation: An improved search box within the search results

unor
  • 82,883
  • 20
  • 183
  • 315
user2306309
  • 371
  • 2
  • 5
  • 14

2 Answers2

3

It’s explained in the documentation about Actions:

Additional information is often required from a user or client in order to formulate a complete request. To facilitate this process we need the ability to describe within a potential action how to construct these inputs. Since we need this capability for filling in any property of an Action, we introduce a notion of property annotations using a hypen ("-") delimiter. For example, by specifying a "location-input" property on a potential action we are indicating that "location" is a supported input for completing the action.

But as this property does not exist (i.e., it’s not defined in the property table on SearchAction), validators report it as an error.

This issue already gets discussed on Schema.org’s GitHub: SearchAction example uses "query-input" property that is not defined

So you did not do something wrong. Unless Schema.org decides that Actions should be handled in a different way, validators should probably update and allow -input and -output suffixes.

unor
  • 82,883
  • 20
  • 183
  • 315
1

The problem is that the query-input value (in your case search_term_string) must match the input field name.

in your case:

<input id="ajaxSearch" type="text" value="" name="search_term" itemprop="query-input">

must be:

<input id="ajaxSearch" type="text" value="" name="search_term_string" itemprop="query-input">
giammin
  • 17,130
  • 6
  • 64
  • 84
  • Do you have this anywhere documented? – Aysennoussi Aug 09 '16 at 08:57
  • @Sekai https://webmasters.googleblog.com/2014/09/improved-sitelinks-search-box.html see update – giammin Aug 09 '16 at 12:50
  • I think they only meant that what's in Target should be in query-input. They didn't mention the HTML though. I checked on some sites like Moz & Pinterest, they're not modifying their html input name. – Aysennoussi Aug 09 '16 at 17:02