percipiolondon / craft-typesense
Craft Plugin that synchronises with Typesense
Installs: 2 059
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 3
Forks: 1
Open Issues: 7
Type:craft-plugin
Requires
- php: ^8.0.2
- craftcms/cms: ^4.0.0
- illuminate/collections: ^9.10.0
- nystudio107/craft-plugin-vite: ^4.0.0
- php-http/guzzle7-adapter: ^1.0.0
- typesense/typesense-php: ^4.7.0
Requires (Dev)
- codeception/codeception: ^5.0
- craftcms/phpstan: dev-main
- vlucas/phpdotenv: ^3.0
- dev-develop-v4
- 5.0.0
- v4.x-dev
- 4.0.2
- 4.0.1
- 4.0.0
- 4.0.0-beta.3
- 4.0.0-beta.2
- 4.0.0-beta.1
- v3.x-dev
- 1.0.0-beta.14
- 1.0.0-beta.13
- 1.0.0-beta.12
- 1.0.0-beta.11
- 1.0.0-beta.10
- 1.0.0-beta.9
- 1.0.0-beta.8
- 1.0.0-beta.7
- 1.0.0-beta.6
- 1.0.0-beta.5
- 1.0.0-beta.4
- 1.0.0-beta.3
- 1.0.0-beta.2
- 1.0.0-beta.1
- dev-develop
- dev-dependabot/npm_and_yarn/docs/http-cache-semantics-4.1.1
- dev-renovate/configure
- dev-dependabot/npm_and_yarn/buildchain/minimist-1.2.8
- dev-dependabot/npm_and_yarn/buildchain/vite-2.9.13
- dev-feature/connection-improvements
- dev-feature/cluster
- dev-feature/config-collection-documents
- dev-dependabot/npm_and_yarn/buildchain/follow-redirects-1.14.9
- dev-feature/settings
This package is auto-updated.
Last update: 2023-11-22 20:07:06 UTC
README
Craft Plugin that synchronises with Typesense. Visit our Demo to see the Craft Typesense plugin in action. You can read our docs to setup your project. Need more help with the setup? Follow our blogpost "Setup the Typsesense plugin with Typesense Cloud with javascript"
Requirements
This plugin requires Craft CMS 4.0.0 or later.
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Then tell Composer to load the plugin:
composer require percipiolondon/typesense
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for Typesense.
Typesense Overview
After setting up the config file on which indexes you want to create, you start right away after add / edit / delete elements. If you want to sync all of them, you can go to the Collections within the Typesense section in the control panel and sync all of them.
Configuring Typesense
After copy and paste the config.php into your own config folder and name it typesense.php. Add your index, the fields you want to attach and the query accordingly to start from. Example below on a blog section
'collections' => [ // CONTENT \percipiolondon\typesense\TypesenseCollectionIndex::create( [ 'name' => 'blog', 'section' => 'blog.blog', //section handle + entry type handle 'fields' => [ [ 'name' => 'title', 'type' => 'string', 'sort' => true, ], [ 'name' => 'slug', 'type' => 'string', 'facet' => true ], [ 'name' => 'handle', 'type' => 'string', ], [ 'name' => 'post_date_timestamp', 'type' => 'int32', ], ], 'default_sorting_field' => 'post_date_timestamp', // can only be an integer, 'resolver' => static function(\craft\elements\Entry $entry) { return [ 'id' => (string)$entry->id, 'title' => $entry->title, 'handle' => $entry->section->handle, 'slug' => $entry->slug, 'post_date_timestamp' => (int)$entry->postDate->format('U') ]; } ] ) ->elementType(\craft\elements\Entry::class) ->criteria(function(\craft\elements\db\EntryQuery $query) { return $query->section('blog'); }), ]
By default, Craft CMS doesn't fire an event after updating a status when a scheduled post goes out. Therefore we provide a console command that you can attach to your cron jobs. The command checks if there are entries that are scheduled to go out today and if they haven't been updated after that date
./craft typesense/default/update-scheduled-posts
Using Typesense
-Insert text here-
Typesense Roadmap
Some things to do, and ideas for potential features:
- Release it
Brought to you by percipiolondon