documentType( )


Refines a search builder to only search for documents of the specified document type.

The document type can be one of the following:

  • "Site/Pages"
  • "Blog/Posts"
  • "Bookings/Services"
  • "Forum/Content"
  • "Stores/Products"

Setting the document type to Site/Pages:

  • Restricts the search to all regular and dynamic pages on your site that have SEO indexing enabled. Note that all Wix site pages are indexed by default.
  • Most main Wix app pages (for example, the Stores Shop page and the Blog Posts page) are included in the search.
  • App pages with content based on app collections (for example, individual Store products and Blog posts) are not included in the search. To search Wix app collection content, set the documentType to the corresponding app collection (for example, "Stores/Products").
  • Custom router pages and some Wix app pages are not currently included in the search.
  • If the documentType is set to "Site/Pages", you cannot filter, sort, or apply facets to your search results.
  • Only the content of the title and description fields are searched.

Setting the document type to a Wix app:

  • Restricts the search to the content of the specified Wix app collection, which also appear as pages on your site. For example, setting the documentType to "Stores/Products" restricts the search to products stored in the "Stores/Products" collection, which are also displayed in your site's Product Page.
  • The document properties returned in the search results differ depending on the supported schema for the specified documentType.
  • You can filter, sort, and apply facets to selected fields based on the supported schema for each app.
  • For schema information see the following articles: - Blog/Posts schema - Bookings/Services schema - Forum/Content schema - Stores/Products schema

If the documentType is not specified, it defaults to "Site/Pages".

Note that you cannot chain multiple documentType() functions to search for multiple document types. Only the last specified document type will be searched.

Deprecation note: "Forum/Posts" is no longer supported. Use "Forum/Content" instead.

Method Declaration
Copy
Method Parameters
typestringRequired

The document type to search in.

Returns
Return Type:WixSearchBuilder
Was this helpful?
Yes
No