Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 8.9
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Aug 21, 2023
2 parents e0bdce8 + 0824eff commit 4fd800b
Show file tree
Hide file tree
Showing 24 changed files with 98 additions and 48 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Use PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
Expand All @@ -27,7 +27,7 @@ jobs:

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<p align="center"><img src="https://github.com/elastic/enterprise-search-php/blob/master/logo-enterprise-search.png?raw=true" alt="Elastic Enterprise Search Logo"></p>

# Elastic Enterprise Search Client for PHP

> A first-party PHP client to interface with [Elastic Enterpise Search](https://www.elastic.co/enterprise-search)
including [Elastic App Search](https://www.elastic.co/app-search/) and [Elastic Workplace Search](https://www.elastic.co/workplace-search).
Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,10 @@
"phpstan": [
"vendor/bin/phpstan analyse src tests"
]
},
"config": {
"allow-plugins": {
"php-http/discovery": true
}
}
}
4 changes: 2 additions & 2 deletions docs/guide/app-search-api.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ $result = $this->appSearch->search(
print_r($result->asArray());
----------------------------

=== Elasticsearch Search API (beta)
=== Elasticsearch Search API

This is a beta feature that can be used to search using the Elasticsearch API.
Using this API you can search directly in App Search using the https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html[search API] of Elasticsearch.
You can use the `Request\SearchEsSearch` to perform a https://www.elastic.co/guide/en/elasticsearch/reference/current/search-your-data.html[search query]
using the Elasticsearch API.

Expand Down
4 changes: 3 additions & 1 deletion src/AppSearch/Endpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ public function getAdaptiveRelevanceSuggestions(Request\GetAdaptiveRelevanceSugg
*
* @see https://www.elastic.co/guide/en/app-search/current/adaptive-relevance-api-reference.html#adaptive-relevance-api-post-engine-adaptive-relevance-suggestions-update-process-refresh
*/
public function refreshAdaptiveRelevanceUpdateProcess(Request\RefreshAdaptiveRelevanceUpdateProcess $request): Response
public function refreshAdaptiveRelevanceUpdateProcess(
Request\RefreshAdaptiveRelevanceUpdateProcess $request
): Response
{
return new Response($this->transport->sendRequest($request->getRequest()));
}
Expand Down
8 changes: 6 additions & 2 deletions src/AppSearch/Request/PutCrawlerEntryPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ class PutCrawlerEntryPoint extends Request
* @param string $entryPointId Crawler Entry Point identifier
* @param EntryPoint $entry_point
*/
public function __construct(string $engineName, string $domainId, string $entryPointId, EntryPoint $entry_point = null)
{
public function __construct(
string $engineName,
string $domainId,
string $entryPointId,
EntryPoint $entry_point = null,
) {
$this->method = 'PUT';
$engine_name = urlencode($engineName);
$domain_id = urlencode($domainId);
Expand Down
4 changes: 2 additions & 2 deletions src/AppSearch/Schema/CrawlRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class CrawlRequest
public string $type;
public string $status;
public string $created_at;
public string $begun_at;
public string $completed_at;
public ?string $begun_at;
public ?string $completed_at;


public function __construct(string $id, string $status, string $created_at, ?string $begun_at, ?string $completed_at)
Expand Down
4 changes: 2 additions & 2 deletions src/AppSearch/Schema/CrawlRequestStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class CrawlRequestStatus
public string $id;
public string $status;
public string $created_at;
public string $updated_at;
public string $begun_at;
public ?string $updated_at;
public ?string $begun_at;
public EngineIdAndName $engine;


Expand Down
4 changes: 2 additions & 2 deletions src/AppSearch/Schema/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
#[\AllowDynamicProperties]
class Document
{
public string $id;
public ?string $id;


public function __construct(string $id)
public function __construct(?string $id = null)
{
$this->id = $id;
}
Expand Down
2 changes: 1 addition & 1 deletion src/AppSearch/Schema/Engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Engine
public string $name;

/** Engine language (null for universal) */
public string $language;
public ?string $language;
public string $type;
public array $source_engines;
public int $document_count;
Expand Down
4 changes: 2 additions & 2 deletions src/AppSearch/Schema/ExtractUrlIndexingResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
*/
class ExtractUrlIndexingResults
{
public string $document_id;
public object $document_fields;
public ?string $document_id;
public ?object $document_fields;


public function __construct(?string $document_id, ?object $document_fields)
Expand Down
4 changes: 2 additions & 2 deletions src/AppSearch/Schema/ProcessCrawl.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ class ProcessCrawl
public array $domains;
public bool $process_all_domains;
public string $created_at;
public string $begun_at;
public string $completed_at;
public ?string $begun_at;
public ?string $completed_at;
}
2 changes: 1 addition & 1 deletion src/AppSearch/Schema/TraceUrlEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TraceUrlEvent
{
public string $timestamp;
public string $event_id;
public string $message;
public ?string $message;


public function __construct(string $timestamp, string $event_id, ?string $message)
Expand Down
1 change: 0 additions & 1 deletion src/EnterpriseSearch/Schema/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
/**
* @generated This file is generated, please do not edit
*/
#[\AllowDynamicProperties]
class Page
{
public int $current;
Expand Down
2 changes: 1 addition & 1 deletion src/EnterpriseSearch/Schema/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Version
{
public string $number;
public string $build_hash;
public string $build_date;
public ?string $build_date;


public function __construct(?string $build_date, string $build_hash, string $number)
Expand Down
2 changes: 2 additions & 0 deletions src/Response/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class Response implements ResponseInterface, ArrayAccess

protected string $asString;

protected MessageResponseInterface $response;

/**
* @throws ClientErrorResponseException if status code 4xx
* @throws ServerErrorResponseException if status code 5xx
Expand Down
2 changes: 1 addition & 1 deletion src/WorkplaceSearch/Schema/ContentSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ContentSource
public int $document_count;

/** The date/time when documents were last indexed into this Content Source. This may be "null" if documents have not yet been indexed. Note, this field is not applicable to Remote Content Sources. */
public string $last_indexed_at;
public ?string $last_indexed_at;


/**
Expand Down
12 changes: 6 additions & 6 deletions src/WorkplaceSearch/Schema/ContentSourceDisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class ContentSourceDisplay
public string $title_field;
public string $url_field;
public string $color;
public string $description_field;
public string $subtitle_field;
public string $type_field;
public string $media_type_field;
public string $created_by_field;
public string $updated_by_field;
public ?string $description_field;
public ?string $subtitle_field;
public ?string $type_field;
public ?string $media_type_field;
public ?string $created_by_field;
public ?string $updated_by_field;
public array $detail_fields;


Expand Down
4 changes: 2 additions & 2 deletions src/WorkplaceSearch/Schema/ContentSourceFacet.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class ContentSourceFacet
{
public string $field;
public bool $enabled;
public string $display_name;
public string $transform;
public ?string $display_name;
public ?string $transform;


public function __construct(string $field, bool $enabled)
Expand Down
4 changes: 2 additions & 2 deletions src/WorkplaceSearch/Schema/ContentSourceIconDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
*/
class ContentSourceIconDefinition
{
public string $main_icon;
public string $alt_icon;
public ?string $main_icon;
public ?string $alt_icon;
}
2 changes: 1 addition & 1 deletion src/WorkplaceSearch/Schema/ContentSourceIndexingRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ class ContentSourceIndexingRule
public string $exclude;
public string $include;
public string $filter_type;
public array $fields;
public ?array $fields;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class ExternalIdentityUpdateDefinition
public string $external_user_id;

/** A list of external user properties, where each property is an object with an attribute_name and attribute_value. */
public array $external_user_properties;
public ?array $external_user_properties;

/** A list of user permissions. */
public array $permissions;
public ?array $permissions;


public function __construct(string $external_user_id)
Expand Down
9 changes: 7 additions & 2 deletions src/WorkplaceSearch/Schema/SyncJobDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ class SyncJobDefinition
public string $last_updated_at;


public function __construct(string $id, string $job_type, string $status, string $created_at, string $last_updated_at)
{
public function __construct(
string $id,
string $job_type,
string $status,
string $created_at,
string $last_updated_at,
) {
$this->id = $id;
if (!in_array($job_type, ['full','incremental','delete','permissions'])) {
throw new InvalidArgumentException('The $job_type parameter must be one of these values: full,incremental,delete,permissions');
Expand Down
Loading

0 comments on commit 4fd800b

Please sign in to comment.