@coveo/headless
    Preparing search index...

    Interface SearchActionCreators

    The search action creators.

    See Dispatch actions.

    interface SearchActionCreators {
        executeSearch(
            analyticsSearchAction: LegacySearchAction,
        ): AsyncThunkAction<
            ExecuteSearchThunkReturn,
            LegacySearchAction,
            AsyncThunkOptions<
                StateNeededByExecuteSearch,
                ClientThunkExtraArguments<SearchAPIClient, GeneratedAnswerAPIClient>,
            >,
        >;
        fetchFacetValues(
            analyticsSearchAction: LegacySearchAction,
        ): AsyncThunkAction<
            ExecuteSearchThunkReturn,
            LegacySearchAction,
            AsyncThunkOptions<
                StateNeededByExecuteSearch,
                ClientThunkExtraArguments<SearchAPIClient, GeneratedAnswerAPIClient>,
            >,
        >;
        fetchInstantResults(
            options: FetchInstantResultsActionCreatorPayload,
        ): AsyncThunkAction<
            FetchInstantResultsThunkReturn,
            FetchInstantResultsActionCreatorPayload,
            AsyncThunkSearchOptions<
                ConfigurationSection & Partial<
                    QuerySection & AdvancedSearchQueriesSection & PaginationSection & SortSection & FacetSection & NumericFacetSection & CategoryFacetSection & DateFacetSection & ContextSection & DidYouMeanSection & FieldsSection & PipelineSection & SearchHubSection & QuerySetSection & FacetOptionsSection & FacetOrderSection & DebugSection & SearchSection & FoldingSection & TriggerSection,
                > & InstantResultSection,
            >,
        >;
        fetchMoreResults(): AsyncThunkAction<
            ExecuteSearchThunkReturn,
            void,
            AsyncThunkOptions<
                StateNeededByExecuteSearch,
                ClientThunkExtraArguments<SearchAPIClient, GeneratedAnswerAPIClient>,
            >,
        >;
        fetchPage(
            analyticsSearchAction: LegacySearchAction,
        ): AsyncThunkAction<
            ExecuteSearchThunkReturn,
            LegacySearchAction,
            AsyncThunkOptions<
                StateNeededByExecuteSearch,
                ClientThunkExtraArguments<SearchAPIClient, GeneratedAnswerAPIClient>,
            >,
        >;
    }
    Index

    Methods

    • Creates an action that executes a search query.

      Parameters

      • analyticsSearchAction: LegacySearchAction

        The analytics action to log after a successful query. See loadSearchAnalyticsActions for possible values.

      Returns AsyncThunkAction<
          ExecuteSearchThunkReturn,
          LegacySearchAction,
          AsyncThunkOptions<
              StateNeededByExecuteSearch,
              ClientThunkExtraArguments<SearchAPIClient, GeneratedAnswerAPIClient>,
          >,
      >

      A dispatchable action.

      const {logInterfaceLoad} = loadSearchAnalyticsActions(engine);
      const {executeSearch} = loadSearchActions(engine);

      engine.dispatch(executeSearch({legacy: interfaceLoad()}))
    • Creates an action that only fetches facet values without affecting the rest of the state.

      Parameters

      • analyticsSearchAction: LegacySearchAction

        The analytics action to log after a successful query. See loadSearchAnalyticsActions for possible values.

      Returns AsyncThunkAction<
          ExecuteSearchThunkReturn,
          LegacySearchAction,
          AsyncThunkOptions<
              StateNeededByExecuteSearch,
              ClientThunkExtraArguments<SearchAPIClient, GeneratedAnswerAPIClient>,
          >,
      >

      A dispatchable action.

    • Creates an action that fetches instant results.

      Parameters

      Returns AsyncThunkAction<
          FetchInstantResultsThunkReturn,
          FetchInstantResultsActionCreatorPayload,
          AsyncThunkSearchOptions<
              ConfigurationSection & Partial<
                  QuerySection & AdvancedSearchQueriesSection & PaginationSection & SortSection & FacetSection & NumericFacetSection & CategoryFacetSection & DateFacetSection & ContextSection & DidYouMeanSection & FieldsSection & PipelineSection & SearchHubSection & QuerySetSection & FacetOptionsSection & FacetOrderSection & DebugSection & SearchSection & FoldingSection & TriggerSection,
              > & InstantResultSection,
          >,
      >

      A dispatchable action.

    • Creates an action that fetches more results.

      Returns AsyncThunkAction<
          ExecuteSearchThunkReturn,
          void,
          AsyncThunkOptions<
              StateNeededByExecuteSearch,
              ClientThunkExtraArguments<SearchAPIClient, GeneratedAnswerAPIClient>,
          >,
      >

      A dispatchable action.

    • Creates an action that executes a search query to fetch a new page of results.

      Parameters

      • analyticsSearchAction: LegacySearchAction

        The analytics action to log after a successful query. See loadSearchAnalyticsActions for possible values.

      Returns AsyncThunkAction<
          ExecuteSearchThunkReturn,
          LegacySearchAction,
          AsyncThunkOptions<
              StateNeededByExecuteSearch,
              ClientThunkExtraArguments<SearchAPIClient, GeneratedAnswerAPIClient>,
          >,
      >

      A dispatchable action.

      const {logPagerNext} = loadSearchAnalyticsActions(engine);
      const {fetchPage} = loadSearchActions(engine);

      engine.dispatch(fetchPage(logPagerNext()));