diff --git a/docs/site-search.md b/docs/site-search.md
index 6a3331a..60748c2 100644
--- a/docs/site-search.md
+++ b/docs/site-search.md
@@ -36,7 +36,7 @@ const client = buildClient({ apiToken: 'YOUR_API_TOKEN' });
const { state, error, data } = useSiteSearch({
client,
- buildTriggerId: '7497',
+ searchIndexId: '7497',
// optional: by default fuzzy-search is not active
fuzzySearch: true,
// optional: you can omit it you only have one locale, or you want to find results in every locale
@@ -60,7 +60,7 @@ For a complete walk-through, please refer to the [DatoCMS Site Search documentat
| prop | type | required | description | default |
| ------------------- | ------------------------------------------------------------------ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------- |
| client | CMA Client instance | :white_check_mark: | [DatoCMS CMA Client](https://www.datocms.com/docs/content-management-api/using-the-nodejs-clients) instance | |
-| buildTriggerId | string | :white_check_mark: | The [ID of the build trigger](https://www.datocms.com/docs/site-search/base-integration#performing-searches) to use to find search results | |
+| searchIndexId | string | :white_check_mark: | The [ID of the the search index](https://www.datocms.com/docs/site-search/base-integration#performing-searches) to use to find search results | |
| fuzzySearch | boolean | :x: | Whether fuzzy-search is active or not. When active, it will also find strings that approximately match the query provided. | false |
| resultsPerPage | number | :x: | The number of search results to show per page | 8 |
| highlightMatch | (match, key, context: 'title' \| 'bodyExcerpt') => React.ReactNode | :x: | A function specifying how to highlight the part of page title/content that matches the query | (text, key) => (<mark key={key}>{text}</mark>) |
@@ -127,7 +127,7 @@ function App() {
) : (
{text}
),
- buildTriggerId: '7497',
+ searchIndexId: '7497',
resultsPerPage: 10,
});
diff --git a/examples/package-lock.json b/examples/package-lock.json
index 44dea00..aecda72 100644
--- a/examples/package-lock.json
+++ b/examples/package-lock.json
@@ -19,9 +19,9 @@
}
},
"node_modules/@0no-co/graphql.web": {
- "version": "1.0.12",
- "resolved": "https://registry.npmjs.org/@0no-co/graphql.web/-/graphql.web-1.0.12.tgz",
- "integrity": "sha512-BTDjjsV/zSPy5fqItwm+KWUfh9CSe9tTtR6rCB72ddtkAxdcHbi4Ir4r/L1Et4lyxmL+i7Rb3m9sjLLi9tYrzA==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@0no-co/graphql.web/-/graphql.web-1.2.0.tgz",
+ "integrity": "sha512-/1iHy9TTr63gE1YcR5idjx8UREz1s0kFhydf3bBLCXyqjhkIc6igAzTOx3zPifCwFR87tsh/4Pa9cNts6d2otw==",
"license": "MIT",
"peerDependencies": {
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
@@ -3789,37 +3789,48 @@
"resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz",
"integrity": "sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A=="
},
+ "node_modules/@mux/mux-data-google-ima": {
+ "version": "0.2.8",
+ "resolved": "https://registry.npmjs.org/@mux/mux-data-google-ima/-/mux-data-google-ima-0.2.8.tgz",
+ "integrity": "sha512-0ZEkHdcZ6bS8QtcjFcoJeZxJTpX7qRIledf4q1trMWPznugvtajCjCM2kieK/pzkZj1JM6liDRFs1PJSfVUs2A==",
+ "license": "MIT",
+ "dependencies": {
+ "mux-embed": "5.9.0"
+ }
+ },
"node_modules/@mux/mux-player": {
- "version": "2.5.0",
- "resolved": "https://registry.npmjs.org/@mux/mux-player/-/mux-player-2.5.0.tgz",
- "integrity": "sha512-Tps+GsWlUuzJHwZpHHb/47OGKF7MXr6ca2RRL/S/7TRX5Y45qROoZiqZ859AxZW2UPcy7chFR6LROd4X7PSMQQ==",
+ "version": "3.9.2",
+ "resolved": "https://registry.npmjs.org/@mux/mux-player/-/mux-player-3.9.2.tgz",
+ "integrity": "sha512-QK7y1fYoxR2XHc5GO2owfpClsb94hN7k+bTNKp2+oolTAfc2PT1ygGVDq7RFUPz6VNTiZUBvDlRn62CylfxTFw==",
"license": "MIT",
"dependencies": {
- "@mux/mux-video": "0.18.0",
- "@mux/playback-core": "0.23.0",
- "media-chrome": "~3.2.1"
+ "@mux/mux-video": "0.28.2",
+ "@mux/playback-core": "0.31.4",
+ "media-chrome": "~4.16.1",
+ "player.style": "^0.3.0"
}
},
"node_modules/@mux/mux-video": {
- "version": "0.18.0",
- "resolved": "https://registry.npmjs.org/@mux/mux-video/-/mux-video-0.18.0.tgz",
- "integrity": "sha512-uRheOAEe47k4nadoH/q/5/sfgd1amr6OSesh1yTQPDtAICIy8zCOHyLLOCaJl7vVZxw9/JRQuwO6MwjzjHhdng==",
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@mux/mux-video/-/mux-video-0.28.2.tgz",
+ "integrity": "sha512-+ij1EOI7Tx2zYAzIXAIbZJzxqISmIIz3f7aE/R5JFt9dcPxCNIN6/iXGJikiD1JQ4S3T7Mco8bHXaf1S0CJbIQ==",
"license": "MIT",
"dependencies": {
- "@mux/playback-core": "0.23.0",
- "castable-video": "~1.0.6",
- "custom-media-element": "~1.2.3",
- "media-tracks": "~0.3.0"
+ "@mux/mux-data-google-ima": "0.2.8",
+ "@mux/playback-core": "0.31.4",
+ "castable-video": "~1.1.11",
+ "custom-media-element": "~1.4.5",
+ "media-tracks": "~0.3.4"
}
},
"node_modules/@mux/playback-core": {
- "version": "0.23.0",
- "resolved": "https://registry.npmjs.org/@mux/playback-core/-/playback-core-0.23.0.tgz",
- "integrity": "sha512-7MX5xnJ+rFReVDAWKEwHqnfOyQkX+dzYysrTLAy0L1xJMsIhMhAD+wwvkDC/rRgtha5jHF863GCwrJAHmnxSCA==",
+ "version": "0.31.4",
+ "resolved": "https://registry.npmjs.org/@mux/playback-core/-/playback-core-0.31.4.tgz",
+ "integrity": "sha512-qQrNAAdJ7vjr1XEObE1hOUmuYngk/fjwmtYhpzkX4jJZwUC8I0rHjeFv7LXuCQD1D/mYJlWEpuyA0gPd6Y2eQw==",
"license": "MIT",
"dependencies": {
- "hls.js": "~1.5.8",
- "mux-embed": "~5.2.0"
+ "hls.js": "~1.6.15",
+ "mux-embed": "^5.8.3"
}
},
"node_modules/@nicolo-ribaudo/eslint-scope-5-internals": {
@@ -6114,19 +6125,22 @@
}
},
"node_modules/castable-video": {
- "version": "1.0.10",
- "resolved": "https://registry.npmjs.org/castable-video/-/castable-video-1.0.10.tgz",
- "integrity": "sha512-tJgUv+8/zE191y8EKojvB0eKIyKA9obIttd6Wpdm6x2qBmuwZ7wDgzVCSmf5cN2v9jBiuu0s7O5poz8a8cFX/w==",
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/castable-video/-/castable-video-1.1.11.tgz",
+ "integrity": "sha512-LCRTK6oe7SB1SiUQFzZCo6D6gcEzijqBTVIuj3smKpQdesXM18QTbCVqWgh9MfOeQgTx/i9ji5jGcdqNPeWg2g==",
"license": "MIT",
"dependencies": {
- "custom-media-element": "~1.3.2"
+ "custom-media-element": "~1.4.5"
}
},
- "node_modules/castable-video/node_modules/custom-media-element": {
- "version": "1.3.3",
- "resolved": "https://registry.npmjs.org/custom-media-element/-/custom-media-element-1.3.3.tgz",
- "integrity": "sha512-5Tenv3iLP8ZiLHcT0qSyfDPrqzkCMxczeLY7cTndbsMF7EkVgL/74a6hxNrn/F6RuD74TLK6R2r0GsmntTTtRg==",
- "license": "MIT"
+ "node_modules/ce-la-react": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/ce-la-react/-/ce-la-react-0.3.2.tgz",
+ "integrity": "sha512-QJ6k4lOD/btI08xG8jBPxRCGXvCnusGGkTsiXk0u3NqUu/W+BXRnFD4PYjwtqh8AWmGa5LDbGk0fLQsqr0nSMA==",
+ "license": "BSD-3-Clause",
+ "peerDependencies": {
+ "react": ">=17.0.0"
+ }
},
"node_modules/chalk": {
"version": "2.4.2",
@@ -6924,9 +6938,9 @@
"integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg=="
},
"node_modules/custom-media-element": {
- "version": "1.2.3",
- "resolved": "https://registry.npmjs.org/custom-media-element/-/custom-media-element-1.2.3.tgz",
- "integrity": "sha512-xr9Hbrslkjm1fapJP5hL98pySeZmNepBSefQS/XTxynamqPTfRBK5MnhReMOiAj8xvJApVPrVnlYxIrknay8jg==",
+ "version": "1.4.5",
+ "resolved": "https://registry.npmjs.org/custom-media-element/-/custom-media-element-1.4.5.tgz",
+ "integrity": "sha512-cjrsQufETwxjvwZbYbKBCJNvmQ2++G9AvT45zDi7NXL9k2PdVcs2h0jQz96J6G4TMKRCcEsoJ+QTgQD00Igtjw==",
"license": "MIT"
},
"node_modules/damerau-levenshtein": {
@@ -6957,18 +6971,18 @@
}
},
"node_modules/datocms-structured-text-generic-html-renderer": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/datocms-structured-text-generic-html-renderer/-/datocms-structured-text-generic-html-renderer-4.0.2.tgz",
- "integrity": "sha512-yoCLQBWpIUbjbAXpo57o23OGtR/XsXcJAti/rcqZVJSQEtFxOowMnT1t3/QGhAfmIU1/61nFClxzEBivJw3C6Q==",
+ "version": "5.1.6",
+ "resolved": "https://registry.npmjs.org/datocms-structured-text-generic-html-renderer/-/datocms-structured-text-generic-html-renderer-5.1.6.tgz",
+ "integrity": "sha512-1qaxEoyPKhFm+P4kbV0XuKUbTMxrgMILCW6+3xJKeIaufrnqQwSh+qL1//0LtNo7eXxv3Sc8gKCGqw5aF6JTFQ==",
"license": "MIT",
"dependencies": {
- "datocms-structured-text-utils": "^4.0.1"
+ "datocms-structured-text-utils": "^5.1.6"
}
},
"node_modules/datocms-structured-text-utils": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/datocms-structured-text-utils/-/datocms-structured-text-utils-4.0.1.tgz",
- "integrity": "sha512-2rK4bZfzKpdKw2AZhnnD043QkGOUaJDOUGPrQHo5w4hvU4jTBGGxoaTg4KIb3Q5Yo+XUFvreb+U0+86xdh7I+Q==",
+ "version": "5.1.6",
+ "resolved": "https://registry.npmjs.org/datocms-structured-text-utils/-/datocms-structured-text-utils-5.1.6.tgz",
+ "integrity": "sha512-LDk8R5byWmBmK5dIWiTvfPe7pBn9xkZ3VMxevsoNuiffVsz2T3SgtdqNBnGIKaEmxJ3dln/IvxSbkvULf1Y9Eg==",
"license": "MIT",
"dependencies": {
"array-flatten": "^3.0.0"
@@ -9193,9 +9207,9 @@
}
},
"node_modules/hls.js": {
- "version": "1.5.17",
- "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.5.17.tgz",
- "integrity": "sha512-wA66nnYFvQa1o4DO/BFgLNRKnBTVXpNeldGRBJ2Y0SvFtdwvFKCbqa9zhHoZLoxHhZ+jYsj3aIBkWQQCPNOhMw==",
+ "version": "1.6.15",
+ "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.6.15.tgz",
+ "integrity": "sha512-E3a5VwgXimGHwpRGV+WxRTKeSp2DW5DI5MWv34ulL3t5UNmyJWCQ1KmLEHbYzcfThfXG8amBL+fCYPneGHC4VA==",
"license": "Apache-2.0"
},
"node_modules/hoopy": {
@@ -13508,15 +13522,18 @@
"integrity": "sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA=="
},
"node_modules/media-chrome": {
- "version": "3.2.5",
- "resolved": "https://registry.npmjs.org/media-chrome/-/media-chrome-3.2.5.tgz",
- "integrity": "sha512-tTsgS7x77Bn4p/wca/Si/7A+Q3z9DzKq0SOkroQvrNMXBVyQasMayDcsKg5Ur5NGsymZfttnJi7tXvVr/tPj8g==",
- "license": "MIT"
+ "version": "4.16.1",
+ "resolved": "https://registry.npmjs.org/media-chrome/-/media-chrome-4.16.1.tgz",
+ "integrity": "sha512-qtFlsy0lNDVCyVo//ZCAfRPKwgehfOYp6rThZzDUuZ5ypv41yqUfAxK+P9TOs+XSVWXATPTT2WRV0fbW0BH4vQ==",
+ "license": "MIT",
+ "dependencies": {
+ "ce-la-react": "^0.3.2"
+ }
},
"node_modules/media-tracks": {
- "version": "0.3.3",
- "resolved": "https://registry.npmjs.org/media-tracks/-/media-tracks-0.3.3.tgz",
- "integrity": "sha512-9P2FuUHnZZ3iji+2RQk7Zkh5AmZTnOG5fODACnjhCVveX1McY3jmCRHofIEI+yTBqplz7LXy48c7fQ3Uigp88w==",
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/media-tracks/-/media-tracks-0.3.4.tgz",
+ "integrity": "sha512-5SUElzGMYXA7bcyZBL1YzLTxH9Iyw1AeYNJxzByqbestrrtB0F3wfiWUr7aROpwodO4fwnxOt78Xjb3o3ONNQg==",
"license": "MIT"
},
"node_modules/media-typer": {
@@ -13742,9 +13759,9 @@
}
},
"node_modules/mux-embed": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/mux-embed/-/mux-embed-5.2.1.tgz",
- "integrity": "sha512-NukHw91xeEVDBeXVDBpi2BvXNix7gSuvdtyvOph5yR/ROn1hHbTlcYWoKQyCyJX9frsF00UROEul+S8wPzU3aQ==",
+ "version": "5.9.0",
+ "resolved": "https://registry.npmjs.org/mux-embed/-/mux-embed-5.9.0.tgz",
+ "integrity": "sha512-wmunL3uoPhma/tWy8PrDPZkvJpXvSFBwbD3KkC4PG8Ztjfb1X3hRJwGUAQyRz7z99b/ovLm2UTTitrkvStjH4w==",
"license": "MIT"
},
"node_modules/mz": {
@@ -14426,6 +14443,31 @@
"node": ">=4"
}
},
+ "node_modules/player.style": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/player.style/-/player.style-0.3.0.tgz",
+ "integrity": "sha512-ny1TbqA2ZsUd6jzN+F034+UMXVK7n5SrwepsrZ2gIqVz00Hn0ohCUbbUdst/2IOFCy0oiTbaOXkSFxRw1RmSlg==",
+ "license": "MIT",
+ "workspaces": [
+ ".",
+ "site",
+ "examples/*",
+ "scripts/*",
+ "themes/*"
+ ],
+ "dependencies": {
+ "media-chrome": "~4.14.0"
+ }
+ },
+ "node_modules/player.style/node_modules/media-chrome": {
+ "version": "4.14.0",
+ "resolved": "https://registry.npmjs.org/media-chrome/-/media-chrome-4.14.0.tgz",
+ "integrity": "sha512-IEdFb4blyF15vLvQzLIn6USJBv7Kf2ne+TfLQKBYI5Z0f9VEBVZz5MKy4Uhi0iA9lStl2S9ENIujJRuJIa5OiA==",
+ "license": "MIT",
+ "dependencies": {
+ "ce-la-react": "^0.3.0"
+ }
+ },
"node_modules/postcss": {
"version": "8.4.33",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz",
@@ -15912,15 +15954,15 @@
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
},
"node_modules/react-datocms": {
- "version": "7.0.4",
+ "version": "7.2.3",
"resolved": "file:../react-datocms.tgz",
- "integrity": "sha512-8cB5FsIo6dcTddd93+P0vU/HcTZxHSRT6SXqdrVFopbBhfR5gy66stHJQvnNZnuqypRUL+M9mhdRayMOcOdZdw==",
+ "integrity": "sha512-x6GJn9yiXVr+bgVLdZdPUBdxBEMMdz6L88mdyuoVVDTKHl587yaCYBMjt3YmrAUS/hrckemnjRcWSNwLPcl3NQ==",
"license": "MIT",
"dependencies": {
- "@mux/mux-player-react": "=2.5.0",
+ "@mux/mux-player-react": "*",
"datocms-listen": "^0.1.9",
- "datocms-structured-text-generic-html-renderer": "^4.0.1",
- "datocms-structured-text-utils": "^4.0.1",
+ "datocms-structured-text-generic-html-renderer": "^5.0.0",
+ "datocms-structured-text-utils": "^5.1.6",
"react-intersection-observer": "^9.4.3",
"react-string-replace": "^1.1.0",
"use-deep-compare-effect": "^1.6.1"
@@ -15933,19 +15975,19 @@
}
},
"node_modules/react-datocms/node_modules/@mux/mux-player-react": {
- "version": "2.5.0",
- "resolved": "https://registry.npmjs.org/@mux/mux-player-react/-/mux-player-react-2.5.0.tgz",
- "integrity": "sha512-HTJ55X+ngrR2tVgvCEc6edihyHGYkB4C8TqPNM+tbHeQqIevvyatJAMlZHZbpFEdOLUeL3I/PwsDQ6FOV7csKw==",
+ "version": "3.9.2",
+ "resolved": "https://registry.npmjs.org/@mux/mux-player-react/-/mux-player-react-3.9.2.tgz",
+ "integrity": "sha512-BzTQEpjNdxyL2hlbZaUKZmSdw7m6YS00zzmrnuBAxnFDZ3m9z45lo3GrtRmnuy3v30gO0faQ1S34BTRLxGNRLQ==",
"license": "MIT",
"dependencies": {
- "@mux/mux-player": "2.5.0",
- "@mux/playback-core": "0.23.0",
- "prop-types": "^15.7.2"
+ "@mux/mux-player": "3.9.2",
+ "@mux/playback-core": "0.31.4",
+ "prop-types": "^15.8.1"
},
"peerDependencies": {
- "@types/react": "^17.0.0 || ^18",
- "react": "^17.0.2 || ^18",
- "react-dom": "^17.0.2 || ^18"
+ "@types/react": "^17.0.0 || ^17.0.0-0 || ^18 || ^18.0.0-0 || ^19 || ^19.0.0-0",
+ "react": "^17.0.2 || ^17.0.0-0 || ^18 || ^18.0.0-0 || ^19 || ^19.0.0-0",
+ "react-dom": "^17.0.2 || ^17.0.2-0 || ^18 || ^18.0.0-0 || ^19 || ^19.0.0-0"
},
"peerDependenciesMeta": {
"@types/react": {
@@ -15957,13 +15999,13 @@
}
},
"node_modules/react-datocms/node_modules/react-intersection-observer": {
- "version": "9.13.1",
- "resolved": "https://registry.npmjs.org/react-intersection-observer/-/react-intersection-observer-9.13.1.tgz",
- "integrity": "sha512-tSzDaTy0qwNPLJHg8XZhlyHTgGW6drFKTtvjdL+p6um12rcnp8Z5XstE+QNBJ7c64n5o0Lj4ilUleA41bmDoMw==",
+ "version": "9.16.0",
+ "resolved": "https://registry.npmjs.org/react-intersection-observer/-/react-intersection-observer-9.16.0.tgz",
+ "integrity": "sha512-w9nJSEp+DrW9KmQmeWHQyfaP6b03v+TdXynaoA964Wxt7mdR3An11z4NNCQgL4gKSK7y1ver2Fq+JKH6CWEzUA==",
"license": "MIT",
"peerDependencies": {
- "react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
- "react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"react-dom": {
diff --git a/examples/src/SiteSearchExamples/index.jsx b/examples/src/SiteSearchExamples/index.jsx
index 492b432..017559e 100644
--- a/examples/src/SiteSearchExamples/index.jsx
+++ b/examples/src/SiteSearchExamples/index.jsx
@@ -12,7 +12,7 @@ export default function SiteSearchExamples() {
const [query, setQuery] = useState('');
const { state, error, data } = useSiteSearch({
client,
- buildTriggerId: '7497',
+ searchIndexId: '34759',
// optional: you can omit it you only have one locale, or you want to find results in every locale
initialState: { locale: 'en' },
// optional: by default fuzzy-search is not active
diff --git a/src/useSiteSearch/index.tsx b/src/useSiteSearch/index.tsx
index ea9a058..f3fb7aa 100644
--- a/src/useSiteSearch/index.tsx
+++ b/src/useSiteSearch/index.tsx
@@ -15,6 +15,7 @@ type SearchResultInstancesHrefSchema = {
fuzzy?: boolean;
query: string;
build_trigger_id?: string;
+ search_index_id?: string;
locale?: string;
[k: string]: unknown;
};
@@ -62,7 +63,8 @@ type Highlighter = (
export type UseSiteSearchConfig = {
client: Client;
- buildTriggerId: string;
+ buildTriggerId?: string;
+ searchIndexId?: string;
fuzzySearch?: boolean;
resultsPerPage?: number;
highlightMatch?: Highlighter;
@@ -161,6 +163,7 @@ export function useSiteSearch(
query: state.query,
locale: state.locale,
build_trigger_id: config.buildTriggerId,
+ search_index_id: config.searchIndexId,
...(config.fuzzySearch === true ? { fuzzy: true } : {}),
},
page: {
@@ -196,6 +199,7 @@ export function useSiteSearch(
resultsPerPage,
state,
config.buildTriggerId,
+ config.searchIndexId,
config.fuzzySearch,
config.client.config.apiToken,
]);