Possible to define filters outside of searchprovider config using search ui?

When using Search UI, is it possible to define search filters on other components than the <SearchProvider>?

This is the config for our SearchProvider:

const config: SearchDriverOptions = {
    alwaysSearchOnInitialLoad: false,
    apiConnector: SearchConnector(),
    hasA11yNotifications: true,
    autocompleteQuery: {
      results: {
        resultsPerPage: 8,
        result_fields: {
          search_title: { raw: {} },
          page_category: { raw: {} },
          url_path: { raw: {} },
        },
        search_fields: {
          search_title: { weight: 9 },
          meta_description: { weight: 7 },
          headings: { weight: 5 },
          body_content: { weight: 3 },
        },

        filters: [{ field: 'node_locale', values: [node_locale], type: 'all' }],
      },
    },
    searchQuery: {
      resultsPerPage: 24,
      result_fields: {
        search_title: { raw: {} },
        page_category: { raw: {} },
        url_path: { raw: {} },
        page_image: { raw: {} },
      },
      search_fields: {
        search_title: { weight: 9 },
        meta_description: { weight: 7 },
        headings: { weight: 5 },
        body_content: { weight: 3 },
      },
      filters: [{ field: 'node_locale', values: [node_locale], type: 'all' }],
      disjunctiveFacets: ['page_category'],
      facets: {
        page_category: {
          type: 'value',
          size: 100,
        },
      },
    },
  };
return config;

As you can see we filter results on locale, so the swedish part of the site doesn't return english search results and vice versa.

Since the <SearchProvider> needs to wrap our entire app, and since the node_locale is not available for us on that level of the app, it's not working to filter our search results by locale.

Is it possible to append the filter from further down the component tree? Such as from the <Results> and/or <SearchBox> components?

Bonus question: Why is ?size=n_20_n appended to our URLs even if we do not search?

Best regards, Samuel

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.