From c9b9f5c8ec1555cef7deb404b7571ec639db2ca1 Mon Sep 17 00:00:00 2001 From: Chris Penny Date: Wed, 21 Aug 2024 15:00:24 +1200 Subject: [PATCH] Add support for query suggestions (aka "did you mean") (#5) --- _config/config.yml | 2 ++ composer.json | 12 +----------- src/Service/Requests/QuerySuggestion.php | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 src/Service/Requests/QuerySuggestion.php diff --git a/_config/config.yml b/_config/config.yml index 3506d80..162f49b 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -22,6 +22,8 @@ SilverStripe\Core\Injector\Injector: class: SilverStripe\DiscovererBifrost\Service\Requests\Search Elastic\EnterpriseSearch\AppSearch\Request\LogClickthrough: class: SilverStripe\DiscovererBifrost\Service\Requests\ClickPost + Elastic\EnterpriseSearch\AppSearch\Request\QuerySuggestion: + class: SilverStripe\DiscovererBifrost\Service\Requests\QuerySuggestion SilverStripe\DiscovererElasticEnterprise\Service\SearchServiceAdaptor: prefix_env_var: 'BIFROST_ENGINE_PREFIX' diff --git a/composer.json b/composer.json index a03acba..9112a44 100644 --- a/composer.json +++ b/composer.json @@ -23,23 +23,13 @@ "require": { "php": "^8.1", "silverstripe/framework": "^5", - "silverstripe/silverstripe-discoverer-elastic-enterprise": "^1", + "silverstripe/silverstripe-discoverer-elastic-enterprise": "^1.1", "guzzlehttp/guzzle": "^7.5" }, "require-dev": { "phpunit/phpunit": "^9.6.19", "slevomat/coding-standard": "^8.8" }, - "repositories": [ - { - "type": "vcs", - "url": "git@github.com:silverstripeltd/silverstripe-discoverer.git" - }, - { - "type": "vcs", - "url": "git@github.com:silverstripeltd/silverstripe-discoverer-elastic-enterprise.git" - } - ], "autoload": { "psr-4": { "SilverStripe\\DiscovererBifrost\\": "src/", diff --git a/src/Service/Requests/QuerySuggestion.php b/src/Service/Requests/QuerySuggestion.php new file mode 100644 index 0000000..797e2a7 --- /dev/null +++ b/src/Service/Requests/QuerySuggestion.php @@ -0,0 +1,18 @@ +path = sprintf('/api/v1/%s/query_suggestion', $engineName); + } + +}