-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a699df7
Showing
15 changed files
with
4,717 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/asset/vendor | ||
/build | ||
/language/debug.po | ||
/language/debug.mo | ||
/language/chef.po | ||
/language/chef.mo | ||
/node_modules | ||
/vendor | ||
.sass-cache/ | ||
.bundle | ||
.DS_Store | ||
.php_cs.cache | ||
composer.phar | ||
debug.log | ||
Untitled-1.md |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace TypesenseSearch; | ||
|
||
if (!class_exists(\Generic\AbstractModule::class)) { | ||
require file_exists(dirname(__DIR__) . '/Generic/AbstractModule.php') | ||
? dirname(__DIR__) . '/Generic/AbstractModule.php' | ||
: __DIR__ . '/src/Generic/AbstractModule.php'; | ||
} | ||
|
||
use Generic\AbstractModule; | ||
// use Laminas\EventManager\Event; | ||
use Laminas\Mvc\MvcEvent; | ||
// use Laminas\EventManager\SharedEventManagerInterface; | ||
use Omeka\Module\Exception\ModuleCannotInstallException; | ||
|
||
|
||
class Module extends AbstractModule | ||
{ | ||
const NAMESPACE = __NAMESPACE__; | ||
|
||
public function getConfig() | ||
{ | ||
return include __DIR__ . '/config/module.config.php'; | ||
} | ||
|
||
public function onBootstrap(MvcEvent $event): void | ||
{ | ||
parent::onBootstrap($event); | ||
|
||
// load vendor sdk (eg., typesense-php) | ||
require_once __DIR__ . '/vendor/autoload.php'; | ||
} | ||
|
||
protected function preInstall(): void | ||
{ | ||
if (!file_exists(__DIR__ . '/vendor/autoload.php')) { | ||
$t = $this->getServiceLocator()->get('MvcTranslator'); | ||
throw new ModuleCannotInstallException( | ||
$t->translate('The Typesense library should be installed.') // @translate | ||
. ' ' . $t->translate('See module’s installation documentation.') // @translate | ||
); | ||
} | ||
} | ||
|
||
// public function attachListeners(SharedEventManagerInterface $sharedEventManager) | ||
// { | ||
// $sharedEventManager->attach( | ||
// '*', | ||
// 'view.layout', | ||
// [$this, 'addTypesense'] | ||
// ); | ||
// } | ||
|
||
// public function addTypesense(Event $event): void | ||
// { | ||
// $view = $event->getTarget(); | ||
// $assetUrl = $view->plugin('assetUrl'); | ||
// $view->headScript() | ||
// ->appendFile($assetUrl('js/typesense.min.js', 'TypesenseSearch'), 'text/javascript', ['defer' => 'defer']); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Omeka-s Typesense Module | ||
|
||
This module allows you to use Typesense as the search engine for your Omeka-s site. Typesense is an open-source, typo-tolerant search engine that delivers fast and relevant search results. | ||
|
||
## Installation | ||
|
||
* Install the Typesense server. Follow the instructions at https://docs.typesense.org/getting-started/installation/ to install Typesense. | ||
|
||
* Install the Typesense PHP client library by running the following command: | ||
|
||
```bash | ||
composer require typesense/typesense | ||
``` | ||
|
||
* Install this module by copying the Typesense directory into the modules directory of your Omeka-s installation. | ||
|
||
* Enable the module from the Admin → Modules menu. | ||
|
||
* Configure the module by going to the Configure form (located at /admin/module/Typesense). Enter the host and API key for your Typesense server. | ||
|
||
## Configuration | ||
|
||
The configuration form for this module allows you to specify the following options: | ||
|
||
* Typesense Host: The hostname of your Typesense server. | ||
|
||
* API Key: The API key for your Typesense server. This can be found in the Typesense Admin Dashboard. | ||
|
||
## Usage | ||
|
||
Once the module is installed and configured, search on your Omeka-s site will be powered by Typesense. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"require": { | ||
"laminas/laminas-mvc": "^3.3", | ||
"php-http/curl-client": "^2.2", | ||
"typesense/typesense-php": "^4.8", | ||
"symfony/http-client": "^5.4" | ||
} | ||
} |
Oops, something went wrong.