Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AsciiDoc files #1097

Merged
merged 4 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Before you begin, a couple notes...
- Sign the [Contributor License Agreement](https://www.elastic.co/contributor-agreement/). We are not asking you to assign copyright to us, but to give us the right to distribute your code without restriction. We ask this of all contributors in order to assure our users of the origin and continuing existence of the code. You only need to sign the CLA once.
- Please write simple code and concise documentation, when appropriate.

**Contributing to the docs?** Refer to [docs/README.md](./docs/README.md).

## Running Search UI

### Codebase overview
Expand Down
17 changes: 17 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Working with the docs

The [Search UI docs](https://www.elastic.co/guide/en/search-ui/current/overview.html) are written in [AsciiDoc](https://github.com/elastic/docs?tab=readme-ov-file#asciidoc-guide) and are built using [elastic/docs](https://github.com/elastic/docs).

## Build the docs locally

Before building the docs locally make sure you have:

* Docker
* Python 3
* [elastic/docs](https://github.com/elastic/docs) cloned locally

Assuming your local copy of the elastic/docs repo is in the same repo as your local copy of this repo, run this command from inside your local copy of this repo:

```
../docs/build_docs --doc ./docs/index.asciidoc --chunk 3 --open
```
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