Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions docs/api-architecture.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[[api-architecture]]
= Architecture

++++
<titleabbrev>API reference</titleabbrev>
++++

// :keywords: architecture

[source,txt]
----
|
@elastic/react-search-ui | @elastic/search-ui
|
|
SearchProvider <--------------- SearchDriver
| | | |
State / | | | | State /
Actions | | | | Actions
| | | |
Components | | |
| | | |
v v | v
------------------------------------+----------------------------
| | |
v v v
Using Headless Usage Headless Usage outside
Components in React of React
----

The core is a separate, vanilla JS library which can be used for any JavaScript based implementation.

The Headless Core implements the functionality behind a search experience, but without its own view. It provides the underlying "state" and "actions" associated with that view. For instance, the core provides a `setSearchTerm` action, which can be used to save a `searchTerm` property in the state. Calling `setSearchTerm` using the value of an `<input>` will save the `searchTerm` to be used to build a query.

All of the Components in this library use the Headless Core under the hood. For instance, Search UI provides a `SearchBox` Component for collecting input from a user. But you are not restricted to using just that Component. Since Search UI lets you work directly with "state" and "actions", you could use any type of input you want! As long as your input or Component calls the Headless Core's `setSearchTerm` action, it will "just work". This gives you maximum flexibility over your experience if you need more than the Components in Search UI have to offer.

The `SearchProvider` is a React wrapper around the Headless Core, and makes state and actions available to Search UI
and in a React https://reactjs.org/docs/context.html[Context], and also via a
https://reactjs.org/docs/render-props.html[Render Prop].
87 changes: 87 additions & 0 deletions docs/api-connectors-app-search.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
[[api-connectors-app-search]]
= App Search Connector

++++
<titleabbrev>Connectors API</titleabbrev>
++++

// :keywords: app search connector

.Deprecation Notice
[IMPORTANT]
====
App Search connector for Search UI is deprecated and will no longer be
supported. Please migrate to <<tutorials-elasticsearch,Elasticsearch Connector>>
for continued support.
====

This Connector is used to connect Search UI to Elastic's https://www.elastic.co/cloud/app-search-service[App Search] API.

[discrete]
[[api-connectors-app-search-usage]]
== Usage

[source,shell]
----
npm install --save @elastic/search-ui-app-search-connector
----

[source,js]
----
import AppSearchAPIConnector from "@elastic/search-ui-app-search-connector";

const connector = new AppSearchAPIConnector({
searchKey: "search-371auk61r2bwqtdzocdgutmg",
engineName: "search-ui-examples",
endpointBase: "http://127.0.0.1:3002"
});
----

[discrete]
[[api-connectors-app-search-additional-options]]
=== Additional options

Additional options will be passed through to the underlying
https://github.com/elastic/app-search-javascript[APIclient]. Any valid parameter of the client can be used.

[source,js]
----
const connector = new AppSearchAPIConnector({
searchKey: "search-371auk61r2bwqtdzocdgutmg",
engineName: "search-ui-examples",
endpointBase: "http://127.0.0.1:3002",
cacheResponses: false
});
----

[discrete]
[[api-connectors-app-search-options]]
== Options

|===
| Param| Description

| searchKey
| Required. String. Credential found in your App Search Dashboard

| engineName
| Required. String. Engine to query, found in your App Search Dashboard

| endpointBase
| Required. String. Endpoint path, found in your App Search Dashboard

| cacheResponses
| Optional. Boolean. Default is true. By default, connector will keep an in browser memory result cache of previous requests.

| hostIdentifier
| Optional. Useful when proxying the Swiftype API or developing against a local API server.

| beforeSearchCall
| Optional. A hook to amend query options before the request is sent to the API in a query on an "onSearch" event.

| beforeAutocompleteResultsCall
| Optional. A hook to amend query options before the request is sent to the API in a "results" query on an "onAutocomplete" event.

| beforeAutocompleteSuggestionsCall
| Optional. A hook to amend query options before the request is sent to the API in a "suggestions" query on an "onAutocomplete" event.
|===
Loading