├── .eslintrc.json
├── .gitignore
├── LICENSE
├── README.md
├── config.json
├── index.ts
├── package-lock.json
├── package.json
├── prettierrc
├── sitemap.xml
└── tsconfig.json
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "parser": "@typescript-eslint/parser",
3 | "plugins": [
4 | "@typescript-eslint"
5 | ],
6 | "extends": [
7 | "eslint:recommended",
8 | "plugin:@typescript-eslint/recommended"
9 | ],
10 | "env": {
11 | "node": true,
12 | "es6": true
13 | },
14 | "parserOptions": {
15 | "ecmaVersion": 2021,
16 | "sourceType": "module"
17 | },
18 | "rules": {
19 | // you can add or overwrite rules here
20 | }
21 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | lerna-debug.log*
8 | .pnpm-debug.log*
9 |
10 | # Diagnostic reports (https://nodejs.org/api/report.html)
11 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12 |
13 | # Runtime data
14 | pids
15 | *.pid
16 | *.seed
17 | *.pid.lock
18 |
19 | # Directory for instrumented libs generated by jscoverage/JSCover
20 | lib-cov
21 |
22 | # Coverage directory used by tools like istanbul
23 | coverage
24 | *.lcov
25 |
26 | # nyc test coverage
27 | .nyc_output
28 |
29 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30 | .grunt
31 |
32 | # Bower dependency directory (https://bower.io/)
33 | bower_components
34 |
35 | # node-waf configuration
36 | .lock-wscript
37 |
38 | # Compiled binary addons (https://nodejs.org/api/addons.html)
39 | build/Release
40 |
41 | # Dependency directories
42 | node_modules/
43 | jspm_packages/
44 |
45 | # Snowpack dependency directory (https://snowpack.dev/)
46 | web_modules/
47 |
48 | # TypeScript cache
49 | *.tsbuildinfo
50 |
51 | # Optional npm cache directory
52 | .npm
53 |
54 | # Optional eslint cache
55 | .eslintcache
56 |
57 | # Optional stylelint cache
58 | .stylelintcache
59 |
60 | # Microbundle cache
61 | .rpt2_cache/
62 | .rts2_cache_cjs/
63 | .rts2_cache_es/
64 | .rts2_cache_umd/
65 |
66 | # Optional REPL history
67 | .node_repl_history
68 |
69 | # Output of 'npm pack'
70 | *.tgz
71 |
72 | # Yarn Integrity file
73 | .yarn-integrity
74 |
75 | # dotenv environment variable files
76 | .env
77 | .env.development.local
78 | .env.test.local
79 | .env.production.local
80 | .env.local
81 |
82 | # parcel-bundler cache (https://parceljs.org/)
83 | .cache
84 | .parcel-cache
85 |
86 | # Next.js build output
87 | .next
88 | out
89 |
90 | # Nuxt.js build / generate output
91 | .nuxt
92 | dist
93 |
94 | # Gatsby files
95 | .cache/
96 | # Comment in the public line in if your project uses Gatsby and not Next.js
97 | # https://nextjs.org/blog/next-9-1#public-directory-support
98 | # public
99 |
100 | # vuepress build output
101 | .vuepress/dist
102 |
103 | # vuepress v2.x temp and cache directory
104 | .temp
105 | .cache
106 |
107 | # Docusaurus cache and generated files
108 | .docusaurus
109 |
110 | # Serverless directories
111 | .serverless/
112 |
113 | # FuseBox cache
114 | .fusebox/
115 |
116 | # DynamoDB Local files
117 | .dynamodb/
118 |
119 | # TernJS port file
120 | .tern-port
121 |
122 | # Stores VSCode versions used for testing VSCode extensions
123 | .vscode-test
124 |
125 | # yarn v2
126 | .yarn/cache
127 | .yarn/unplugged
128 | .yarn/build-state.yml
129 | .yarn/install-state.gz
130 | .pnp.*
131 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Emmanuel Keller
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # surrealdb-web-indexer
2 |
3 | ## Setup
4 |
5 | It is a NodeJS application:
6 |
7 | ```bash
8 | npm install
9 | ```
10 |
11 | ## Start a SurrealDB instance
12 |
13 | Following the [Getting Started]( https://surrealdb.com/docs/introduction/start)
14 |
15 | If you want to run it from the code (and a branch):
16 |
17 | ```bash
18 | cargo run --no-default-features -F storage-mem -- start --log trace --user root --pass root memory
19 | ```
20 |
21 | You may want to prepare a CLI connected to the instance:
22 |
23 | ```bash
24 | cargo run sql --conn http://localhost:8000 --user root --pass root --ns test --db test
25 | ```
26 |
27 | ## Update `config.json` with the right parameters
28 |
29 | The sitemap can be either a path to a local file, or an url. Eg.: `https://www.surrealdb.com/sitemap.xml`
30 | ```json
31 | {
32 | "sitemap": "sitemap.xml",
33 | "surreal": {
34 | "url": "http://127.0.0.1:8000/rpc",
35 | "ns": "test",
36 | "db": "test",
37 | "user": "root",
38 | "pass": "root"
39 | }
40 | }
41 | ```
42 |
43 | ## Create an analyzer and a full-text index
44 |
45 | Using the CLI, create an an analyzer and an few indexes:
46 |
47 | ```sql
48 | DEFINE ANALYZER simple TOKENIZERS blank,class,camel,punct FILTERS snowball(english);
49 | DEFINE INDEX page_title ON page FIELDS title SEARCH ANALYZER simple BM25(1.2,0.75);
50 | DEFINE INDEX page_path ON page FIELDS path SEARCH ANALYZER simple BM25(1.2,0.75);
51 | DEFINE INDEX page_h1 ON page FIELDS h1 SEARCH ANALYZER simple BM25(1.2,0.75);
52 | DEFINE INDEX page_h2 ON page FIELDS h2 SEARCH ANALYZER simple BM25(1.2,0.75);
53 | DEFINE INDEX page_h3 ON page FIELDS h3 SEARCH ANALYZER simple BM25(1.2,0.75);
54 | DEFINE INDEX page_h4 ON page FIELDS h4 SEARCH ANALYZER simple BM25(1.2,0.75);
55 | DEFINE INDEX page_content ON page FIELDS content SEARCH ANALYZER simple BM25(1.2,0.75) HIGHLIGHTS;
56 | DEFINE INDEX page_code ON page FIELDS code SEARCH ANALYZER simple BM25(1.2,0.75);
57 | ```
58 |
59 | Alternatively you may use the npm script:
60 |
61 | ```bash
62 | npm run init
63 | ```
64 |
65 |
66 | ### Crawl and index the website:
67 |
68 | Start the npm script:
69 |
70 | ```bash
71 | npm run crawl
72 |
73 | > surrealdb-web-indexer@1.0.0 start
74 | > ts-node index.ts
75 |
76 | The sitemap at "sitemap.xml" contains 9 url(s)
77 | Crawling page https://surrealdb.com
78 | Indexing "page:https://surrealdb.com"
79 | Crawling page https://surrealdb.com/install
80 | Indexing "page:https://surrealdb.com/install"
81 | Crawling page https://surrealdb.com/community
82 | Indexing "page:https://surrealdb.com/community"
83 | Crawling page https://surrealdb.com/docs
84 | Indexing "page:https://surrealdb.com/docs"
85 | Crawling page https://surrealdb.com/docs/introduction
86 | Indexing "page:https://surrealdb.com/docs/introduction"
87 | Crawling page https://surrealdb.com/docs/surrealql
88 | Indexing "page:https://surrealdb.com/docs/surrealql"
89 | Crawling page https://surrealdb.com/docs/surrealql/comments
90 | Indexing "page:https://surrealdb.com/docs/surrealql/comments"
91 | Crawling page https://surrealdb.com/docs/surrealql/datamodel
92 | Indexing "page:https://surrealdb.com/docs/surrealql/datamodel"
93 | Crawling page https://surrealdb.com/docs/surrealql/datamodel/ids
94 | Indexing "page:https://surrealdb.com/docs/surrealql/datamodel/ids"
95 | 9 page(s) crawled
96 | ```
97 |
98 | ## 4. Execute a full-text search query
99 |
100 | You can use the provided npm script:
101 |
102 | ```bash
103 | npm search "install linux"
104 | ```
105 |
106 | Or use the CLI and execute a SELECT statement with a match operator (@{ref}@) and the `search::highlight` function.
107 |
108 | ```sql
109 | SELECT
110 | id,
111 | title,
112 | search::highlight('', '', 6) AS content,
113 | search::score(0) * 7 + search::score(1) * 6 + search::score(2) * 5 + search::score(3) * 4
114 | + search::score(4) * 3 + search::score(5) * 2 + search::score(6) AS score
115 | FROM page
116 | WHERE title @0@ 'install linux'
117 | OR path @1@ 'install linux'
118 | OR h1 @2@ 'install linux'
119 | OR h2 @3@ 'install linux'
120 | OR h3 @4@ 'install linux'
121 | OR h4 @5@ 'install linux'
122 | OR content @6@ 'install linux')
123 | ORDER BY score DESC
124 | LIMIT 10
125 | ```
126 |
127 | Which should return something like this:
128 |
129 | Click to expand
130 |
131 | ```js
132 | [
133 | {
134 | content: [
135 | 'Product',
136 | 'Community',
137 | '| Join us in September',
138 | 'Understand why SurrealDB is the ultimate cloud database.',
139 | "Get a detailed overview of all of SurrealDB's technical features.",
140 | 'Keep track of the notable updates and improvements for every SurrealDB product release in chronological order.',
141 | 'See what we have planned for SurrealDB, and see the features and functionality which has already been implemented.',
142 | 'Install',
143 | 'There are a number of ways of running SurrealDB. It can either be installed from a binary image, or it can be run from within Docker. Once installed, the surreal command is a single executable which can be used to backup, interact with, and run SurrealDB server instances.',
144 | 'surreal',
145 | 'After installing with any of the available options. Check out the getting started guide',
146 | 'Install on macOS',
147 | "The quickest way to get going with SurrealDB on macOS is to use Homebrew. This will install both the command-line tools, and the SurrealDB server as a single executable. If you don't use Homebrew, follow the instructions for Linux below to install SurrealDB. View the documentation for more information.",
148 | 'brew install surrealdb/tap/surreal',
149 | 'Install on Linux',
150 | 'The easiest and preferred way to get going with SurrealDB on Unix operating systems is to install and use the SurrealDB command-line tool. Run the following command in your terminal and follow the on-screen instructions. View the documentation for more information.',
151 | 'curl -sSf https://install.surrealdb.com | sh',
152 | 'Install on Windows',
153 | 'The easiest and preferred way to get going with SurrealDB on Windows is to install and use the SurrealDB command-line tool. Run the following command in your terminal and follow the on-screen instructions. View the documentation for more information.',
154 | 'iwr https://windows.surrealdb.com -useb | iex',
155 | 'Alternatively SurrealDB is available for installation, on Windows, via the Chocolatey package manager, from an administrative shell - enabling easy installation and upgrading.',
156 | 'choco install surreal --pre',
157 | 'Alternatively SurrealDB is available for installation, on Windows, via the Scoop package manager, from an administrative shell - enabling easy installation and upgrading.',
158 | 'scoop install surreal',
159 | 'Run using Docker',
160 | 'Docker can be used to manage and run SurrealDB database instances without the need to install any command-line tools. The SurrealDB docker container contains the full command-line tools for importing and exporting data from a running server, or for running a server itself. View the documentation for more information.',
161 | 'docker run --rm --pull always -p 8000:8000 surrealdb/surrealdb:latest start',
162 | 'With an SQL-style query language, real-time queries with highly-efficient related data retrieval, advanced security permissions for multi-tenant access, and support for performant analytical workloads, SurrealDB is the next generation serverless database.',
163 | 'Product',
164 | 'Community',
165 | 'Legal',
166 | 'About',
167 | 'Copyright © SurrealDB Ltd. Registered in England and Wales, no. 13615201 Registered address: Huckletree Oxford Circus, 213 Oxford Street, London, W1D 2LG'
168 | ],
169 | id: 'page:⟨/install⟩',
170 | score: 103.08830308914185,
171 | title: 'SurrealDB | Install'
172 | },
173 | {
174 | content: [
175 | 'Product',
176 | 'Community',
177 | '| Join us in September',
178 | 'Understand why SurrealDB is the ultimate cloud database.',
179 | "Get a detailed overview of all of SurrealDB's technical features.",
180 | 'Keep track of the notable updates and improvements for every SurrealDB product release in chronological order.',
181 | 'See what we have planned for SurrealDB, and see the features and functionality which has already been implemented.',
182 | 'Install on Linux',
183 | 'Use this tutorial to install SurrealDB on Linux or Unix operating systems using the SurrealDB install script. Both the SurrealDB Database Server and the SurrealDB Command Line Tool are packaged and distributed as a single executable file, which is easy to install, and easy to uninstall.',
184 | 'Installing SurrealDB using the install script',
185 | 'To get started, you can use the SurrealDB install script. This script securely downloads the latest version for the platform and CPU type. It attempts to install SurrealDB into the /usr/local/bin folder, falling back to a user-specified folder if necessary.',
186 | '/usr/local/bin',
187 | "user@localhost % curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh",
188 | 'Updating SurrealDB',
189 | 'To ensure that you are using the latest version, update SurrealDB to version v1.0.0-beta.9+20230402 using the following command.',
190 | 'v1.0.0-beta.9+20230402',
191 | "user@localhost % curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh",
192 | 'Checking SurrealDB',
193 | 'Once installed, you can run the SurrealDB command-line tool by using the surreal command. To check whether the install was successful run the following command in your terminal.',
194 | 'surreal',
195 | 'user@localhost % surreal help',
196 | 'The result should look similar to the output below, confirming that the SurrealDB command-line tool was installed successfully.',
197 | ".d8888b. 888 8888888b. 888888b. d88P Y88b 888 888 'Y88b 888 '88b Y88b. 888 888 888 888 .88P 'Y888b. 888 888 888d888 888d888 .d88b. 8888b. 888 888 888 8888888K. 'Y88b. 888 888 888P' 888P' d8P Y8b '88b 888 888 888 888 'Y88b '888 888 888 888 888 88888888 .d888888 888 888 888 888 888 Y88b d88P Y88b 888 888 888 Y8b. 888 888 888 888 .d88P 888 d88P 'Y8888P' 'Y88888 888 888 'Y8888 'Y888888 888 8888888P' 8888888P' SurrealDB command-line interface and server To get started using SurrealDB, and for guides on connecting to and building applications on top of SurrealDB, check out the SurrealDB documentation (https://surrealdb.com/docs). If you have questions or ideas, join the SurrealDB community (https://surrealdb.com/community). If you find a bug, submit an issue on Github (https://github.com/surrealdb/surrealdb/issues). We would love it if you could star the repository (https://github.com/surrealdb/surrealdb). ---------- USAGE: surreal [SUBCOMMAND] OPTIONS: -h, --help Print help information SUBCOMMANDS: start Start the database server backup Backup data to or from an existing database import Import a SQL script into an existing database export Export an existing database into a SQL script version Output the command-line tool version information sql Start an SQL REPL in your terminal with pipe support help Print this message or the help of the given subcommand(s)",
198 | 'With an SQL-style query language, real-time queries with highly-efficient related data retrieval, advanced security permissions for multi-tenant access, and support for performant analytical workloads, SurrealDB is the next generation serverless database.',
199 | 'Product',
200 | 'Community',
201 | 'Legal',
202 | 'About',
203 | 'Copyright © SurrealDB Ltd. Registered in England and Wales, no. 13615201 Registered address: Huckletree Oxford Circus, 213 Oxford Street, London, W1D 2LG'
204 | ],
205 | id: 'page:⟨/docs/installation/linux⟩',
206 | score: 94.86924076080322,
207 | title: 'SurrealDB | Documentation'
208 | },
209 | {
210 | content: [
211 | 'Product',
212 | 'Community',
213 | '| Join us in September',
214 | 'Understand why SurrealDB is the ultimate cloud database.',
215 | "Get a detailed overview of all of SurrealDB's technical features.",
216 | 'Keep track of the notable updates and improvements for every SurrealDB product release in chronological order.',
217 | 'See what we have planned for SurrealDB, and see the features and functionality which has already been implemented.',
218 | 'Install SurrealDB Nightly',
219 | 'If you prefer developing on the bleeding edge, you can follow this tutorial to install SurrealDB Nightly. The nightly version is built and released every night at midnight, and includes the latest features, and bug fixes. The nightly version is available for macOS, Linux, and Windows operating systems, and can be installed using the Linux or Unix install script, or using the Windows install script. Alternatively you can run the nightly version with Docker by using the nightly tag.',
220 | 'nightly',
221 | 'Installing SurrealDB Nightly on macOS',
222 | 'To get started, you can use the SurrealDB install script. This script securely downloads the latest version for the platform and CPU type. It attempts to install SurrealDB into the /usr/local/bin folder, falling back to a user-specified folder if necessary. The following command will attempt to install the nightly version. You can re-run this command daily to ensure you are running the latest build of SurrealDB.',
223 | '/usr/local/bin',
224 | "user@localhost % curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh -s -- --nightly",
225 | 'Installing SurrealDB Nightly on Linux',
226 | 'To get started, you can use the SurrealDB install script. This script securely downloads the latest version for the platform and CPU type. It attempts to install SurrealDB into the /usr/local/bin folder, falling back to a user-specified folder if necessary. The following command will attempt to install the nightly version. You can re-run this command daily to ensure you are running the latest build of SurrealDB.',
227 | '/usr/local/bin',
228 | "user@localhost % curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh -s -- --nightly",
229 | 'Installing SurrealDB Nightly on Windows',
230 | 'To get started, you can use the SurrealDB install script. This script securely downloads the latest version for the platform and CPU type. It installs SurrealDB into the C:\\Program Files\\SurrealDB folder, falling back to a user-specified folder if necessary. The following command will attempt to install the nightly version. You can re-run this command daily to ensure you are running the latest build of SurrealDB.',
231 | 'C:\\Program Files\\SurrealDB',
232 | 'PS C:\\> iex "& { $(irm https://windows.surrealdb.com) } -Nightly"',
233 | 'Using SurrealDB Nightly with Docker',
234 | 'To use SurrealDB Nightly with Docker, you can use the nightly tag. When running the following command, the latest SurrealDB Nightly version will be pulled from Docker Hub.',
235 | 'nightly',
236 | 'user@localhost % docker run --rm --pull always -p 8000:8000 surrealdb/surrealdb:nightly start',
237 | 'With an SQL-style query language, real-time queries with highly-efficient related data retrieval, advanced security permissions for multi-tenant access, and support for performant analytical workloads, SurrealDB is the next generation serverless database.',
238 | 'Product',
239 | 'Community',
240 | 'Legal',
241 | 'About',
242 | 'Copyright © SurrealDB Ltd. Registered in England and Wales, no. 13615201 Registered address: Huckletree Oxford Circus, 213 Oxford Street, London, W1D 2LG'
243 | ],
244 | id: 'page:⟨/docs/installation/nightly⟩',
245 | score: 62.036728858947754,
246 | title: 'SurrealDB | Documentation'
247 | },
248 | {
249 | content: [
250 | 'Product',
251 | 'Community',
252 | '| Join us in September',
253 | 'Understand why SurrealDB is the ultimate cloud database.',
254 | "Get a detailed overview of all of SurrealDB's technical features.",
255 | 'Keep track of the notable updates and improvements for every SurrealDB product release in chronological order.',
256 | 'See what we have planned for SurrealDB, and see the features and functionality which has already been implemented.',
257 | 'Installation',
258 | "Getting started with SurrealDB is intended to be quick and easy. All of SurrealDB's functionality for starting a server, and importing and exporting data, is enabled through the command-line tool, packaged and distributed as a single executable file, which can be downloaded, installed, or run from within Docker.",
259 | 'Installing',
260 | 'macOS',
261 | 'Follow this tutorial to install SurrealDB on macOS operating systems',
262 | 'Linux',
263 | 'Follow this tutorial to install SurrealDB on Linux operating systems',
264 | 'Windows',
265 | 'Follow this tutorial to install SurrealDB on Windows operating systems',
266 | 'Install SurrealDB Nightly',
267 | 'If you prefer developing on the bleeding edge, you can use SurrealDB Nightly, which includes the latest features, built and released every night',
268 | 'Running',
269 | 'Run with Docker',
270 | 'Follow this tutorial to get started with SurrealDB using the Docker container management system or the Docker Compose orchestration tool',
271 | 'Run a single-node, in-memory server',
272 | 'Follow this tutorial to get started with a single-node, in-memory server instance for testing and development',
273 | 'Run a single-node, on-disk server',
274 | 'Follow this tutorial to get started with a single-node, in-disk server instance for vertical scaling',
275 | 'Run a multi-node, scalable cluster with TiKV',
276 | 'Follow this tutorial to get started with a single-node, in-disk server instance for horizontal scaling',
277 | 'Upgrading',
278 | 'From beta-8 to beta-9',
279 | 'Follow this guide to get started upgrading from beta-8 to beta-9',
280 | 'With an SQL-style query language, real-time queries with highly-efficient related data retrieval, advanced security permissions for multi-tenant access, and support for performant analytical workloads, SurrealDB is the next generation serverless database.',
281 | 'Product',
282 | 'Community',
283 | 'Legal',
284 | 'About',
285 | 'Copyright © SurrealDB Ltd. Registered in England and Wales, no. 13615201 Registered address: Huckletree Oxford Circus, 213 Oxford Street, London, W1D 2LG'
286 | ],
287 | id: 'page:⟨/docs/installation⟩',
288 | score: 60.44818592071533,
289 | title: 'SurrealDB | Documentation'
290 | },
291 | {
292 | content: [
293 | 'Product',
294 | 'Community',
295 | '| Join us in September',
296 | 'Understand why SurrealDB is the ultimate cloud database.',
297 | "Get a detailed overview of all of SurrealDB's technical features.",
298 | 'Keep track of the notable updates and improvements for every SurrealDB product release in chronological order.',
299 | 'See what we have planned for SurrealDB, and see the features and functionality which has already been implemented.',
300 | 'Install on Windows',
301 | 'Use this tutorial to install SurrealDB on Windows operating systems using the SurrealDB install script, or using the third-party Chocolatey or third-party Scoop package managers. Both the SurrealDB Database Server and the SurrealDB Command Line Tool are packaged and distributed as a single executable file, which is easy to install, and easy to uninstall.',
302 | 'Installing SurrealDB using the install script',
303 | 'To get started, you can use the SurrealDB install script. This script securely downloads the latest version for the platform and CPU type. It installs SurrealDB into the C:\\Program Files\\SurrealDB folder, falling back to a user-specified folder if necessary.',
304 | 'C:\\Program Files\\SurrealDB',
305 | 'PS C:\\> iwr https://windows.surrealdb.com -useb | iex',
306 | 'Updating SurrealDB',
307 | 'To ensure that you are using the latest version, update SurrealDB to version v1.0.0-beta.9+20230402 using the following command.',
308 | 'v1.0.0-beta.9+20230402',
309 | 'PS C:\\> iwr https://windows.surrealdb.com -useb | iex',
310 | 'Checking SurrealDB',
311 | 'Once installed, you can run the SurrealDB command-line tool by using the surreal.exe command. To check whether the install was successful run the following command in your terminal.',
312 | 'surreal.exe',
313 | 'PS C:\\> C:\\Program Files\\SurrealDB\\surreal.exe help',
314 | 'The result should look similar to the output below, confirming that the SurrealDB command-line tool was installed successfully.',
315 | ".d8888b. 888 8888888b. 888888b. d88P Y88b 888 888 'Y88b 888 '88b Y88b. 888 888 888 888 .88P 'Y888b. 888 888 888d888 888d888 .d88b. 8888b. 888 888 888 8888888K. 'Y88b. 888 888 888P' 888P' d8P Y8b '88b 888 888 888 888 'Y88b '888 888 888 888 888 88888888 .d888888 888 888 888 888 888 Y88b d88P Y88b 888 888 888 Y8b. 888 888 888 888 .d88P 888 d88P 'Y8888P' 'Y88888 888 888 'Y8888 'Y888888 888 8888888P' 8888888P' SurrealDB command-line interface and server To get started using SurrealDB, and for guides on connecting to and building applications on top of SurrealDB, check out the SurrealDB documentation (https://surrealdb.com/docs). If you have questions or ideas, join the SurrealDB community (https://surrealdb.com/community). If you find a bug, submit an issue on Github (https://github.com/surrealdb/surrealdb/issues). We would love it if you could star the repository (https://github.com/surrealdb/surrealdb). ---------- USAGE: surreal [SUBCOMMAND] OPTIONS: -h, --help Print help information SUBCOMMANDS: start Start the database server backup Backup data to or from an existing database import Import a SQL script into an existing database export Export an existing database into a SQL script version Output the command-line tool version information sql Start an SQL REPL in your terminal with pipe support help Print this message or the help of the given subcommand(s)",
316 | 'Installing SurrealDB using Chocolatey',
317 | "If you use the chocolately package manaher, then you can quickly install SurrealDB with one command. This will install both the command-line tools, and the SurrealDB server as a single executable. If you don't use Homebrew, follow the instructions for Linux below to install SurrealDB.",
318 | 'PS C:\\> choco install surrealdb',
319 | 'Updating SurrealDB',
320 | 'To ensure that you are using the latest version, update SurrealDB to version v1.0.0-beta.9+20230402 using the following command.',
321 | 'v1.0.0-beta.9+20230402',
322 | 'PS C:\\> choco update surrealdb',
323 | 'Installing SurrealDB using Scoop',
324 | 'If you use the Scoop package manager, then you can quickly install SurrealDB with one command. This will install both the command-line tools, and the SurrealDB server as a single executable.',
325 | 'PS C:\\> scoop install surrealdb',
326 | 'Updating SurrealDB',
327 | 'To ensure that you are using the latest version, update SurrealDB to version v1.0.0-beta.9+20230402 using the following command.',
328 | 'v1.0.0-beta.9+20230402',
329 | 'PS C:\\> scoop update surrealdb',
330 | 'With an SQL-style query language, real-time queries with highly-efficient related data retrieval, advanced security permissions for multi-tenant access, and support for performant analytical workloads, SurrealDB is the next generation serverless database.',
331 | 'Product',
332 | 'Community',
333 | 'Legal',
334 | 'About',
335 | 'Copyright © SurrealDB Ltd. Registered in England and Wales, no. 13615201 Registered address: Huckletree Oxford Circus, 213 Oxford Street, London, W1D 2LG'
336 | ],
337 | id: 'page:⟨/docs/installation/windows⟩',
338 | score: 50.52293062210083,
339 | title: 'SurrealDB | Documentation'
340 | },
341 | {
342 | content: [
343 | 'Product',
344 | 'Community',
345 | '| Join us in September',
346 | 'Understand why SurrealDB is the ultimate cloud database.',
347 | "Get a detailed overview of all of SurrealDB's technical features.",
348 | 'Keep track of the notable updates and improvements for every SurrealDB product release in chronological order.',
349 | 'See what we have planned for SurrealDB, and see the features and functionality which has already been implemented.',
350 | 'Install on macOS',
351 | 'Use this tutorial to install SurrealDB on macOS using the SurrealDB install script, or using the third-party Homebrew package manager. Both the SurrealDB Database Server and the SurrealDB Command Line Tool are packaged and distributed as a single executable file, which is easy to install, and easy to uninstall.',
352 | 'Installing SurrealDB using the install script',
353 | 'To get started, you can use the SurrealDB install script. This script securely downloads the latest version for the platform and CPU type. It attempts to install SurrealDB into the /usr/local/bin folder, falling back to a user-specified folder if necessary.',
354 | '/usr/local/bin',
355 | "user@localhost % curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh",
356 | 'Updating SurrealDB',
357 | 'To ensure that you are using the latest version, update SurrealDB to version v1.0.0-beta.9+20230402 using the following command.',
358 | 'v1.0.0-beta.9+20230402',
359 | "user@localhost % curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh",
360 | 'Checking SurrealDB',
361 | 'Once installed, you can run the SurrealDB command-line tool by using the surreal command. To check whether the install was successful run the following command in your terminal.',
362 | 'surreal',
363 | 'user@localhost % surreal help',
364 | 'The result should look similar to the output below, confirming that the SurrealDB command-line tool was installed successfully.',
365 | ".d8888b. 888 8888888b. 888888b. d88P Y88b 888 888 'Y88b 888 '88b Y88b. 888 888 888 888 .88P 'Y888b. 888 888 888d888 888d888 .d88b. 8888b. 888 888 888 8888888K. 'Y88b. 888 888 888P' 888P' d8P Y8b '88b 888 888 888 888 'Y88b '888 888 888 888 888 88888888 .d888888 888 888 888 888 888 Y88b d88P Y88b 888 888 888 Y8b. 888 888 888 888 .d88P 888 d88P 'Y8888P' 'Y88888 888 888 'Y8888 'Y888888 888 8888888P' 8888888P' SurrealDB command-line interface and server To get started using SurrealDB, and for guides on connecting to and building applications on top of SurrealDB, check out the SurrealDB documentation (https://surrealdb.com/docs). If you have questions or ideas, join the SurrealDB community (https://surrealdb.com/community). If you find a bug, submit an issue on Github (https://github.com/surrealdb/surrealdb/issues). We would love it if you could star the repository (https://github.com/surrealdb/surrealdb). ---------- USAGE: surreal [SUBCOMMAND] OPTIONS: -h, --help Print help information SUBCOMMANDS: start Start the database server backup Backup data to or from an existing database import Import a SQL script into an existing database export Export an existing database into a SQL script version Output the command-line tool version information sql Start an SQL REPL in your terminal with pipe support help Print this message or the help of the given subcommand(s)",
366 | 'Installing SurrealDB using Homebrew',
367 | "The quickest way to get going with SurrealDB on macOS is to use Homebrew. This will install both the command-line tools, and the SurrealDB server as a single executable. If you don't use Homebrew, follow the instructions for Linux below to install SurrealDB.",
368 | 'user@localhost % brew install surrealdb/tap/surreal',
369 | 'Updating SurrealDB',
370 | 'To ensure that you are using the latest version, update SurrealDB to version v1.0.0-beta.9+20230402 using the following command.',
371 | 'v1.0.0-beta.9+20230402',
372 | 'user@localhost % brew upgrade surrealdb/tap/surreal',
373 | 'Checking SurrealDB',
374 | 'Once installed, you can run the SurrealDB command-line tool by using the surreal command. To check whether the install was successful run the following command in your terminal.',
375 | 'surreal',
376 | 'user@localhost % surreal help',
377 | 'The result should look similar to the output below, confirming that the SurrealDB command-line tool was installed successfully.',
378 | ".d8888b. 888 8888888b. 888888b. d88P Y88b 888 888 'Y88b 888 '88b Y88b. 888 888 888 888 .88P 'Y888b. 888 888 888d888 888d888 .d88b. 8888b. 888 888 888 8888888K. 'Y88b. 888 888 888P' 888P' d8P Y8b '88b 888 888 888 888 'Y88b '888 888 888 888 888 88888888 .d888888 888 888 888 888 888 Y88b d88P Y88b 888 888 888 Y8b. 888 888 888 888 .d88P 888 d88P 'Y8888P' 'Y88888 888 888 'Y8888 'Y888888 888 8888888P' 8888888P' SurrealDB command-line interface and server To get started using SurrealDB, and for guides on connecting to and building applications on top of SurrealDB, check out the SurrealDB documentation (https://surrealdb.com/docs). If you have questions or ideas, join the SurrealDB community (https://surrealdb.com/community). If you find a bug, submit an issue on Github (https://github.com/surrealdb/surrealdb/issues). We would love it if you could star the repository (https://github.com/surrealdb/surrealdb). ---------- USAGE: surreal [SUBCOMMAND] OPTIONS: -h, --help Print help information SUBCOMMANDS: start Start the database server backup Backup data to or from an existing database import Import a SQL script into an existing database export Export an existing database into a SQL script version Output the command-line tool version information sql Start an SQL REPL in your terminal with pipe support help Print this message or the help of the given subcommand(s)",
379 | 'With an SQL-style query language, real-time queries with highly-efficient related data retrieval, advanced security permissions for multi-tenant access, and support for performant analytical workloads, SurrealDB is the next generation serverless database.',
380 | 'Product',
381 | 'Community',
382 | 'Legal',
383 | 'About',
384 | 'Copyright © SurrealDB Ltd. Registered in England and Wales, no. 13615201 Registered address: Huckletree Oxford Circus, 213 Oxford Street, London, W1D 2LG'
385 | ],
386 | id: 'page:⟨/docs/installation/macos⟩',
387 | score: 47.74777173995972,
388 | title: 'SurrealDB | Documentation'
389 | },
390 | {
391 | content: [
392 | 'A scalable, distributed, collaborative, document-graph database, for the realtime web',
393 | 'License',
394 | 'surrealdb/surrealdb',
395 | 'Name already in use',
396 | 'Use Git or checkout with SVN using the web URL.',
397 | 'Work fast with our official CLI. Learn more about the CLI.',
398 | 'Sign In Required',
399 | 'Please sign in to use Codespaces.',
400 | 'Launching GitHub Desktop',
401 | 'If nothing happens, download GitHub Desktop and try again.',
402 | 'Launching GitHub Desktop',
403 | 'If nothing happens, download GitHub Desktop and try again.',
404 | 'Launching Xcode',
405 | 'If nothing happens, download Xcode and try again.',
406 | 'Launching Visual Studio Code',
407 | 'Your codespace will open once ready.',
408 | 'There was a problem preparing your codespace, please try again.',
409 | 'Latest commit',
410 | 'Request.prototype.text',
411 | 'e0f885e',
412 | 'Git stats',
413 | 'Files',
414 | 'v4',
415 | 'v7',
416 | 'Request.prototype.text',
417 | 'surrealdb',
418 | 'README.md',
419 | "is the ultimate cloud database for tomorrow's applications",
420 | 'Develop easier. Build faster. Scale quicker.',
421 | 'What is SurrealDB?',
422 | 'SurrealDB is an end-to-end cloud-native database designed for modern applications, including web, mobile, serverless, Jamstack, backend, and traditional applications. With SurrealDB, you can simplify your database and API infrastructure, reduce development time, and build secure, performant apps quickly and cost-effectively.',
423 | 'Key features of SurrealDB include:',
424 | 'View the features, the latest releases, the product roadmap, and documentation.',
425 | 'Contents',
426 | 'Features',
427 | 'Documentation',
428 | 'For guidance on installation, development, deployment, and administration, see our documentation.',
429 | 'Installation',
430 | 'SurrealDB is designed to be simple to install and simple to run - using just one command from your terminal. In addition to traditional installation, SurrealDB can be installed and run with HomeBrew, Docker, or using any other container orchestration tool such as Docker Compose, Docker Swarm, Rancher, or in Kubernetes.',
431 | 'Install on macOS',
432 | "The quickest way to get going with SurrealDB on macOS is to use Homebrew. This will install both the command-line tools, and the SurrealDB server as a single executable. If you don't use Homebrew, follow the instructions for Linux below to install SurrealDB.",
433 | 'Install on Linux',
434 | 'The easiest and preferred way to get going with SurrealDB on Unix operating systems is to install and use the SurrealDB command-line tool. Run the following command in your terminal and follow the on-screen instructions.',
435 | "If you want a binary newer than what's currently released, you can install the nightly one.",
436 | 'Install on Windows',
437 | 'The easiest and preferred way to get going with SurrealDB on Windows is to install and use the SurrealDB command-line tool. Run the following command in your terminal and follow the on-screen instructions.',
438 | 'Run using Docker',
439 | 'Docker can be used to manage and run SurrealDB database instances without the need to install any command-line tools. The SurrealDB docker container contains the full command-line tools for importing and exporting data from a running server, or for running a server itself.',
440 | 'For just getting started with a development server running in memory, you can pass the container a basic initialization to set the user and password as root and enable logging.',
441 | 'Getting started',
442 | 'Getting started with SurrealDB is as easy as starting up the SurrealDB database server, choosing your platform, and integrating its SDK into your code. You can easily get started with your platform of choice by reading one of our tutorials.',
443 | 'Client side apps',
444 | 'Server side code',
445 | 'Quick look',
446 | 'With strongly-typed data types, data can be fully modelled right in the database.',
447 | 'Store dynamically computed fields which are calculated when retrieved.',
448 | 'Easily work with unstructured or structured data, in schema-less or schema-full mode.',
449 | 'Connect records together with fully directed graph edge connections.',
450 | 'Query data flexibly with advanced expressions and graph queries.',
451 | 'Store GeoJSON geographical data types, including points, lines and polygons.',
452 | 'Write custom embedded logic using JavaScript functions.',
453 | 'Specify granular access permissions for client and application access.',
454 | 'Why SurrealDB?',
455 | 'Database, API, and permissions',
456 | "SurrealDB combines the database layer, the querying layer, and the API and authentication layer into one platform. Advanced table-based and row-based customisable access permissions allow for granular data access patterns for different types of users. There's no need for custom backend code and security rules with complicated database development.",
457 | 'Tables, documents, and graph',
458 | 'As a multi-model database, SurrealDB enables developers to use multiple techniques to store and model data, without having to choose a method in advance. With the use of tables, SurrealDB has similarities with relational databases, but with the added functionality and flexibility of advanced nested fields and arrays. Inter-document record links allow for simple to understand and highly-performant related queries without the use of JOINs, eliminating the N+1 query problem.',
459 | 'Advanced inter-document relations and analysis. No JOINs. No pain.',
460 | 'With full graph database functionality SurrealDB enables more advanced querying and analysis. Records (or vertices) can be connected to one another with edges, each with its own record properties and metadata. Simple extensions to traditional SQL queries allow for multi-table, multi-depth document retrieval, efficiently in the database, without the use of complicated JOINs and without bringing the data down to the client.',
461 | 'Simple schema definition for frontend and backend development',
462 | 'With SurrealDB, specify your database and API schema in one place, and define column rules and constraints just once. Once a schema is defined, database access is automatically granted to the relevant users. No more custom API code, and no more GraphQL integration. Simple, flexible, and ready for production in minutes not months.',
463 | 'Connect and query directly from web-browsers and client devices',
464 | 'Connect directly to SurrealDB from any end-user client device. Run SurrealQL queries directly within web-browsers, ensuring that users can only view or modify the data that they are allowed to access. Highly-performant WebSocket connections allow for efficient bi-directional queries, responses and notifications.',
465 | 'Query the database with the tools you want',
466 | 'Your data, your choice. SurrealDB is designed to be flexible to use, with support for SurrealQL, GraphQL (coming soon), CRUD support over REST, and JSON-RPC querying and modification over WebSockets. With direct-to-client connection with in-built permissions, SurrealDB speeds up the development process, and fits in seamlessly into any tech stack.',
467 | 'Realtime live queries and data changes direct to application',
468 | 'SurrealDB keeps every client device in-sync with data modifications pushed in realtime to the clients, applications, end-user devices, and server-side libraries. Live SQL queries allow for advanced filtering of the changes to which a client subscribes, and efficient data formats, including DIFFing and PATCHing enable highly-performant web-based data syncing.',
469 | 'Scale effortlessly to hundreds of nodes for high-availability and scalability',
470 | 'SurrealDB can be run as a single in-memory node, or as part of a distributed cluster - offering highly-available and highly-scalable system characteristics. Designed from the ground up to run in a distributed environment, SurrealDB makes use of special techniques when handling multi-table transactions, and document record IDs - with no use of table or row locks.',
471 | 'Extend your database with JavaScript functions',
472 | 'Embedded JavaScript functions allow for advanced, custom functionality, with computation logic being moved to the data layer. This improves upon the traditional approach of moving data to the client devices before applying any computation logic, ensuring that only the necessary data is transferred remotely. These advanced JavaScript functions, with support for the ES2020 standard, allow any developer to analyse the data in ever more simple-yet-advanced ways.',
473 | 'Designed to be embedded or to run distributed in the cloud',
474 | 'Built entirely in Rust as a single library, SurrealDB is designed to be used as both an embedded database library with advanced querying functionality, and as a database server which can operate in a distributed cluster. With low memory usage and cpu requirements, the system requirements have been specifically thought through for running in all types of environment.',
475 | 'Community',
476 | 'Join our growing community around the world, for help, ideas, and discussions regarding SurrealDB.',
477 | 'Contributing',
478 | 'We would for you to get involved with SurrealDB development! If you wish to help, you can learn more about how you can contribute to this project in the contribution guide.',
479 | 'Security',
480 | 'For security issues, view our vulnerability policy, view our security policy, and kindly email us at security@surrealdb.com instead of posting a public issue on GitHub.',
481 | 'License',
482 | 'Source code for SurrealDB is variously licensed under a number of different licenses. A copy of each license can be found in each repository.',
483 | 'For more information, see the licensing information.',
484 | 'About',
485 | 'A scalable, distributed, collaborative, document-graph database, for the realtime web',
486 | 'Topics',
487 | 'Resources',
488 | 'License',
489 | 'Code of conduct',
490 | 'Security policy',
491 | 'Stars',
492 | ... 8 more items
493 | ],
494 | id: 'page:⟨/github⟩',
495 | score: 16.174237728118896,
496 | title: 'GitHub - surrealdb/surrealdb: A scalable, distributed, collaborative, document-graph database, for the realtime web'
497 | },
498 | {
499 | content: [
500 | 'Product',
501 | 'Community',
502 | '| Join us in September',
503 | 'Understand why SurrealDB is the ultimate cloud database.',
504 | "Get a detailed overview of all of SurrealDB's technical features.",
505 | 'Keep track of the notable updates and improvements for every SurrealDB product release in chronological order.',
506 | 'See what we have planned for SurrealDB, and see the features and functionality which has already been implemented.',
507 | 'Getting started',
508 | 'In this guide, we will walk you through installing SurrealDB on your machine, defining your schema, and writing some queries with SurrealQL.',
509 | 'Start the database',
510 | 'First ensure that your database is set up correctly. To do so, run:',
511 | 'user@localhost % surreal version ## 1.0.0-beta.9+20230402.5eafebd',
512 | 'To start your database, run the start command specific to your machine.',
513 | 'macOS or Linux',
514 | 'user@localhost % surreal start --user root --pass root memory',
515 | 'Windows',
516 | 'PS C:\\> surreal.exe start --user root --pass root memory',
517 | "Here's what each segment of this command does:",
518 | 'surreal start',
519 | '--user root --pass root',
520 | 'root',
521 | 'memory',
522 | 'Using SurrealQL',
523 | 'Using SurrealQL, you can query data from your SurrealDB database. While this is not a requirement for getting started, it is helpful to familiarise yourself with some commands.',
524 | 'Once you have your database running, head over to Surrealist.app, which defaults to your local http://localhost:8000/. Using Surrealist, you can try out the following commands:',
525 | 'http://localhost:8000/',
526 | 'CREATE',
527 | 'CREATE',
528 | 'The create command is used to add records to the database.',
529 | "CREATE account SET name = 'ACME Inc', created_at = time::now() ;",
530 | 'The account record will be created, and a random ID has been generated for this record. In SurrealDB every record can be created and accessed directly by its ID.',
531 | 'account',
532 | 'In SurrealDB, every record can be created and accessed directly by its ID. In the following query, we will create a record, but will use a specific ID.',
533 | "CREATE author:john SET name.first = 'John', name.last = 'Adams', name.full = string::join(' ', name.first, name.last), age = 29, admin = true, signup_at = time::now() ;",
534 | 'You can also link records to each other by creating a mutual record, for example, create a blog article record, which links to the author and account tables. In the following example we link to the author record directly by its ID, and we link to the account record with a subquery which searches using the name field.',
535 | 'name',
536 | "Let's now create a blog article record, which links to the author and account tables. In the following example we link to the author record directly by its ID, and we link to the account record with a subquery which gives us the ID for ACME Inc.",
537 | 'author',
538 | 'account',
539 | "CREATE article SET created_at = time::now(), author = author:john, title = 'Lorem ipsum dolor', text = 'Donec eleifend, nunc vitae commodo accumsan, mauris est fringilla.', account = (SELECT VALUE id FROM account WHERE name = 'ACME Inc' LIMIT 1)[0] ;",
540 | 'Querying data with SELECT',
541 | 'SELECT',
542 | 'The querying functionality in SurrealDB works similarly to a traditional SQL, but with many of the added benefits of NoSQL query languages. To retrieve data, we will use a SELECT query. You can query all the articles in your records and this will also return the record links.',
543 | 'SELECT',
544 | 'SELECT * FROM article;',
545 | "Also in SurrealDB we can retrieve data from multiple different tables or records at once. In the example below we'll retrieve data from both the 'article' and the 'account' table in one query.",
546 | 'SELECT * FROM article, account;',
547 | 'Also, Instead of pulling data from multiple tables and merging that data together, SurrealDB allows you to traverse related records efficiently without needing to use JOINs. In the following example, we will get all the articles where the author is younger than 30. In order to get the information for the author age for our filter condition we need to fetch the relevant records from the author table.',
548 | 'SELECT * FROM article WHERE author.age < 30 FETCH author, account;',
549 | 'UPDATE',
550 | 'UPDATE',
551 | 'Similar to UPDATE in SQL you can also update specific IDs, for example say you wanted to update the first name of the author you can do so:',
552 | "UPDATE person:john SET name = 'David'",
553 | 'you can also update specific fields:',
554 | "UPDATE person:john SET admin = false WHERE name.last = 'Adams';",
555 | 'DELETE',
556 | 'DELETE',
557 | 'You can also delete specific records DELETE person:david. You could also delete a record with specific conditions:',
558 | 'DELETE',
559 | "DELETE article WHERE author = 'David';",
560 | 'REMOVE',
561 | 'REMOVE',
562 | 'You can also remove a specific table using the REMOVE TABLE:',
563 | 'REMOVE TABLE',
564 | 'REMOVE TABLE person',
565 | 'Congratulations, you’re now on your way to database and API simplicity! For the next steps, take a look at some of our in-depth guides to see some of the other advanced functionality that you can use in SurrealDB.',
566 | 'Learn more',
567 | 'By completing this guide you have successfully set up a SurrealDB database and ran some SurrealQL queries. To learn more about SurrealQL, refer to the SurrealQL guides.',
568 | 'With an SQL-style query language, real-time queries with highly-efficient related data retrieval, advanced security permissions for multi-tenant access, and support for performant analytical workloads, SurrealDB is the next generation serverless database.',
569 | 'Product',
570 | 'Community',
571 | 'Legal',
572 | 'About',
573 | 'Copyright © SurrealDB Ltd. Registered in England and Wales, no. 13615201 Registered address: Huckletree Oxford Circus, 213 Oxford Street, London, W1D 2LG'
574 | ],
575 | id: 'page:⟨/docs/introduction/start⟩',
576 | score: 12.233445882797241,
577 | title: 'SurrealDB | Documentation'
578 | },
579 | {
580 | content: [
581 | 'Product',
582 | 'Community',
583 | '| Join us in September',
584 | 'Understand why SurrealDB is the ultimate cloud database.',
585 | "Get a detailed overview of all of SurrealDB's technical features.",
586 | 'Keep track of the notable updates and improvements for every SurrealDB product release in chronological order.',
587 | 'See what we have planned for SurrealDB, and see the features and functionality which has already been implemented.',
588 | 'Deploy on Kubernetes',
589 | 'In this guide, we will deploy SurrealDB to KIND (Kubernetes in Docker) using TiKV as the storage engine: TiKV is a cloud-native transactional key/value store that integrates well with Kubernetes thanks to their tidb-operator.',
590 | 'At the end, we will run a few experiments using SurrealQL to verify that we can interact with the new cluster and will destroy some Kubernetes pods to see that data is highly available.',
591 | 'Requirements',
592 | 'For this guide, we need to install:',
593 | 'kubectl',
594 | 'helm',
595 | 'KIND',
596 | 'Docker',
597 | 'Surreal CLI',
598 | 'Create KIND Cluster',
599 | 'KIND',
600 | 'First, we need to create a KIND cluster. KIND is a tool for running local Kubernetes clusters using Docker container “nodes”. It’s a great tool for experimenting with Kubernetes without spending a lot of time creating a full-featured cluster.',
601 | 'KIND',
602 | 'Run the following command to create a cluster:',
603 | 'Let’s create a new cluster:',
604 | '$ kind create cluster -n surreal-demo',
605 | 'Verify we can interact with the created cluster',
606 | '$ kubectl config current-context kind-surreal-demo $ kubectl get ns NAME STATUS AGE default Active 79s kube-node-lease Active 79s kube-public Active 79s kube-system Active 79s local-path-storage Active 75s',
607 | 'Deploy TiDB operator',
608 | 'Now that we have a Kubernetes cluster, we can deploy the TiDB operator . TiDB operator is a Kubernetes operator that manages the lifecycle of TiDB clusters deployed to Kubernetes.',
609 | 'TiDB',
610 | 'You can deploy it following these steps:',
611 | 'Install CRDS:',
612 | '$ kubectl create -f https://raw.githubusercontent.com/pingcap/tidb-operator/v1.4.4/manifests/crd.yaml',
613 | 'Install TiDB Operator Helm chart:',
614 | '$ helm repo add pingcap https://charts.pingcap.org $ helm repo update $ helm install \\ -n tidb-operator \\ --create-namespace \\ tidb-operator \\ pingcap/tidb-operator \\ --version v1.4.4',
615 | 'Verify that the Pods are running:',
616 | '$ kubectl get pods --namespace tidb-operator -l app.kubernetes.io/instance=tidb-operato r NAME READY STATUS RESTARTS AGE tidb-controller-manager-56f49794d7-hnfz7 1/1 Running 0 20s tidb-scheduler-8655bcbc86-66h2d 2/2 Running 0 20s',
617 | 'Create TiDB cluster',
618 | 'Now that we have the TiDB Operator running, it’s time to define a TiDB Cluster and let the Operator do the rest. One of the TiDB Cluster components is the TiKV, which we are interested in. Given this is a demo, we will use a basic example cluster, but there are several examples in the official GitHub repo in case you need a more production-grade deployment',
619 | 'Given this is a demo, we will use a basic example cluster, but there are several examples in the official GitHub repo in case you need a more production-grade deployment',
620 | 'Run the following commands to deploy the TiKV cluster:',
621 | 'Create a namespace for the TiDB cluster:',
622 | 'TiDB cluster',
623 | '$ kubectl create ns tikv',
624 | 'Create the TiDB cluster:',
625 | '$ kubectl apply -n tikv -f https://raw.githubusercontent.com/pingcap/tidb-operator/v1.4.4/examples/basic/tidb-cluster.yaml',
626 | 'Check the cluster status and wait until it’s ready:',
627 | '$ kubectl get -n tikv tidbcluster NAME READY PD STORAGE READY DESIRE TIKV STORAGE READY DESIRE TIDB READY DESIRE AGE basic False pingcap/pd:v6.5.0 1Gi 1 1 1Gi 1 1 41s $ kubectl get -n tikv tidbcluster NAME READY PD STORAGE READY DESIRE TIKV STORAGE READY DESIRE TIDB READY DESIRE AGE basic True pingcap/pd:v6.5.0 1Gi 1 1 pingcap/tikv:v6.5.0 1Gi 1 1 pingcap/tidb:v6.5.0 1 1 5m',
628 | 'Deploy SurrealDB',
629 | 'Now that we have a TiDB cluster running, we can deploy SurrealDB. For this guide, we will use the SurrealDB Helm chart. Run the following commands to deploy SurrealDB:',
630 | 'For this guide, we will use the SurrealDB Helm chart. Run the following commands to deploy SurrealDB:',
631 | 'Add the SurrealDB Charts repository:',
632 | '$ helm repo add surrealdb https://helm.surrealdb.com $ helm repo update',
633 | 'Get the TIKV PD service url:',
634 | '$ kubectl get -n tikv svc/basic-pd NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE basic-pd ClusterIP 10.96.208.25 2379/TCP 10h $ export TIKV_URL=tikv://basic-pd.tikv:2379',
635 | 'Install the SurrealDB Helm chart with the TIKV_URL defined above:',
636 | '$ helm install --set surrealdb.path=$TIKV_URL surrealdb-tikv surrealdb/surrealdb',
637 | 'Verify that the SurrealDB Pods are running:',
638 | `$ kubectl logs -f deployments/surrealdb-tikv 2023-06-06T08:07:47.982960Z INFO surrealdb::env: Running 1.0.0-beta.9+20230401.c3773b2 for linux on aarch64 2023-06-06T08:07:47.982988Z INFO surrealdb::iam: Root authentication is enabled 2023-06-06T08:07:47.982990Z INFO surrealdb::iam: Root username is 'root' 2023-06-06T08:07:47.982991Z INFO surrealdb::dbs: Database strict mode is disabled 2023-06-06T08:07:47.983023Z INFO surrealdb::kvs: Connecting to kvs store at tikv://basic-pd.tikv:2379 2023-06-06T08:07:47.999548Z INFO surrealdb::kvs: Connected to kvs store at tikv://basic-pd.tikv:2379 2023-06-06T08:07:47.999667Z INFO surrealdb::net: Starting web server on 0.0.0.0:8000 2023-06-06T08:07:47.999758Z INFO surrealdb::net: Started web server on 0.0.0.0:8000 2023-06-06T08:07:48.617919Z INFO surrealdb::net: 10.244.0.1:49264 GET /health HTTP/1.1 200 "kube-probe/1.27" 1.238584ms`,
639 | 'Run SurrealDB experiments',
640 | 'Now that we have SurrealDB running, we can run some experiments to verify that everything is working as expected. For this guide, we will use the Surreal CLI. Run the following commands to run some experiments:',
641 | 'For this guide, we will use the Surreal CLI. Run the following commands to run some experiments:',
642 | 'Start port-forwarding to the SurrealDB service:',
643 | '$ kubectl port-forward svc/surrealdb-tikv 8000 Forwarding from 127.0.0.1:8000 -> 8000 Forwarding from [::1]:8000 -> 8000',
644 | 'Connect to the SurrealDB server using the CLI from another shell:',
645 | "$ surreal sql --conn 'http://localhost:8000' --user root --pass surrealdb",
646 | 'Create a SurrealDB database:',
647 | "$ surreal sql --conn 'http://localhost:8000' --user root --pass surrealdb > USE NS ns DB db; ns/db> CREATE record; { id: record:wbd69kmc81l4fbee7pit } ns/db> CREATE record; { id: record:vnyfsr22ovhmmtcm5y1t } ns/db> CREATE record; { id: record:se49petzb7c4bc7yge0z } ns/db> SELECT * FROM record; [{ id: record:se49petzb7c4bc7yge0z }, { id: record:vnyfsr22ovhmmtcm5y1t }, { id: record:wbd69kmc81l4fbee7pit }] ns/db>",
648 | 'The data created above has been persisted to the TiKV cluster. Let’s verify it by deleting the SurrealDB server and let Kubernetes recreate it.',
649 | '$ kubectl get pod NAME READY STATUS RESTARTS AGE surrealdb-tikv-7488f6f654-lsrwp 1/1 Running 0 13m $ kubectl delete pod surrealdb-tikv-7488f6f654-lsrwp pod "surrealdb-tikv-7488f6f654-lsrwp" deleted $ kubectl get pod NAME READY STATUS RESTARTS AGE surrealdb-tikv-7488f6f654-bnkjz 1/1 Running 0 4s',
650 | 'Connect again and verify the data is still there (you may need to re-run the port-forwarding command):',
651 | "$ surreal sql --conn 'http://localhost:8000' --user root --pass surrealdb > USE NS ns DB db; ns/db> SELECT * FROM record; [{ id: record:se49petzb7c4bc7yge0z }, { id: record:vnyfsr22ovhmmtcm5y1t }, { id: record:wbd69kmc81l4fbee7pit }] ns/db>",
652 | 'Given we are using KIND, we use port-forwarding for demonstration purposes. In a full-featured Kubernetes cluster, you could set ingress.enabled=true when installing the SurrealDB Helm Chart and it would create a Load Balancer in front of the SurrealDB server pods.',
653 | 'port-forwarding',
654 | 'In a full-featured Kubernetes cluster, you could set ingress.enabled=true when installing the SurrealDB Helm Chart and it would create a Load Balancer in front of the SurrealDB server pods.',
655 | 'ingress.enabled=true',
656 | 'Conclusion',
657 | 'This guide demonstrated how to deploy SurrealDB on Kubernetes using TiKV as a datastore. From here, you could try and deploy to EKS , GKE or AKS , and play with the different configurations for the TiKV cluster.',
658 | 'EKS',
659 | 'GKE',
660 | 'AKS',
661 | 'To contribute to this documentation, edit this file on GitHub.',
662 | 'With an SQL-style query language, real-time queries with highly-efficient related data retrieval, advanced security permissions for multi-tenant access, and support for performant analytical workloads, SurrealDB is the next generation serverless database.',
663 | 'Product',
664 | 'Community',
665 | 'Legal',
666 | 'About',
667 | 'Copyright © SurrealDB Ltd. Registered in England and Wales, no. 13615201 Registered address: Huckletree Oxford Circus, 213 Oxford Street, London, W1D 2LG'
668 | ],
669 | id: 'page:⟨/docs/deployment/kubernetes⟩',
670 | score: 4.429085731506348,
671 | title: 'SurrealDB | Documentation'
672 | }
673 | ]
674 | ```
675 |
676 |
--------------------------------------------------------------------------------
/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "sitemap": "sitemap.xml",
3 | "surreal": {
4 | "url": "http://127.0.0.1:8000/rpc",
5 | "ns": "test",
6 | "db": "test",
7 | "user": "root",
8 | "pass": "root"
9 | }
10 | }
--------------------------------------------------------------------------------
/index.ts:
--------------------------------------------------------------------------------
1 | import fs from "fs";
2 | import axios from "axios";
3 | import { parseStringPromise } from "xml2js";
4 | import puppeteer, { Page } from "puppeteer";
5 | import { Surreal } from "surrealdb.js";
6 |
7 | const parseSitemap = async (db: Surreal, page: Page, sitemapPath: string) => {
8 | let xmlData: string;
9 | // The sitemap can be loaded from the website
10 | if (sitemapPath.startsWith("http")) {
11 | const response = await axios.get(sitemapPath);
12 | xmlData = response.data;
13 | } else {
14 | // Or from the local file system
15 | xmlData = fs.readFileSync(sitemapPath, "utf8");
16 | }
17 |
18 | const sitemap = await parseStringPromise(xmlData);
19 | const urls = sitemap.urlset.url;
20 | console.log(`The sitemap at "${sitemapPath}" contains ${urls.length} url(s)`);
21 | const locs: string[] = urls.map(
22 | (url: any) => url.loc[0] as unknown as string
23 | );
24 | for (const [index, loc] of locs.entries()) {
25 | console.log(`Crawling page ${index + 1}/${locs.length}: ${loc}`);
26 | await scrapPage(db, page, loc);
27 | }
28 | return locs.length;
29 | };
30 |
31 | const scrapPage = async (db: Surreal, page: Page, url: string) => {
32 | await page.goto(url, { waitUntil: "networkidle2" });
33 |
34 | const title = await page.title();
35 |
36 | // Extract H1:
37 | const h1 = extractText(
38 | await page.evaluate(() =>
39 | Array.from(
40 | document.querySelectorAll("h1"),
41 | (element) => element.textContent
42 | )
43 | )
44 | );
45 |
46 | // Extract H2:
47 | const h2 = extractText(
48 | await page.evaluate(() =>
49 | Array.from(
50 | document.querySelectorAll("h2"),
51 | (element) => element.textContent
52 | )
53 | )
54 | );
55 |
56 | // Extract H3:
57 | const h3 = extractText(
58 | await page.evaluate(() =>
59 | Array.from(
60 | document.querySelectorAll("h3"),
61 | (element) => element.textContent
62 | )
63 | )
64 | );
65 |
66 | // Extract H4:
67 | const h4 = extractText(
68 | await page.evaluate(() =>
69 | Array.from(
70 | document.querySelectorAll("h4"),
71 | (element) => element.textContent
72 | )
73 | )
74 | );
75 |
76 | // Extract code:
77 | const code = extractText(
78 | await page.evaluate(() =>
79 | Array.from(
80 | document.querySelectorAll("code"),
81 | (element) => element.textContent
82 | )
83 | )
84 | );
85 |
86 | // Extract every indexable text blocks
87 | const content = extractText(
88 | await page.evaluate(() =>
89 | Array.from(
90 | document.querySelectorAll("p,h1,h2,h3,h4,h5,h6,tr,th,td,code"),
91 | (element) => element.textContent
92 | )
93 | )
94 | );
95 |
96 | if (content.length > 0) {
97 | await indexPage(db, url, title, h1, h2, h3, h4, content, code);
98 | }
99 | };
100 |
101 | const extractText = (blocks: (string | null)[]) => {
102 | const text: string[] = [];
103 | for (const block of blocks) {
104 | if (block) {
105 | // Make the block prettier, by removing any extra spaces.
106 | const parts: string[] = block.split(/\s+/);
107 | const trimmedParts: string[] = parts.filter(Boolean); // This removes any empty strings
108 | const trimmedBlock: string = trimmedParts.join(" ");
109 | if (trimmedBlock.length > 0) {
110 | text.push(trimmedBlock);
111 | }
112 | }
113 | }
114 | return text;
115 | };
116 |
117 | const indexPage = async (
118 | db: Surreal,
119 | url: string,
120 | title: string,
121 | h1: string[],
122 | h2: string[],
123 | h3: string[],
124 | h4: string[],
125 | content: string[],
126 | code: string[]
127 | ) => {
128 | const u = new URL(url);
129 | const path = u.pathname;
130 | const recordId = `page:⟨${path}⟩`;
131 | console.log(`Indexing "${recordId}"`);
132 | await db.delete(recordId);
133 | const start = Date.now();
134 | await db.create("page", {
135 | id: u.pathname,
136 | title,
137 | path,
138 | h1,
139 | h2,
140 | h3,
141 | h4,
142 | content,
143 | code,
144 | });
145 | const elapsed = Date.now() - start;
146 | console.log(`Elapsed time: ${elapsed} ms`);
147 | };
148 |
149 | interface Config {
150 | sitemap: string;
151 | surreal: {
152 | url: string;
153 | ns: string;
154 | db: string;
155 | user: string;
156 | pass: string;
157 | };
158 | }
159 |
160 | const crawl = async (config: Config, db: Surreal) => {
161 | let browser;
162 | try {
163 | // Start the headless browser
164 | browser = await puppeteer.launch({ headless: "new" });
165 | const page = await browser.newPage();
166 | await page.setViewport({ width: 1080, height: 1024 });
167 |
168 | // Start the crawling
169 | const count = await parseSitemap(db, page, config.sitemap);
170 | console.log(`${count} page(s) crawled`);
171 | } finally {
172 | if (browser) {
173 | await browser.close();
174 | }
175 | }
176 | };
177 |
178 | const initSurreal = async (config: Config): Promise => {
179 | // Connect to SurrealDB instance
180 | const db = new Surreal(config.surreal.url);
181 |
182 | // Signin as a namespace, database, or root user
183 | await db.signin({
184 | user: config.surreal.user,
185 | pass: config.surreal.pass,
186 | });
187 |
188 | // Select a specific namespace / database
189 | await db.use({ ns: config.surreal.ns, db: config.surreal.db });
190 | return db;
191 | };
192 |
193 | const execute = async (db: Surreal, sql: string) => {
194 | const start = Date.now();
195 | const res = await db.query(sql);
196 | const elapsed = Date.now() - start;
197 | for (const r of res) {
198 | if (r.result) {
199 | console.log(r.result);
200 | }
201 | }
202 | console.log(`Elapsed time: ${elapsed} ms`);
203 | };
204 |
205 | const initIndex = async (db: Surreal) => {
206 | const sql = "DEFINE ANALYZER simple TOKENIZERS blank,class,camel,punct FILTERS snowball(english);\
207 | DEFINE INDEX page_title ON page FIELDS title SEARCH ANALYZER simple BM25(1.2,0.75);\
208 | DEFINE INDEX page_path ON page FIELDS path SEARCH ANALYZER simple BM25(1.2,0.75);\
209 | DEFINE INDEX page_h1 ON page FIELDS h1 SEARCH ANALYZER simple BM25(1.2,0.75);\
210 | DEFINE INDEX page_h2 ON page FIELDS h2 SEARCH ANALYZER simple BM25(1.2,0.75);\
211 | DEFINE INDEX page_h3 ON page FIELDS h3 SEARCH ANALYZER simple BM25(1.2,0.75);\
212 | DEFINE INDEX page_h4 ON page FIELDS h4 SEARCH ANALYZER simple BM25(1.2,0.75);\
213 | DEFINE INDEX page_content ON page FIELDS content SEARCH ANALYZER simple BM25(1.2,0.75) HIGHLIGHTS;\
214 | DEFINE INDEX page_code ON page FIELDS code SEARCH ANALYZER simple BM25(1.2,0.75);";
215 | await execute(db, sql);
216 | };
217 |
218 | const search = async (db: Surreal, keywords: string | undefined) => {
219 | const sql = `SELECT \
220 | id, \
221 | title, \
222 | search::highlight('', '', 6) AS content, \
223 | search::score(0) * 7 + search::score(1) * 6 + search::score(2) * 5 + search::score(3) * 4 \
224 | + search::score(4) * 3 + search::score(5) * 2 + search::score(6) AS score \
225 | FROM page \
226 | WHERE title @0@ '${keywords}' \
227 | OR path @1@ '${keywords}' \
228 | OR h1 @2@ '${keywords}' \
229 | OR h2 @3@ '${keywords}' \
230 | OR h3 @4@ '${keywords}' \
231 | OR h4 @5@ '${keywords}' \
232 | OR content @6@ '${keywords}' \
233 | ORDER BY score DESC LIMIT 10`;
234 | await execute(db, sql);
235 | };
236 |
237 | const fast = async (db: Surreal, keywords: string | undefined) => {
238 | const sql = `SELECT \
239 | id, \
240 | title, \
241 | search::highlight('', '', 0) AS content, \
242 | search::score(0) AS score \
243 | FROM page \
244 | WHERE content @0@ '${keywords}' \
245 | ORDER BY score DESC LIMIT 10`;
246 | await execute(db, sql);
247 | };
248 |
249 | const main = async () => {
250 | const [cmd, arg] = process.argv.slice(2);
251 |
252 | try {
253 | // Load the configuration
254 | const data = fs.readFileSync("config.json", "utf8");
255 | const config: Config = JSON.parse(data);
256 |
257 | // Connect to SurrealDB instance
258 | const db = await initSurreal(config);
259 | switch (cmd.toLocaleLowerCase()) {
260 | case "crawl":
261 | await crawl(config, db);
262 | break;
263 | case "init":
264 | await initIndex(db);
265 | break;
266 | case "search":
267 | await search(db, arg);
268 | break;
269 | case "fast":
270 | await fast(db, arg);
271 | break;
272 | default:
273 | console.error(`Unknown command ${cmd}`);
274 | break;
275 | }
276 | } finally {
277 | process.exit();
278 | }
279 | };
280 |
281 | main();
282 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "axios": "^1.4.0",
4 | "puppeteer": "^20.7.1",
5 | "surrealdb.js": "^0.8.0",
6 | "xml2js": "^0.6.0"
7 | },
8 | "name": "surrealdb-web-indexer",
9 | "description": "",
10 | "version": "1.0.0",
11 | "main": "index.js",
12 | "devDependencies": {
13 | "@types/xml2js": "^0.4.11",
14 | "@typescript-eslint/eslint-plugin": "^5.59.11",
15 | "eslint": "^8.42.0",
16 | "eslint-config-standard-with-typescript": "^35.0.0",
17 | "eslint-plugin-import": "^2.27.5",
18 | "eslint-plugin-n": "^15.7.0",
19 | "eslint-plugin-promise": "^6.1.1",
20 | "prettier": "^2.8.8",
21 | "ts-node": "^10.9.1",
22 | "typescript": "^5.1.3"
23 | },
24 | "scripts": {
25 | "init": "ts-node index.ts init",
26 | "crawl": "ts-node index.ts crawl",
27 | "search": "ts-node index.ts search",
28 | "fast": "ts-node index.ts fast",
29 | "format": "prettier --write \"./**/*.ts\"",
30 | "lint": "eslint . --ext .ts"
31 | },
32 | "keywords": [],
33 | "author": "Emmanuel Keller",
34 | "license": "MIT"
35 | }
--------------------------------------------------------------------------------
/prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "semi": true,
3 | "trailingComma": "all",
4 | "singleQuote": true,
5 | "printWidth": 80,
6 | "tabWidth": 4
7 | }
--------------------------------------------------------------------------------
/sitemap.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | https://www.surrealdb.com/
5 |
6 |
7 | https://www.surrealdb.com/about
8 |
9 |
10 | https://www.surrealdb.com/careers
11 |
12 |
13 | https://www.surrealdb.com/app
14 |
15 |
16 | https://www.surrealdb.com/community
17 |
18 |
19 | https://www.surrealdb.com/discord
20 |
21 |
22 | https://www.surrealdb.com/features
23 |
24 |
25 | https://www.surrealdb.com/github
26 |
27 |
28 | https://www.surrealdb.com/install
29 |
30 |
31 | https://www.surrealdb.com/license
32 |
33 |
34 | https://www.surrealdb.com/media
35 |
36 |
37 | https://www.surrealdb.com/opensource
38 |
39 |
40 | https://www.surrealdb.com/releases
41 |
42 |
43 | https://www.surrealdb.com/roadmap
44 |
45 |
46 | https://www.surrealdb.com/snippet
47 |
48 |
49 | https://www.surrealdb.com/store
50 |
51 |
52 | https://www.surrealdb.com/why
53 |
54 |
55 | https://www.surrealdb.com/who
56 |
57 |
58 | https://www.surrealdb.com/who/tobie
59 |
60 |
61 | https://www.surrealdb.com/who/jaime
62 |
63 |
64 | https://www.surrealdb.com/blog
65 |
66 |
67 | https://www.surrealdb.com/blog/post
68 |
69 |
70 | https://www.surrealdb.com/legal
71 |
72 |
73 | https://www.surrealdb.com/legal/terms
74 |
75 |
76 | https://www.surrealdb.com/legal/privacy
77 |
78 |
79 | https://www.surrealdb.com/legal/cookies
80 |
81 |
82 | https://www.surrealdb.com/legal/security
83 |
84 |
85 | https://www.surrealdb.com/legal/giveaway
86 |
87 |
88 | https://www.surrealdb.com/usecase
89 |
90 |
91 | https://www.surrealdb.com/usecase/jamstack
92 |
93 |
94 | https://www.surrealdb.com/usecase/serverless
95 |
96 |
97 | https://www.surrealdb.com/showcase
98 |
99 |
100 | https://www.surrealdb.com/showcase/modelling
101 |
102 |
103 | https://www.surrealdb.com/showcase/surrealql
104 |
105 |
106 | https://www.surrealdb.com/showcase/analytics
107 |
108 |
109 | https://www.surrealdb.com/showcase/collaborate
110 |
111 |
112 | https://www.surrealdb.com/showcase/permissions
113 |
114 |
115 | https://www.surrealdb.com/docs
116 |
117 |
118 | https://www.surrealdb.com/docs/introduction
119 |
120 |
121 | https://www.surrealdb.com/docs/introduction/start
122 |
123 |
124 | https://www.surrealdb.com/docs/introduction/concepts
125 |
126 |
127 | https://www.surrealdb.com/docs/introduction/features
128 |
129 |
130 | https://www.surrealdb.com/docs/introduction/releases
131 |
132 |
133 | https://www.surrealdb.com/docs/introduction/questions
134 |
135 |
136 | https://www.surrealdb.com/docs/introduction/architecture
137 |
138 |
139 | https://www.surrealdb.com/docs/installation
140 |
141 |
142 | https://www.surrealdb.com/docs/installation/macos
143 |
144 |
145 | https://www.surrealdb.com/docs/installation/linux
146 |
147 |
148 | https://www.surrealdb.com/docs/installation/windows
149 |
150 |
151 | https://www.surrealdb.com/docs/installation/nightly
152 |
153 |
154 | https://www.surrealdb.com/docs/installation/running
155 |
156 |
157 | https://www.surrealdb.com/docs/installation/running/docker
158 |
159 |
160 | https://www.surrealdb.com/docs/installation/running/memory
161 |
162 |
163 | https://www.surrealdb.com/docs/installation/running/file
164 |
165 |
166 | https://www.surrealdb.com/docs/installation/running/tikv
167 |
168 |
169 | https://www.surrealdb.com/docs/installation/upgrading
170 |
171 |
172 | https://www.surrealdb.com/docs/installation/upgrading/beta8-to-beta9
173 |
174 |
175 | https://www.surrealdb.com/docs/authentication
176 |
177 |
178 | https://www.surrealdb.com/docs/authentication/root
179 |
180 |
181 | https://www.surrealdb.com/docs/authentication/namespace
182 |
183 |
184 | https://www.surrealdb.com/docs/authentication/database
185 |
186 |
187 | https://www.surrealdb.com/docs/authentication/scope
188 |
189 |
190 | https://www.surrealdb.com/docs/deployment
191 |
192 |
193 | https://www.surrealdb.com/docs/deployment/google
194 |
195 |
196 | https://www.surrealdb.com/docs/deployment/amazon
197 |
198 |
199 | https://www.surrealdb.com/docs/deployment/kubernetes
200 |
201 |
202 | https://www.surrealdb.com/docs/deployment/heroku
203 |
204 |
205 | https://www.surrealdb.com/docs/deployment/digitalocean
206 |
207 |
208 | https://www.surrealdb.com/docs/deployment/fly
209 |
210 |
211 | https://www.surrealdb.com/docs/embedding
212 |
213 |
214 | https://www.surrealdb.com/docs/embedding/rust
215 |
216 |
217 | https://www.surrealdb.com/docs/embedding/node
218 |
219 |
220 | https://www.surrealdb.com/docs/embedding/javascript
221 |
222 |
223 | https://www.surrealdb.com/docs/embedding/python
224 |
225 |
226 | https://www.surrealdb.com/docs/integration
227 |
228 |
229 | https://www.surrealdb.com/docs/integration/overview
230 |
231 |
232 | https://www.surrealdb.com/docs/integration/http
233 |
234 |
235 | https://www.surrealdb.com/docs/integration/websockets
236 |
237 |
238 | https://www.surrealdb.com/docs/integration/websocket
239 |
240 |
241 | https://www.surrealdb.com/docs/integration/websocket/text
242 |
243 |
244 | https://www.surrealdb.com/docs/integration/websocket/binary
245 |
246 |
247 | https://www.surrealdb.com/docs/integration/libraries
248 |
249 |
250 | https://www.surrealdb.com/docs/integration/libraries/platform
251 |
252 |
253 | https://www.surrealdb.com/docs/integration/sdks
254 |
255 |
256 | https://www.surrealdb.com/docs/integration/sdks/angularjs
257 |
258 |
259 | https://www.surrealdb.com/docs/integration/sdks/apollo
260 |
261 |
262 | https://www.surrealdb.com/docs/integration/sdks/c
263 |
264 |
265 | https://www.surrealdb.com/docs/integration/sdks/dart
266 |
267 |
268 | https://www.surrealdb.com/docs/integration/sdks/deno
269 |
270 |
271 | https://www.surrealdb.com/docs/integration/sdks/dotnet
272 |
273 |
274 | https://www.surrealdb.com/docs/integration/sdks/emberjs
275 |
276 |
277 | https://www.surrealdb.com/docs/integration/sdks/erlang
278 |
279 |
280 | https://www.surrealdb.com/docs/integration/sdks/flutter
281 |
282 |
283 | https://www.surrealdb.com/docs/integration/sdks/golang
284 |
285 |
286 | https://www.surrealdb.com/docs/integration/sdks/java
287 |
288 |
289 | https://www.surrealdb.com/docs/integration/sdks/javascript
290 |
291 |
292 | https://www.surrealdb.com/docs/integration/sdks/nestjs
293 |
294 |
295 | https://www.surrealdb.com/docs/integration/sdks/nextjs
296 |
297 |
298 | https://www.surrealdb.com/docs/integration/sdks/nodejs
299 |
300 |
301 | https://www.surrealdb.com/docs/integration/sdks/nuxtjs
302 |
303 |
304 | https://www.surrealdb.com/docs/integration/sdks/php
305 |
306 |
307 | https://www.surrealdb.com/docs/integration/sdks/python
308 |
309 |
310 | https://www.surrealdb.com/docs/integration/sdks/r
311 |
312 |
313 | https://www.surrealdb.com/docs/integration/sdks/reactjs
314 |
315 |
316 | https://www.surrealdb.com/docs/integration/sdks/ruby
317 |
318 |
319 | https://www.surrealdb.com/docs/integration/sdks/rust
320 |
321 |
322 | https://www.surrealdb.com/docs/integration/sdks/svelte
323 |
324 |
325 | https://www.surrealdb.com/docs/integration/sdks/swift
326 |
327 |
328 | https://www.surrealdb.com/docs/integration/sdks/vuejs
329 |
330 |
331 | https://www.surrealdb.com/docs/surrealql
332 |
333 |
334 | https://www.surrealdb.com/docs/surrealql/comments
335 |
336 |
337 | https://www.surrealdb.com/docs/surrealql/operators
338 |
339 |
340 | https://www.surrealdb.com/docs/surrealql/parameters
341 |
342 |
343 | https://www.surrealdb.com/docs/surrealql/expressions
344 |
345 |
346 | https://www.surrealdb.com/docs/surrealql/transactions
347 |
348 |
349 | https://www.surrealdb.com/docs/surrealql/datamodel
350 |
351 |
352 | https://www.surrealdb.com/docs/surrealql/datamodel/ids
353 |
354 |
355 | https://www.surrealdb.com/docs/surrealql/datamodel/simple
356 |
357 |
358 | https://www.surrealdb.com/docs/surrealql/datamodel/numbers
359 |
360 |
361 | https://www.surrealdb.com/docs/surrealql/datamodel/strings
362 |
363 |
364 | https://www.surrealdb.com/docs/surrealql/datamodel/datetimes
365 |
366 |
367 | https://www.surrealdb.com/docs/surrealql/datamodel/uuids
368 |
369 |
370 | https://www.surrealdb.com/docs/surrealql/datamodel/objects
371 |
372 |
373 | https://www.surrealdb.com/docs/surrealql/datamodel/arrays
374 |
375 |
376 | https://www.surrealdb.com/docs/surrealql/datamodel/geometries
377 |
378 |
379 | https://www.surrealdb.com/docs/surrealql/datamodel/records
380 |
381 |
382 | https://www.surrealdb.com/docs/surrealql/datamodel/futures
383 |
384 |
385 | https://www.surrealdb.com/docs/surrealql/datamodel/casting
386 |
387 |
388 | https://www.surrealdb.com/docs/surrealql/statements
389 |
390 |
391 | https://www.surrealdb.com/docs/surrealql/statements/use
392 |
393 |
394 | https://www.surrealdb.com/docs/surrealql/statements/let
395 |
396 |
397 | https://www.surrealdb.com/docs/surrealql/statements/info
398 |
399 |
400 | https://www.surrealdb.com/docs/surrealql/statements/begin
401 |
402 |
403 | https://www.surrealdb.com/docs/surrealql/statements/cancel
404 |
405 |
406 | https://www.surrealdb.com/docs/surrealql/statements/commit
407 |
408 |
409 | https://www.surrealdb.com/docs/surrealql/statements/ifelse
410 |
411 |
412 | https://www.surrealdb.com/docs/surrealql/statements/select
413 |
414 |
415 | https://www.surrealdb.com/docs/surrealql/statements/insert
416 |
417 |
418 | https://www.surrealdb.com/docs/surrealql/statements/create
419 |
420 |
421 | https://www.surrealdb.com/docs/surrealql/statements/update
422 |
423 |
424 | https://www.surrealdb.com/docs/surrealql/statements/relate
425 |
426 |
427 | https://www.surrealdb.com/docs/surrealql/statements/delete
428 |
429 |
430 | https://www.surrealdb.com/docs/surrealql/statements/define
431 |
432 |
433 | https://www.surrealdb.com/docs/surrealql/statements/define/namespace
434 |
435 |
436 | https://www.surrealdb.com/docs/surrealql/statements/define/database
437 |
438 |
439 | https://www.surrealdb.com/docs/surrealql/statements/define/login
440 |
441 |
442 | https://www.surrealdb.com/docs/surrealql/statements/define/token
443 |
444 |
445 | https://www.surrealdb.com/docs/surrealql/statements/define/scope
446 |
447 |
448 | https://www.surrealdb.com/docs/surrealql/statements/define/table
449 |
450 |
451 | https://www.surrealdb.com/docs/surrealql/statements/define/event
452 |
453 |
454 | https://www.surrealdb.com/docs/surrealql/statements/define/function
455 |
456 |
457 | https://www.surrealdb.com/docs/surrealql/statements/define/field
458 |
459 |
460 | https://www.surrealdb.com/docs/surrealql/statements/define/indexes
461 |
462 |
463 | https://www.surrealdb.com/docs/surrealql/statements/define/param
464 |
465 |
466 | https://www.surrealdb.com/docs/surrealql/statements/remove
467 |
468 |
469 | https://www.surrealdb.com/docs/surrealql/statements/sleep
470 |
471 |
472 | https://www.surrealdb.com/docs/surrealql/functions
473 |
474 |
475 | https://www.surrealdb.com/docs/surrealql/functions/array
476 |
477 |
478 | https://www.surrealdb.com/docs/surrealql/functions/count
479 |
480 |
481 | https://www.surrealdb.com/docs/surrealql/functions/crypto
482 |
483 |
484 | https://www.surrealdb.com/docs/surrealql/functions/geo
485 |
486 |
487 | https://www.surrealdb.com/docs/surrealql/functions/http
488 |
489 |
490 | https://www.surrealdb.com/docs/surrealql/functions/validation
491 |
492 |
493 | https://www.surrealdb.com/docs/surrealql/functions/math
494 |
495 |
496 | https://www.surrealdb.com/docs/surrealql/functions/meta
497 |
498 |
499 | https://www.surrealdb.com/docs/surrealql/functions/parse
500 |
501 |
502 | https://www.surrealdb.com/docs/surrealql/functions/rand
503 |
504 |
505 | https://www.surrealdb.com/docs/surrealql/functions/session
506 |
507 |
508 | https://www.surrealdb.com/docs/surrealql/functions/string
509 |
510 |
511 | https://www.surrealdb.com/docs/surrealql/functions/time
512 |
513 |
514 | https://www.surrealdb.com/docs/surrealql/functions/type
515 |
516 |
517 | https://www.surrealdb.com/docs/surrealql/functions/script
518 |
519 |
520 | https://www.surrealdb.com/docs/surrealql/functions/sleep
521 |
522 |
523 | https://www.surrealdb.com/docs/cli
524 |
525 |
526 | https://www.surrealdb.com/docs/cli/start
527 |
528 |
529 | https://www.surrealdb.com/docs/cli/import
530 |
531 |
532 | https://www.surrealdb.com/docs/cli/export
533 |
534 |
535 | https://www.surrealdb.com/docs/cli/version
536 |
537 |
538 | https://www.surrealdb.com/docs/cli/isready
539 |
540 |
541 | https://www.surrealdb.com/docs/cli/sql
542 |
543 |
544 | https://www.surrealdb.com/docs/cli/help
545 |
546 |
547 | https://www.surrealdb.com/docs/guides
548 |
549 |
550 | https://www.surrealdb.com/docs/guides/schemafull-or-schemaless
551 |
552 |
553 | https://www.surrealdb.com/docs/guides/relations-and-graph
554 |
555 |
556 | https://www.surrealdb.com/docs/guides/realtime-subscriptions
557 |
558 |
559 | https://www.surrealdb.com/docs/guides/geospatial-functionality
560 |
561 |
562 | https://www.surrealdb.com/docs/guides/data-triggers
563 |
564 |
565 | https://www.surrealdb.com/docs/guides/computed-views
566 |
567 |
568 | https://www.surrealdb.com/docs/guides/authenticating-users
569 |
570 |
571 | https://www.surrealdb.com/docs/guides/deploying-surrealdb
572 |
573 |
574 | https://www.surrealdb.com/docs/guides/strict-mode
575 |
576 |
577 | https://www.surrealdb.com/docs/faqs
578 |
579 |
580 | https://www.surrealdb.com/404
581 |
582 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | /* Visit https://aka.ms/tsconfig to read more about this file */
4 |
5 | /* Projects */
6 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12 |
13 | /* Language and Environment */
14 | "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16 | // "jsx": "preserve", /* Specify what JSX code is generated. */
17 | // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26 |
27 | /* Modules */
28 | "module": "commonjs", /* Specify what module code is generated. */
29 | // "rootDir": "./", /* Specify the root folder within your source files. */
30 | // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
31 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */
36 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
37 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
38 | // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
39 | // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
40 | // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
41 | // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
42 | // "resolveJsonModule": true, /* Enable importing .json files. */
43 | // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
44 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */
45 |
46 | /* JavaScript Support */
47 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
48 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
49 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
50 |
51 | /* Emit */
52 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
53 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */
54 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
55 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
56 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
57 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
58 | // "outDir": "./", /* Specify an output folder for all emitted files. */
59 | // "removeComments": true, /* Disable emitting comments. */
60 | // "noEmit": true, /* Disable emitting files from a compilation. */
61 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
62 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
63 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
64 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
65 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
66 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
67 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
68 | // "newLine": "crlf", /* Set the newline character for emitting files. */
69 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
70 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
71 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
72 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
73 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
74 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
75 |
76 | /* Interop Constraints */
77 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
78 | // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
79 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
80 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
81 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
82 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
83 |
84 | /* Type Checking */
85 | "strict": true, /* Enable all strict type-checking options. */
86 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
87 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
88 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
89 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
90 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
91 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
92 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
93 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
94 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
95 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
96 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
97 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
98 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
99 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
100 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
101 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
102 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
103 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
104 |
105 | /* Completeness */
106 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
107 | "skipLibCheck": true /* Skip type checking all .d.ts files. */
108 | }
109 | }
110 |
--------------------------------------------------------------------------------