helsingborg-stad / algolia-index
Index wordpress site content to algolia.
Installs: 13 773
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 7
Forks: 1
Open Issues: 1
Type:wordpress-plugin
Requires
Requires (Dev)
- php-stubs/wordpress-tests-stubs: ^6.1
- phpunit/phpunit: ^9.6
- yoast/phpunit-polyfills: ^1.0
- dev-master
- dev-main
- 3.1.9
- 3.1.8
- 3.1.7
- 3.1.6
- 3.1.5
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 2.0.0
- 1.9.4
- 1.9.3
- 1.9.2
- 1.9.1
- 1.9.0
- 1.8.11
- 1.8.10
- 1.8.9
- 1.8.8
- 1.8.7
- 1.8.6
- 1.8.5
- 1.8.4
- 1.8.3
- 1.8.2
- 1.8.1
- 1.8.0
- 1.7.4
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.0
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-feat/adding-alt-text
- dev-webpack-fix
- dev-fix/malformed-utf8-esape
- dev-fix/indexing-image-size
- dev-perf/wp_post_vs_id
- dev-feature/remove-short-codes-from-content
- dev-feature/index-custom-taxonomies
- dev-fix/guzzlehttp-package-security
- dev-fix/algolia-global-post-missing-CU-865c7g7c0
- dev-feature/test
- dev-feature/gutenberg-excerpt
- dev-3.0/feat-php-update
- dev-feature/remove-non-published
- dev-fix/Image-quality
This package is auto-updated.
Last update: 2024-12-20 11:45:22 UTC
README
Manages algolia index (with ms-support and mixed indexes). This is intended to be used by delvelopers. This plugin provide the following set of features:
- Replaces algolia search on the front-end with algolia.
- Index all public searchable posts on post update or creation.
- WpCLI jobs to bulk index all posts on the site.
- Support mixed indices (multiple wordpress sites in the same index).
- Large record splitting (content field).
- Implements "needs update" check before querying algolia, to save costly updates. The functionality is not implemented on split records.
Installation
- Install with: "composer require helsingborg-stad/algolia-index"
- Run composer install inside the plugin.
- Add required definitions of constants.
- Run wp-cli job "wp algolia-index build"
Constants
- define('ALGOLIAINDEX_APPLICATION_ID', 'ALGOLIAAPPID'); - REQUIRED
- define('ALGOLIAINDEX_API_KEY', 'ALGOLIAAPIKEY'); - REQUIRED
- define('ALGOLIAINDEX_INDEX_NAME', 'INDEX'); - OPTIONAL
- define('ALGOLIAINDEX_PUBLIC_API_KEY', 'INDEX'); - OPTIONAL, Required by js searchpage addon
Filters
- AlgoliaIndex/ShouldIndex: Add more rules to the should index function (removal not possible).
- AlgoliaIndex/Record: What data to send to algolia.
- AlgoliaIndex/Compare: What fields to compare to determine if a post has been updated.
- AlgoliaIndex/SearchableAttributes: What attriubutes in record to be searchable.
- AlgoliaIndex/GeneratedIndexName: Filter for the autogenerated index name.
- AlgoliaIndex/RecordToLarge: Turn off record to large repoting by returning false. To disable record splitting. Only compatbile with business plans, not reccommended!.
- AlgoliaIndex/IndexablePostTypes: What posttypes to index.
- AlgoliaIndex/HitsPerPage: Number of hits per page.
- AlgoliaIndex/AttributesToSnippet: What attributes to snippet.
- AlgoliaIndex/SnippetEllipsisText: Suffix for snippet.
- AlgoliaIndex/BackendSearchActive: Send false to disable backend search.
- AlgoliaIndex/IndexablePostStatuses: What post statuses to allow for index.
Actions
- AlgoliaIndex/IndexPostId: Trigger reindex on a post id.
- AlgoliaIndex/SendSettings: Send settings.
WP CLI
- wp algolia-index build: Index all pages/posts on site.
WP CLI Arguments
- To clear index* before build, add flag --clearindex=true.
- To send required search configuration before build, add flag --settings=true.
Example
wp site list --field=url --public=1 --archived=0 --deleted=0 --allow-root | xargs -n1 -I % wp algolia-index build --settings=true --url=% --allow-root
- This action is not fully compatible with multiple sites in one shared index! Sites that share the same index will be cleared but not reindexed.