### What? This PR aims to add reindexing capabilities to `plugin-search` to allow users to reindex entire searchable collections on demand. ### Why? As it stands, end users must either perform document reindexing manually one-by-one or via bulk operations. Both of these approaches are undesirable because they result in new versions being published on existing documents. Consider the case when `plugin-search` is only added _after_ the project has started and documents have been added to existing collections. It would be nice if users could simply click a button, choose the searchable collections to reindex, and have the custom endpoint handle the rest. ### How? This PR adds on to the existing plugin configuration, creating a custom endpoint and a custom `beforeListTable` component in the form of a popup button. Upon clicking the button, a dropdown/popup is opened with options to select which collection to reindex, as well as a useful `All Collections` option to run reindexing on all configured search collections. It also adds a `reindexBatchSize` option in the config to allow users to specify in what quantity to batch documents to sync with search. Big shoutout to @paulpopus & @r1tsuu for the triple-A level support on this one! Fixes #8902 See it in action: https://github.com/user-attachments/assets/ee8dd68c-ea89-49cd-adc3-151973eea28b Notes: - Traditionally these kinds of long-running tasks would be better suited for a job. However, given how many users enjoy deploying to serverless environments, it would be problematic to offer this feature exclusive to jobs queues. I thought a significant amount about this and decided it would be best to ship the feature as-is with the intention of creating an opt-in method to use job queues in the future if/when this gets merged. - In my testing, the collection description somehow started to appear in the document views after the on-demand RSC merge. I haven't reproduced this, but this PR has an example of that problem. Super strange. --------- Co-authored-by: Sasha <64744993+r1tsuu@users.noreply.github.com> Co-authored-by: Paul Popus <paul@nouance.io>
103 lines
2.8 KiB
JSON
103 lines
2.8 KiB
JSON
{
|
|
"name": "@payloadcms/plugin-search",
|
|
"version": "3.1.1",
|
|
"description": "Search plugin for Payload",
|
|
"keywords": [
|
|
"payload",
|
|
"cms",
|
|
"plugin",
|
|
"typescript",
|
|
"react",
|
|
"search",
|
|
"algolia"
|
|
],
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/payloadcms/payload.git",
|
|
"directory": "packages/plugin-search"
|
|
},
|
|
"license": "MIT",
|
|
"author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
|
|
"maintainers": [
|
|
{
|
|
"name": "Payload",
|
|
"email": "info@payloadcms.com",
|
|
"url": "https://payloadcms.com"
|
|
}
|
|
],
|
|
"type": "module",
|
|
"exports": {
|
|
".": {
|
|
"types": "./src/index.ts",
|
|
"default": "./src/index.ts"
|
|
},
|
|
"./types": {
|
|
"import": "./src/exports/types.ts",
|
|
"types": "./src/exports/types.ts",
|
|
"default": "./src/exports/types.ts"
|
|
},
|
|
"./client": {
|
|
"import": "./src/exports/client.ts",
|
|
"types": "./src/exports/client.ts",
|
|
"default": "./src/exports/client.ts"
|
|
}
|
|
},
|
|
"main": "./src/index.ts",
|
|
"types": "./src/index.ts",
|
|
"files": [
|
|
"dist"
|
|
],
|
|
"scripts": {
|
|
"build": "pnpm build:types && pnpm build:swc",
|
|
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
|
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
"lint": "eslint .",
|
|
"lint:fix": "eslint . --fix",
|
|
"prepublishOnly": "pnpm clean && pnpm turbo build",
|
|
"test": "echo \"Error: no tests specified\""
|
|
},
|
|
"dependencies": {
|
|
"@payloadcms/next": "workspace:*",
|
|
"@payloadcms/ui": "workspace:*"
|
|
},
|
|
"devDependencies": {
|
|
"@payloadcms/eslint-config": "workspace:*",
|
|
"@types/react": "npm:types-react@19.0.0-rc.1",
|
|
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",
|
|
"payload": "workspace:*"
|
|
},
|
|
"peerDependencies": {
|
|
"payload": "workspace:*",
|
|
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020"
|
|
},
|
|
"publishConfig": {
|
|
"exports": {
|
|
".": {
|
|
"import": "./dist/index.js",
|
|
"types": "./dist/index.d.ts",
|
|
"default": "./dist/index.js"
|
|
},
|
|
"./types": {
|
|
"import": "./dist/exports/types.js",
|
|
"types": "./dist/exports/types.d.ts",
|
|
"default": "./dist/exports/types.js"
|
|
},
|
|
"./client": {
|
|
"import": "./dist/exports/client.js",
|
|
"types": "./dist/exports/client.d.ts",
|
|
"default": "./dist/exports/client.js"
|
|
}
|
|
},
|
|
"main": "./dist/index.js",
|
|
"registry": "https://registry.npmjs.org/",
|
|
"types": "./dist/index.d.ts"
|
|
},
|
|
"homepage:": "https://payloadcms.com",
|
|
"overrides": {
|
|
"@types/react": "npm:types-react@19.0.0-rc.1",
|
|
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1"
|
|
}
|
|
}
|