Problem/Motivation

Vertex supports returning all the facet keys for a given facet with their counts when returning search results from an Advanced Website Index. This information is critical for enabling faceting UIs. Currently the module doesn't support requesting the FacetSpec.

There may be other features that the module does not currently support that would require altering the request.

Proposed resolution

Allow altering the request and results in a separate module. This would allow for adding functionality such as requesting and parsing facetSpecs in another module.

Add a checkbox "Enable Faceting" within Filter Expressions that only appears when "Enable Filter" is checked and a Filter Plugin is selected.

When this checkbox is checked, expose a multi-value field to define facet keys.

Optionally also expose a text field that accepts an integer for limit (how many values to return for each key) If the limit field is left blank, would default to 20 to match the FacetSpec documentation.

Or - simply set the max = to the max for FacetSpec (300).

If "Enable Faceting" is checked, and there is at least one key, add facetSpecs to the query.

curl -X POST -H "Authorization: Bearer $( gcloud auth print-access-token ) " -H "Content-Type: application/json" "https://discoveryengine.googleapis.com/v1/projects/[project]/locations/global/collections/default_collection/engines/[search_app]/servingConfigs/default_search:search" -d '{ "query": "keyword", "filter": "datePublished >= \"2026-04-09\"", "facetSpecs": [{"facetKey":{"key": "about"}, "limit":50}]}'
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jastraat created an issue. See original summary.

jastraat’s picture

Currently just setting the limit of facet keys to the max 300 but this could be configurable.

jastraat’s picture

Issue summary: View changes
jastraat’s picture

As an alternative approach, add the ability to alter the request and parse results in a separate module. The facet functionality could then live in a submodule if desired.

jastraat’s picture

Title: Allow passing a FacetSpec when using Advanced Indexing » Allow altering the request to Vertex and the results from Vertex to support faceting in a separate module.
jastraat’s picture

Issue summary: View changes
jastraat’s picture

Issue summary: View changes
jastraat’s picture

Status: Active » Needs review

  • timozura committed 10575341 on 1.0.x authored by jastraat
    Issue #3596656: Add ability to alter Vertex request and results.
    
timozura’s picture

Version: 1.0.x-dev » 1.12.0
Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.