diff --git a/AGENTS.md b/AGENTS.md index 13571542..046809b2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -139,9 +139,8 @@ Component commands are in the nested files. auth-realtime `OXYNOTE_AUTH_REALTIME_*`, the frontend `NUXT_PUBLIC_*`. - **`_DSN` vs `_URL`**: a connection string carrying credentials ends in `_DSN`; a plain address ends in `_URL` and any credential is its own - variable (`MEILISEARCH_URL` + `_MASTER_KEY`). The suffix says whether the - value is a secret, so the same dependency is never `_DSN` on one side of - the trust boundary and `_URL` on the other. + variable (`CHANGEDETECTION_API_URL` + `_API_KEY`). The suffix says whether + the value is a secret and never changes across the trust boundary. ## Code style (TS/JS — web and auth-realtime) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 54d7fd6e..aff88078 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,9 +49,10 @@ picked up by simply running them again. The dev stack reads `docker/env/*.local.env`, which `make setup` creates from the committed `*.example.env` templates. The files are gitignored and the defaults work out of the box. Integrations (GitHub app, Slack app, AI -assistant, email, changedetection.io, Meilisearch) are optional and stay -disabled until their variables are set; the frontend hides features the -deployment does not offer. +assistant, email, changedetection.io) are optional and stay disabled until +their variables are set; the frontend hides features the deployment does +not offer. Search is built in: core keeps its index on the container's +volume and rebuilds it from Postgres when it is missing. ```sh make check-env # report variables that drifted between the templates and your local files diff --git a/README.md b/README.md index 22feeff8..f4d50153 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ docker run -d --name oxynote \ Open http://localhost:8080 and sign up.
-No PostgreSQL yet? This compose file starts one next to Oxynote, plus Meilisearch for search and Mailpit for email +No PostgreSQL yet? This compose file starts one next to Oxynote, plus Mailpit for email ```yaml name: oxynote @@ -135,8 +135,6 @@ services: - "8080:8080" environment: - OXYNOTE_DB_DSN=postgresql://oxynote:change-me-db@postgres/oxynote?sslmode=disable - - OXYNOTE_MEILISEARCH_URL=http://meilisearch:7700 - - OXYNOTE_MEILISEARCH_MASTER_KEY=change-me-meili-key # point these at a real relay to have mail delivered; here they go # to the mailpit service below. - OXYNOTE_SMTP_DSN=smtp://mailpit:1025?tls=none @@ -146,8 +144,6 @@ services: depends_on: postgres: condition: service_healthy - meilisearch: - condition: service_healthy mailpit: condition: service_started # the image shuts its services down in order, flushing open documents @@ -170,22 +166,6 @@ services: retries: 5 restart: unless-stopped - # full-text search. - meilisearch: - image: getmeili/meilisearch:v1.53.1 - environment: - - MEILI_ENV=production - - MEILI_MASTER_KEY=change-me-meili-key - - MEILI_NO_ANALYTICS=true - volumes: - - meilisearch_data:/meili_data - healthcheck: - test: ["CMD", "curl", "--fail", "http://localhost:7700/health"] - interval: 10s - timeout: 5s - retries: 5 - restart: unless-stopped - # catches every mail Oxynote sends and shows it at # http://localhost:8025. mailpit: @@ -197,13 +177,12 @@ services: volumes: oxynote_data: postgres_data: - meilisearch_data: ```
-Everything else, from search and email to object storage, the GitHub -and Slack apps, social login and Rubber Duck, is one variable away and +Everything else, from email to object storage, the GitHub and Slack +apps, social login and Rubber Duck, is one variable away and listed in [docker/prod/README.md](docker/prod/README.md). To run from source, see [CONTRIBUTING.md](CONTRIBUTING.md). diff --git a/docker/docker-compose.dev.yaml b/docker/docker-compose.dev.yaml index ffe7af10..21693195 100644 --- a/docker/docker-compose.dev.yaml +++ b/docker/docker-compose.dev.yaml @@ -70,15 +70,14 @@ services: depends_on: postgres: condition: service_healthy - meilisearch: - condition: service_healthy volumes: # optional GitHub App private key: drop oxynote.private-key.pem into # docker/github/ and set OXYNOTE_CORE_GITHUB_APP_ID to enable the # GitHub App integration. - ./github:/etc/oxynote/core/github:ro # uploaded files, which core keeps under OXYNOTE_CORE_OBJECT_STORAGE_LOCAL_PATH - # when no object store is configured. The mount is the home directory + # when no object store is configured, and the search index under + # OXYNOTE_CORE_SEARCH_INDEX_PATH. The mount is the home directory # rather than the storage path itself: core runs as a non-root uid # that owns only /home/nonroot in its image, and an empty volume # takes the ownership of the directory it is mounted over. @@ -153,32 +152,6 @@ services: mode: non-blocking max-size: 10m max-file: "3" - meilisearch: - container_name: meilisearch - image: getmeili/meilisearch:v1.53.2 - volumes: - - meilisearch_data:/meili_data - environment: - - MEILI_MASTER_KEY=devmasterkey - - MEILI_ENV=development - - MEILI_LOG_LEVEL=WARN - - MEILI_NO_ANALYTICS=true - # the data volume outlives image bumps, and meilisearch refuses to - # open a database written by an older engine unless told to upgrade - # it in place - - MEILI_UPGRADE_DB=true - healthcheck: - test: ["CMD", "curl", "--fail", "http://localhost:7700/health"] - interval: 5s - timeout: 5s - retries: 20 - restart: unless-stopped - logging: - driver: local - options: - mode: non-blocking - max-size: 10m - max-file: "3" mailpit: container_name: mailpit image: axllent/mailpit:v1.31.1 @@ -260,7 +233,6 @@ volumes: core_storage: mariadb_data: postgres_data: - meilisearch_data: valkey_data: caddy_data: caddy_config: diff --git a/docker/env/core.example.env b/docker/env/core.example.env index e08eb4ce..9aafa27a 100644 --- a/docker/env/core.example.env +++ b/docker/env/core.example.env @@ -5,10 +5,12 @@ # infrastructure wiring (compose service hostnames) OXYNOTE_CORE_DB_DSN=postgresql://devuser:devpass@postgres/devdb?sslmode=disable -# an empty DSN disables search: documents are not indexed, the search -# endpoint refuses, and the assistant loses its search tool. -OXYNOTE_CORE_MEILISEARCH_URL=http://meilisearch:7700 -OXYNOTE_CORE_MEILISEARCH_MASTER_KEY=devmasterkey +# where the search index is kept. It is a cache of the database rebuilt +# from it when missing, so it needs no backup, but it pins a deployment to +# one core instance. Core has no default for it and refuses to boot when +# it is unset. It sits next to the object storage path on the volume the +# dev stack mounts over /home/nonroot. +OXYNOTE_CORE_SEARCH_INDEX_PATH=/home/nonroot/search # an empty URL disables valkey: the assistant keeps conversation history, # checkpoints and pending confirmations in the core process instead. # redis[s]://[username:password@]host:port[/db] diff --git a/docker/prod/AGENTS.md b/docker/prod/AGENTS.md index 921f5cd2..3564d488 100644 --- a/docker/prod/AGENTS.md +++ b/docker/prod/AGENTS.md @@ -8,9 +8,10 @@ principles and TS/JS style live in the root [AGENTS.md](../../AGENTS.md). One public image (`ghcr.io/oxynote/oxynote`) running Caddy, web (Nuxt SSR), core and auth-realtime under `launcher/` (`@oxynote/launcher`, pnpm), a TypeScript supervisor run by node under tini. Postgres is the only required -external service; valkey, an S3-compatible store, meilisearch, SMTP and +external service; valkey, an S3-compatible store, SMTP and changedetection.io are optional (without a store, objects live on the data -volume). `docker-compose.example.yaml` is the canonical deployment and +volume, as does the search index, which core rebuilds from Postgres when +missing). `docker-compose.example.yaml` is the canonical deployment and `README.md` the operator reference. `docker-compose.local.yaml` is the override `make prod-run` layers on it to build the image locally and add a mailpit, since signup needs a verified address. diff --git a/docker/prod/README.md b/docker/prod/README.md index 9cde3ad1..bd073840 100644 --- a/docker/prod/README.md +++ b/docker/prod/README.md @@ -3,8 +3,10 @@ One container running the whole product: Caddy (front door), the web app (Nuxt SSR), the core API server, and the auth/realtime service, supervised by a small launcher. PostgreSQL runs outside the image and is the only thing -it requires; Valkey, an S3-compatible object store, Meilisearch, an SMTP -relay and changedetection.io are optional and also external. +it requires; Valkey, an S3-compatible object store, an SMTP relay and +changedetection.io are optional and also external. Full-text search is +built in: core keeps its index on the data volume and rebuilds it from +PostgreSQL when it is missing, so the image runs as a single instance. ## Quick start @@ -53,7 +55,6 @@ cleanly. An incomplete group fails the boot with the missing name. | --- | --- | | Valkey/Redis | `OXYNOTE_VALKEY_DSN` (`redis[s]://[user:pass@]host:port[/db]`, credentials supported). Without it the assistant keeps its conversations in the core process and sessions are not cached outside Postgres. | | Object storage | `OXYNOTE_OBJECT_STORAGE_DSN` — an S3-compatible store as one URL: `http(s)://ACCESS_KEY:SECRET_KEY@host:port/bucket[?region=...]` (the bucket defaults to `oxynote` and is created if missing). Without it uploaded images are kept on the data volume, which is the right choice for a single-node deployment. | -| Search | `OXYNOTE_MEILISEARCH_URL`, `OXYNOTE_MEILISEARCH_MASTER_KEY` | | Email | `OXYNOTE_SMTP_DSN` (`smtp[s]://[user:pass@]host:port[?tls=none\|starttls\|tls]`), `OXYNOTE_EMAIL_FROM_ADDRESS`. Without email, verification mails are logged instead of sent. | | GitHub App | `OXYNOTE_GITHUB_APP_ID`, `OXYNOTE_GITHUB_APP_SLUG`, `OXYNOTE_GITHUB_APP_SIGNATURE_SECRET`; mount the app's private key at `/oxynote/github/private-key.pem` | | Slack app | `OXYNOTE_SLACK_APP_CLIENT_ID`, `OXYNOTE_SLACK_APP_CLIENT_SECRET`, `OXYNOTE_SLACK_APP_SIGNATURE_SECRET` | diff --git a/docker/prod/docker-compose.example.yaml b/docker/prod/docker-compose.example.yaml index 3224d7a4..c9262cab 100644 --- a/docker/prod/docker-compose.example.yaml +++ b/docker/prod/docker-compose.example.yaml @@ -22,24 +22,20 @@ services: # the default, and it matches the 8080:8080 port mapping above. - OXYNOTE_PUBLIC_URL=http://localhost:8080 - OXYNOTE_DB_DSN=postgresql://oxynote:change-me-db@postgres/oxynote?sslmode=disable - # optional: full-text search. - - OXYNOTE_MEILISEARCH_URL=http://meilisearch:7700 - - OXYNOTE_MEILISEARCH_MASTER_KEY=change-me-meili-key # optional: outgoing email (signup verification, invites). Point it # at a real relay, or uncomment the mailpit service below for a # trial run and use these two lines: # - OXYNOTE_SMTP_DSN=smtp://mailpit:1025 # - OXYNOTE_EMAIL_FROM_ADDRESS=Oxynote volumes: - # generated secrets and every uploaded image live here. Losing this - # volume signs everyone out, takes the images with it and - # permanently orphans stored data-source credentials. + # generated secrets, every uploaded image and the search index live + # here. Losing this volume signs everyone out, takes the images with + # it and permanently orphans stored data-source credentials; the + # index alone is rebuilt from the database at the next start. - oxynote_data:/oxynote/data depends_on: postgres: condition: service_healthy - meilisearch: - condition: service_healthy # the image shuts its services down in order (flushing open documents # last); docker's default 10s grace would SIGKILL that mid-flush. stop_grace_period: 60s @@ -61,22 +57,6 @@ services: retries: 5 restart: unless-stopped - meilisearch: - image: getmeili/meilisearch:v1.53.2 - environment: - - MEILI_ENV=production - - MEILI_MASTER_KEY=change-me-meili-key - - MEILI_LOG_LEVEL=WARN - - MEILI_NO_ANALYTICS=true - volumes: - - meilisearch_data:/meili_data - healthcheck: - test: ["CMD", "curl", "--fail", "http://localhost:7700/health"] - interval: 10s - timeout: 5s - retries: 5 - restart: unless-stopped - # a trial-run mail sink: uncomment it together with the two OXYNOTE_SMTP # variables above and read the delivered mail at http://localhost:8025. # mailpit: @@ -87,4 +67,3 @@ services: volumes: oxynote_data: postgres_data: - meilisearch_data: diff --git a/docker/prod/launcher/src/env.test.ts b/docker/prod/launcher/src/env.test.ts index 58f1e1f5..379e74b9 100644 --- a/docker/prod/launcher/src/env.test.ts +++ b/docker/prod/launcher/src/env.test.ts @@ -320,19 +320,6 @@ describe("loadConfig", () => { }) describe("feature groups", () => { - it("requires the meilisearch master key with the URL", ({ - expect, - }) => { - expect(() => - loadConfig( - completeEnv({ - OXYNOTE_MEILISEARCH_URL: - "http://meilisearch:7700", - }), - ), - ).toThrow("OXYNOTE_MEILISEARCH_MASTER_KEY") - }) - it("rejects a companion without its keying variable", ({ expect, }) => { @@ -393,10 +380,6 @@ describe("loadConfig", () => { }) => { const config = loadConfig( completeEnv({ - OXYNOTE_MEILISEARCH_URL: - "http://meilisearch:7700", - OXYNOTE_MEILISEARCH_MASTER_KEY: - "master", OXYNOTE_CHANGE_DETECTION_URL: "http://changeDetection:5000", OXYNOTE_GITHUB_APP_ID: "123", @@ -413,10 +396,6 @@ describe("loadConfig", () => { }), ) - expect(config.meilisearch).toEqual({ - url: "http://meilisearch:7700", - masterKey: "master", - }) expect(config.changeDetection).toEqual({ url: "http://changeDetection:5000", apiKey: "", diff --git a/docker/prod/launcher/src/env.ts b/docker/prod/launcher/src/env.ts index 32178fca..d0349a16 100644 --- a/docker/prod/launcher/src/env.ts +++ b/docker/prod/launcher/src/env.ts @@ -64,7 +64,6 @@ export interface Config { objectStorage: ObjectStorageConfig | undefined smtp: SmtpConfig | undefined emailFromAddress: string - meilisearch: { url: string; masterKey: string } | undefined changeDetection: { url: string; apiKey: string } | undefined githubApp: GitHubAppConfig | undefined slackApp: SlackAppConfig | undefined @@ -339,8 +338,6 @@ const baseSchema = z.object({ OXYNOTE_OBJECT_STORAGE_DSN: objectStorageDsn.optional(), OXYNOTE_SMTP_DSN: smtpDsn.optional(), OXYNOTE_EMAIL_FROM_ADDRESS: z.string().optional(), - OXYNOTE_MEILISEARCH_URL: httpUrl().optional(), - OXYNOTE_MEILISEARCH_MASTER_KEY: z.string().optional(), OXYNOTE_CHANGE_DETECTION_URL: httpUrl().optional(), OXYNOTE_CHANGE_DETECTION_API_KEY: z.string().optional(), OXYNOTE_GITHUB_APP_ID: z @@ -404,11 +401,6 @@ const featureGroups: { requires: ["OXYNOTE_EMAIL_FROM_ADDRESS"], companions: ["OXYNOTE_EMAIL_FROM_ADDRESS"], }, - { - key: "OXYNOTE_MEILISEARCH_URL", - requires: ["OXYNOTE_MEILISEARCH_MASTER_KEY"], - companions: ["OXYNOTE_MEILISEARCH_MASTER_KEY"], - }, { key: "OXYNOTE_CHANGE_DETECTION_URL", requires: [], @@ -576,14 +568,6 @@ export function loadConfig(source: Record): Config { objectStorage: values.OXYNOTE_OBJECT_STORAGE_DSN, smtp: values.OXYNOTE_SMTP_DSN, emailFromAddress: values.OXYNOTE_EMAIL_FROM_ADDRESS ?? "", - meilisearch: values.OXYNOTE_MEILISEARCH_URL - ? { - url: values.OXYNOTE_MEILISEARCH_URL, - masterKey: - values.OXYNOTE_MEILISEARCH_MASTER_KEY ?? - "", - } - : undefined, changeDetection: values.OXYNOTE_CHANGE_DETECTION_URL ? { url: values.OXYNOTE_CHANGE_DETECTION_URL, diff --git a/docker/prod/launcher/src/index.ts b/docker/prod/launcher/src/index.ts index d73c1210..f9f329bb 100644 --- a/docker/prod/launcher/src/index.ts +++ b/docker/prod/launcher/src/index.ts @@ -131,8 +131,7 @@ function logEnabledFeatures(config: Config): void { const state = (enabled: boolean) => (enabled ? "on" : "off") log.info( - `search ${state(config.meilisearch !== undefined)}, ` + - `email ${state(config.smtp !== undefined)}, ` + + `email ${state(config.smtp !== undefined)}, ` + `github app ${state(config.githubApp !== undefined)}, ` + `slack app ${state(config.slackApp !== undefined)}, ` + `ai assistant ${state((config.aiAssistant.PROVIDER ?? "") !== "")}, ` + diff --git a/docker/prod/launcher/src/mapping.test.ts b/docker/prod/launcher/src/mapping.test.ts index 5f1d7eb7..0caabe34 100644 --- a/docker/prod/launcher/src/mapping.test.ts +++ b/docker/prod/launcher/src/mapping.test.ts @@ -194,6 +194,16 @@ describe("buildChildEnvs", () => { expect(envs.core.OXYNOTE_CORE_OBJECT_STORAGE_BUCKET).toBe("") }) + // the index is a cache of the database, kept on the volume so a restart + // does not rebuild it; operators never point it elsewhere + it("keeps the search index on the data volume", ({ expect }) => { + const envs = build() + + expect(envs.core.OXYNOTE_CORE_SEARCH_INDEX_PATH).toBe( + "/oxynote/data/search", + ) + }) + it("keeps the storage path alongside a configured object store", ({ expect, }) => { @@ -248,7 +258,6 @@ describe("buildChildEnvs", () => { it("leaves a disabled feature's variables empty", ({ expect }) => { const envs = build() - expect(envs.core.OXYNOTE_CORE_MEILISEARCH_URL).toBe("") expect(envs.core.OXYNOTE_CORE_EMAIL_SMTP_HOST).toBe("") expect(envs.core.OXYNOTE_CORE_GITHUB_APP_ID).toBe("") expect(envs.core.OXYNOTE_CORE_SLACK_CLIENT_ID).toBe("") @@ -272,10 +281,6 @@ describe("buildChildEnvs", () => { tls: "starttls", }, emailFromAddress: "Oxynote ", - meilisearch: { - url: "http://meilisearch:7700", - masterKey: "master", - }, githubApp: { appId: "123", appSlug: "oxynote", @@ -309,9 +314,6 @@ describe("buildChildEnvs", () => { expect(envs.core.OXYNOTE_CORE_EMAIL_FROM_ADDRESS).toBe( "Oxynote ", ) - expect(envs.core.OXYNOTE_CORE_MEILISEARCH_MASTER_KEY).toBe( - "master", - ) expect(envs.core.OXYNOTE_CORE_GITHUB_APP_ID).toBe("123") expect(envs.core.OXYNOTE_CORE_GITHUB_PRIVATE_KEY_PATH).toBe( "/oxynote/github/private-key.pem", diff --git a/docker/prod/launcher/src/mapping.ts b/docker/prod/launcher/src/mapping.ts index da8c0052..63665b56 100644 --- a/docker/prod/launcher/src/mapping.ts +++ b/docker/prod/launcher/src/mapping.ts @@ -24,6 +24,11 @@ export const dataDir = "/oxynote/data" // secrets do. const objectStorageLocalPath = `${dataDir}/object-storage` +// where core keeps the search index. It is a cache of the database that +// core rebuilds when it is missing, and it sits on the data volume so a +// restart does not pay for that rebuild. +const searchIndexPath = `${dataDir}/search` + // the fixed path a GitHub App's private key is mounted at when the // integration is enabled. const githubPrivateKeyPath = "/oxynote/github/private-key.pem" @@ -95,9 +100,7 @@ export function buildChildEnvs( OXYNOTE_CORE_SERVER_ADDRESS: `127.0.0.1:${corePort}`, OXYNOTE_CORE_DB_DSN: config.databaseDsn, OXYNOTE_CORE_VALKEY_DSN: config.valkeyDsn ?? "", - OXYNOTE_CORE_MEILISEARCH_URL: config.meilisearch?.url ?? "", - OXYNOTE_CORE_MEILISEARCH_MASTER_KEY: - config.meilisearch?.masterKey ?? "", + OXYNOTE_CORE_SEARCH_INDEX_PATH: searchIndexPath, // an empty URL is what makes core store objects on disk at // OBJECT_STORAGE_LOCAL_PATH instead of in a remote store. OXYNOTE_CORE_OBJECT_STORAGE_URL: diff --git a/docker/prod/launcher/src/test-helpers.ts b/docker/prod/launcher/src/test-helpers.ts index acba7645..021d055c 100644 --- a/docker/prod/launcher/src/test-helpers.ts +++ b/docker/prod/launcher/src/test-helpers.ts @@ -35,7 +35,6 @@ export function testConfig(overrides: Partial = {}): Config { }, smtp: undefined, emailFromAddress: "", - meilisearch: undefined, changeDetection: undefined, githubApp: undefined, slackApp: undefined, diff --git a/e2e/docker-compose.dev.yaml b/e2e/docker-compose.dev.yaml index fac48ed3..62bfaab9 100644 --- a/e2e/docker-compose.dev.yaml +++ b/e2e/docker-compose.dev.yaml @@ -105,8 +105,7 @@ services: image: ghcr.io/oxynote/core:e2e-dev environment: - OXYNOTE_CORE_DB_DSN=postgresql://devuser:devpass@postgres/devdb?sslmode=disable - - OXYNOTE_CORE_MEILISEARCH_URL=http://meilisearch:7700 - - OXYNOTE_CORE_MEILISEARCH_MASTER_KEY=devmasterkey + - OXYNOTE_CORE_SEARCH_INDEX_PATH=/home/nonroot/search - OXYNOTE_CORE_OBJECT_STORAGE_LOCAL_PATH=/home/nonroot/storage - OXYNOTE_CORE_SERVER_AUTH_BETTER_AUTH_URL=http://auth-realtime:8081/api/auth/get-session # the MCP surface: core validates bearer tokens against auth-realtime @@ -127,8 +126,6 @@ services: depends_on: postgres: condition: service_healthy - meilisearch: - condition: service_healthy postgres: image: postgres:18.6-alpine @@ -143,19 +140,6 @@ services: timeout: 5s retries: 20 - meilisearch: - image: getmeili/meilisearch:v1.53.2 - environment: - - MEILI_MASTER_KEY=devmasterkey - - MEILI_ENV=development - - MEILI_LOG_LEVEL=WARN - - MEILI_NO_ANALYTICS=true - healthcheck: - test: ["CMD", "curl", "--fail", "http://localhost:7700/health"] - interval: 5s - timeout: 5s - retries: 20 - # the tests read verification links out of mailpit's REST API, so its # http port is published rather than proxied through caddy. mailpit: diff --git a/e2e/docker-compose.prod.yaml b/e2e/docker-compose.prod.yaml index 79406061..62d88f6e 100644 --- a/e2e/docker-compose.prod.yaml +++ b/e2e/docker-compose.prod.yaml @@ -35,8 +35,6 @@ services: environment: - OXYNOTE_PUBLIC_URL=http://localhost:19080 - OXYNOTE_DB_DSN=postgresql://devuser:devpass@postgres/devdb?sslmode=disable - - OXYNOTE_MEILISEARCH_URL=http://meilisearch:7700 - - OXYNOTE_MEILISEARCH_MASTER_KEY=devmasterkey - OXYNOTE_SMTP_DSN=smtp://mailpit:1025?tls=none - OXYNOTE_EMAIL_FROM_ADDRESS=Oxynote - OXYNOTE_MAX_ORGANIZATION_MEMBERS=5 @@ -51,8 +49,6 @@ services: depends_on: postgres: condition: service_healthy - meilisearch: - condition: service_healthy # the image ships its own layered probe (every internal service plus the # front door), which is what the probe container and the tests wait on. # Its start period is three minutes; compose inherits that. @@ -89,18 +85,6 @@ services: timeout: 5s retries: 20 - meilisearch: - image: getmeili/meilisearch:v1.53.2 - environment: - - MEILI_MASTER_KEY=devmasterkey - - MEILI_ENV=development - - MEILI_LOG_LEVEL=WARN - healthcheck: - test: ["CMD", "curl", "--fail", "http://localhost:7700/health"] - interval: 5s - timeout: 5s - retries: 20 - # the tests read verification links out of mailpit's REST API, so its http # port is published rather than proxied through the image's front door — # which routes nothing but the product. diff --git a/e2e/tests/search.test.ts b/e2e/tests/search.test.ts index e9332539..0c980261 100644 --- a/e2e/tests/search.test.ts +++ b/e2e/tests/search.test.ts @@ -23,8 +23,8 @@ import { signUpWithWorkspace } from "../helpers/workspace" test.describe("search", () => { // on top of the usual setup, a find waits out the storage debounce - // and the ten-second search-indexing pass before the first hit can - // appear. slow() triples the budget for that chain. + // before the first hit can appear; the index itself follows the + // persist directly. slow() triples the budget for that chain. test.beforeEach(() => { test.slow() }) diff --git a/server/AGENTS.md b/server/AGENTS.md index b933ccdf..000c4446 100644 --- a/server/AGENTS.md +++ b/server/AGENTS.md @@ -11,8 +11,8 @@ auth-realtime: [auth-realtime/AGENTS.md](auth-realtime/AGENTS.md). ## Stack -- `server/core/`: one binary, `cmd/core`, on `:8080`. Owns Postgres, - Meilisearch, Valkey, object storage, the GitHub/Slack apps, the assistant +- `server/core/`: one binary, `cmd/core`, on `:8080`. Owns Postgres, the + search index, Valkey, object storage, the GitHub/Slack apps, the assistant and outbound data-source connections. - `server/auth-realtime/`: `:8081`, Better Auth (organization plugin) and Hocuspocus in one Hono process; forwards non-auth `/api/...` to core @@ -39,9 +39,9 @@ GitHub and Slack callback URLs point at `:8080/core/api/apps/...`. - `/api/...`: session-authed via auth-realtime's `/api/auth/get-session` (`SERVER_AUTH_BETTER_AUTH_URL`). `GET /api/capabilities` reports one - boolean per optional service (`github`, `slack`, `changeDetection`, - `search`), snapshotted at boot from each client's `Configured()`, plus - `aiAssistant` (`status` + `model`). + boolean per optional service (`github`, `slack`, `changeDetection`), + snapshotted at boot from each client's `Configured()`, plus `aiAssistant` + (`status` + `model`). - `/api/x/...`: no auth; auth-realtime fetches/stores branch content here (`/x/documents/{id}/branches`, `/x/documents/{id}/branch/{branchId}`), triggers emails and initializes or tears down orgs. @@ -119,12 +119,13 @@ ones included; the dev compose reads only the gitignored `*.local.env` copies. Core reads `OXYNOTE_CORE_*` through `buildinfo.Getenv("FOO")`. Every integration is optional and keyed on one variable (`GITHUB_APP_ID`, -`SLACK_CLIENT_ID`, `ASSISTANT_PROVIDER`, `MEILISEARCH_DSN`, -`CHANGEDETECTION_API_URL`, `VALKEY_ADDRESS`, `S3_URL`, `EMAIL_SMTP_HOST`). -Key set with the rest of its group missing is a boot error; key empty -disables the feature (routes answer `.not_configured`, background -work skipped). Two degrade instead and confine the deployment to one -instance: empty `S3_URL` stores objects under `S3_LOCAL_PATH` (no default; -unset is a boot error), empty `VALKEY_ADDRESS` keeps assistant conversations -in-process (`pkg/memkit`). A model too weak for the assistant disables it -with a warning. +`SLACK_CLIENT_ID`, `ASSISTANT_PROVIDER`, `CHANGEDETECTION_API_URL`, +`VALKEY_ADDRESS`, `S3_URL`, `EMAIL_SMTP_HOST`). Key set with the rest of its +group missing is a boot error; key empty disables the feature (routes answer +`.not_configured`, background work skipped). Two degrade instead: +empty `S3_URL` stores objects under `S3_LOCAL_PATH` (no default; unset is a +boot error), empty `VALKEY_ADDRESS` keeps assistant conversations in-process +(`pkg/memkit`). A model too weak for the assistant disables it with a +warning. Search: `SEARCH_INDEX_PATH` (no default) is a bleve index, a +Postgres cache rebuilt at boot when missing or outdated; it pins a +deployment to one core instance. diff --git a/server/core/AGENTS.md b/server/core/AGENTS.md index 432470d2..d39709b4 100644 --- a/server/core/AGENTS.md +++ b/server/core/AGENTS.md @@ -188,8 +188,8 @@ pagination through `sqlutil.Select`; empty results are a non-nil empty slice; always a deterministic tiebreaker after the user sort. IDs are generated in the domain layer, no `RETURNING`. Soft deletes set `deleted_at`; hard deletes happen in `Cleanup*` sweeps. A sqlhooks error -hook maps `sql.ErrNoRows` → `errutil.ErrNotFound` and constraint violations -→ user errors, so callers only `errors.Is`. Migrations are +hook maps constraint violations → user errors; an empty result is a bare +`sql.ErrNoRows`, so callers use `errutil.IsNotFound`. Migrations are `migrations/NNN_snake_case.sql`, embedded with `//go:embed`. ## HTTP & WebSocket diff --git a/server/core/cmd/core/main.go b/server/core/cmd/core/main.go index 2c3b015a..3a7d62ea 100644 --- a/server/core/cmd/core/main.go +++ b/server/core/cmd/core/main.go @@ -19,7 +19,6 @@ import ( "github.com/cloudwego/eino/components/model" "github.com/gomodule/redigo/redis" "github.com/jellydator/xync" - "github.com/meilisearch/meilisearch-go" "github.com/oxynote/oxynote/server/core/internal/apps/github" "github.com/oxynote/oxynote/server/core/internal/apps/slack" "github.com/oxynote/oxynote/server/core/internal/apps/webchange" @@ -205,25 +204,18 @@ func main() { //nolint:maintidx // main performs linear wiring of all components termCtx, termCancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) defer termCancel() - // an empty MEILISEARCH_URL means search is disabled: nothing is - // indexed and the search surfaces refuse. A set URL that cannot be - // reached stays a boot error inside NewClient. - var meiliMan meilisearch.ServiceManager - - if url := buildinfo.Getenv("MEILISEARCH_URL"); url != "" { - meiliMan = meilisearch.New( - url, - meilisearch.WithAPIKey(buildinfo.Getenv("MEILISEARCH_MASTER_KEY")), - ) - } - - searchClient, err := search.NewClient(termCtx, meiliMan) + // the index is a cache of the database kept on local disk, which is + // what confines a deployment to one core instance. Opening it builds + // it from the database when it is missing or outdated. + searchIndex, err := search.Open(termCtx, log, buildinfo.Getenv("SEARCH_INDEX_PATH"), dbc) if err != nil { - fail(log, closers, "cannot create search gateway client", err) + fail(log, closers, "cannot open the search index", err) return } - searchJobs := search.NewJobs(searchClient.Configured()) + closers = append([]io.Closer{searchIndex}, closers...) + + searchJobMan := searchMan.NewManager(log, dbc, searchIndex) objectStorageURL := buildinfo.Getenv("OBJECT_STORAGE_URL") @@ -293,8 +285,8 @@ func main() { //nolint:maintidx // main performs linear wiring of all components summaryModel, metrics, editClient, - searchClient, - searchJobs, + searchIndex, + searchJobMan, datasourceMan, githubMan, webchangeClient, @@ -307,7 +299,6 @@ func main() { //nolint:maintidx // main performs linear wiring of all components warnDisabled(log, githubMan.Configured(), "github app integration is disabled") warnDisabled(log, slackMan.Configured(), "slack app integration is disabled") warnDisabled(log, assistantMan.Configured(), "assistant is disabled") - warnDisabled(log, searchClient.Configured(), "search is disabled") warnDisabled(log, webchangeClient.Configured(), "changedetection integration is disabled") serverHost, serverPort, err := parseServerAddress(buildinfo.Getenv("SERVER_ADDRESS")) @@ -344,8 +335,8 @@ func main() { //nolint:maintidx // main performs linear wiring of all components githubMan, slackMan, webchangeClient, - searchClient, - searchJobs, + searchIndex, + searchJobMan, notifMan, emailSender, http.DefaultClient, @@ -389,11 +380,7 @@ func main() { //nolint:maintidx // main performs linear wiring of all components backgroundSupv.Go(assistantMan.Start) backgroundSupv.Go(simulationChecker.Start) - // without search there are no queued jobs to drain, so the manager - // is not started at all. - if searchClient.Configured() { - backgroundSupv.Go(searchMan.NewManager(log, dbc, searchClient).Start) - } + backgroundSupv.Go(searchJobMan.Start) <-termCtx.Done() diff --git a/server/core/go.mod b/server/core/go.mod index 5dde5586..6dec2bb6 100644 --- a/server/core/go.mod +++ b/server/core/go.mod @@ -9,6 +9,8 @@ require ( github.com/aws/aws-sdk-go-v2/credentials v1.20.3 github.com/aws/aws-sdk-go-v2/service/s3 v1.112.0 github.com/blang/semver/v4 v4.0.0 + github.com/blevesearch/bleve/v2 v2.6.1 + github.com/blevesearch/bleve_index_api v1.4.1 github.com/bradleyfalzon/ghinstallation/v2 v2.19.0 github.com/cenkalti/backoff/v4 v4.3.0 github.com/cloudwego/eino v0.9.19 @@ -38,7 +40,6 @@ require ( github.com/jellydator/xync v0.0.0-20240601154136-0f038e166df4 github.com/jmoiron/sqlx v1.4.0 github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 - github.com/meilisearch/meilisearch-go v0.36.3 github.com/modelcontextprotocol/go-sdk v1.7.0 github.com/orlangure/gnomock v0.32.1-0.20260413153725-5ce19d18d84a github.com/oxynote/wetsocks v0.1.0 @@ -67,7 +68,7 @@ require ( cloud.google.com/go/compute/metadata v0.9.0 // indirect filippo.io/edwards25519 v1.2.0 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/andybalholm/brotli v1.2.1 // indirect + github.com/RoaringBitmap/roaring/v2 v2.14.5 // indirect github.com/anthropics/anthropic-sdk-go v1.56.0 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.20 // indirect github.com/aws/aws-sdk-go-v2/config v1.32.31 // indirect @@ -86,6 +87,24 @@ require ( github.com/aws/smithy-go v1.28.1 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/bits-and-blooms/bitset v1.24.2 // indirect + github.com/blevesearch/geo v0.2.6 // indirect + github.com/blevesearch/go-faiss v1.1.5 // indirect + github.com/blevesearch/go-porterstemmer v1.0.3 // indirect + github.com/blevesearch/gtreap v0.1.1 // indirect + github.com/blevesearch/mmap-go v1.2.0 // indirect + github.com/blevesearch/scorch_segment_api/v2 v2.4.10 // indirect + github.com/blevesearch/segment v0.9.1 // indirect + github.com/blevesearch/snowballstem v0.9.0 // indirect + github.com/blevesearch/upsidedown_store_api v1.0.2 // indirect + github.com/blevesearch/vellum v1.2.0 // indirect + github.com/blevesearch/zapx/v11 v11.4.3 // indirect + github.com/blevesearch/zapx/v12 v12.4.3 // indirect + github.com/blevesearch/zapx/v13 v13.4.3 // indirect + github.com/blevesearch/zapx/v14 v14.4.3 // indirect + github.com/blevesearch/zapx/v15 v15.4.3 // indirect + github.com/blevesearch/zapx/v16 v16.3.4 // indirect + github.com/blevesearch/zapx/v17 v17.2.3 // indirect github.com/bmatcuk/doublestar/v4 v4.10.0 // indirect github.com/buger/jsonparser v1.2.0 // indirect github.com/bytedance/gopkg v0.1.3 // indirect @@ -115,6 +134,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.2 // indirect github.com/golang-jwt/jwt/v5 v5.3.1 // indirect + github.com/golang/snappy v1.0.0 // indirect github.com/google/go-querystring v1.2.0 // indirect github.com/google/jsonschema-go v0.4.3 // indirect github.com/google/s2a-go v0.1.9 // indirect @@ -143,6 +163,7 @@ require ( github.com/moby/moby/client v0.5.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect + github.com/mschoch/smat v0.2.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect github.com/nikolalohinski/gonja v1.5.3 // indirect @@ -165,6 +186,7 @@ require ( github.com/x448/float16 v0.8.4 // indirect github.com/yargevad/filepathx v1.0.0 // indirect github.com/yosida95/uritemplate/v3 v3.0.2 // indirect + go.etcd.io/bbolt v1.4.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 // indirect diff --git a/server/core/go.sum b/server/core/go.sum index d2e79e7b..2524ab1b 100644 --- a/server/core/go.sum +++ b/server/core/go.sum @@ -23,11 +23,11 @@ github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8 github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= +github.com/RoaringBitmap/roaring/v2 v2.14.5 h1:ckd0o545JqDPeVJDgeFoaM21eBixUnlWfYgjE5VnyWw= +github.com/RoaringBitmap/roaring/v2 v2.14.5/go.mod h1:eq4wdNXxtJIS/oikeCzdX1rBzek7ANzbth041hrU8Q4= github.com/airbrake/gobrake v3.6.1+incompatible/go.mod h1:wM4gu3Cn0W0K7GUuVWnlXZU11AGBXMILnrdOU8Kn00o= github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b h1:mimo19zliBX/vSQ6PWWSL9lK8qwHozUj03+zLoEB8O0= github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs= -github.com/andybalholm/brotli v1.2.1 h1:R+f5xP285VArJDRgowrfb9DqL18yVK0gKAW/F+eTWro= -github.com/andybalholm/brotli v1.2.1/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= github.com/anthropics/anthropic-sdk-go v1.56.0 h1:idVU14wOZ06D0GBNEvuhn927xXmBVEquo0469iDwLsc= github.com/anthropics/anthropic-sdk-go v1.56.0/go.mod h1:3EfIfmFqxH6rbiLcIP4tPFyXL/IHakx2wDG4OU+TIEI= github.com/aws/aws-sdk-go-v2 v1.46.0 h1:1kt7m/EKcEHt5mlyyxx9cSlMddRPIKbjb6DIQsu4HPk= @@ -73,8 +73,48 @@ github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3/go.mod h1:CIWtjk github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= +github.com/bits-and-blooms/bitset v1.24.2 h1:M7/NzVbsytmtfHbumG+K2bremQPMJuqv1JD3vOaFxp0= +github.com/bits-and-blooms/bitset v1.24.2/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= +github.com/blevesearch/bleve/v2 v2.6.1 h1:47vLskRTqxvQEtxVPYHjf5KpOgzD2msslXFjvUQCgWQ= +github.com/blevesearch/bleve/v2 v2.6.1/go.mod h1:Dvvx6ZoEBTOj6RSzfk0lEz0wce/qhe2yOUubXeuzd2c= +github.com/blevesearch/bleve_index_api v1.4.1 h1:CYIyecFlI+/RYjzUm+NmDjYbSvk870Bb7f+Vl4b12q8= +github.com/blevesearch/bleve_index_api v1.4.1/go.mod h1:xvd48t5XMeeioWQ5/jZvgLrV98flT2rdvEJ3l/ki4Ko= +github.com/blevesearch/geo v0.2.6 h1:7K1oyQKYlauC+mJuo2AfNPyjN/4mihEoJMfyClVH1Mo= +github.com/blevesearch/geo v0.2.6/go.mod h1:6qzVUiB4BK47QkSZcRqiXEP2W3EeXuzM5XFTF8AdZ8A= +github.com/blevesearch/go-faiss v1.1.5 h1:/IU5lkOahH9Ghfk9n3F6N0XD7PYVXZJWmNDc9TtXuco= +github.com/blevesearch/go-faiss v1.1.5/go.mod h1:w3W9AiWsFRGVaMG+/cmJi7iHEAuGyC6blsgO1EzCK/M= +github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo= +github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= +github.com/blevesearch/gtreap v0.1.1 h1:2JWigFrzDMR+42WGIN/V2p0cUvn4UP3C4Q5nmaZGW8Y= +github.com/blevesearch/gtreap v0.1.1/go.mod h1:QaQyDRAT51sotthUWAH4Sj08awFSSWzgYICSZ3w0tYk= +github.com/blevesearch/mmap-go v1.2.0 h1:l33nNKPFcBjJUMwem6sAYJPUzhUCABoK9FxZDGiFNBI= +github.com/blevesearch/mmap-go v1.2.0/go.mod h1:Vd6+20GBhEdwJnU1Xohgt88XCD/CTWcqbCNxkZpyBo0= +github.com/blevesearch/scorch_segment_api/v2 v2.4.10 h1:C3873+iWZ0YJM2ijaSHhJJzSvD4x1k+5UaQdGygZVhM= +github.com/blevesearch/scorch_segment_api/v2 v2.4.10/go.mod h1:WUUkAocbkDlNK/kgAE13NvS9oxe+u618mYZ8sOvcCc4= +github.com/blevesearch/segment v0.9.1 h1:+dThDy+Lvgj5JMxhmOVlgFfkUtZV2kw49xax4+jTfSU= +github.com/blevesearch/segment v0.9.1/go.mod h1:zN21iLm7+GnBHWTao9I+Au/7MBiL8pPFtJBJTsk6kQw= +github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s= +github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs= +github.com/blevesearch/upsidedown_store_api v1.0.2 h1:U53Q6YoWEARVLd1OYNc9kvhBMGZzVrdmaozG2MfoB+A= +github.com/blevesearch/upsidedown_store_api v1.0.2/go.mod h1:M01mh3Gpfy56Ps/UXHjEO/knbqyQ1Oamg8If49gRwrQ= +github.com/blevesearch/vellum v1.2.0 h1:xkDiOEsHc2t3Cp0NsNZZ36pvc130sCzcGKOPMzXe+e0= +github.com/blevesearch/vellum v1.2.0/go.mod h1:uEcfBJz7mAOf0Kvq6qoEKQQkLODBF46SINYNkZNae4k= +github.com/blevesearch/zapx/v11 v11.4.3 h1:PTZOO5loKpHC/x/GzmPZNa9cw7GZIQxd5qRjwij9tHY= +github.com/blevesearch/zapx/v11 v11.4.3/go.mod h1:4gdeyy9oGa/lLa6D34R9daXNUvfMPZqUYjPwiLmekwc= +github.com/blevesearch/zapx/v12 v12.4.3 h1:eElXvAaAX4m04t//CGBQAtHNPA+Q6A1hHZVrN3LSFYo= +github.com/blevesearch/zapx/v12 v12.4.3/go.mod h1:TdFmr7afSz1hFh/SIBCCZvcLfzYvievIH6aEISCte58= +github.com/blevesearch/zapx/v13 v13.4.3 h1:qsdhRhaSpVnqDFlRiH9vG5+KJ+dE7KAW9WyZz/KXAiE= +github.com/blevesearch/zapx/v13 v13.4.3/go.mod h1:knK8z2NdQHlb5ot/uj8wuvOq5PhDGjNYQQy0QDnopZk= +github.com/blevesearch/zapx/v14 v14.4.3 h1:GY4Hecx0C6UTmiNC2pKdeA2rOKiLR5/rwpU9WR51dgM= +github.com/blevesearch/zapx/v14 v14.4.3/go.mod h1:rz0XNb/OZSMjNorufDGSpFpjoFKhXmppH9Hi7a877D8= +github.com/blevesearch/zapx/v15 v15.4.3 h1:iJiMJOHrz216jyO6lS0m9RTCEkprUnzvqAI2lc/0/CU= +github.com/blevesearch/zapx/v15 v15.4.3/go.mod h1:1pssev/59FsuWcgSnTa0OeEpOzmhtmr/0/11H0Z8+Nw= +github.com/blevesearch/zapx/v16 v16.3.4 h1:hDAqA8qusZTNbPEL7//w5P65UZ2de6yhSeUaTbp0Po0= +github.com/blevesearch/zapx/v16 v16.3.4/go.mod h1:zqkPPqs9GS9FzVWzCO3Wf1X044yWAV17+4zb+FTiEHg= +github.com/blevesearch/zapx/v17 v17.2.3 h1:UYYJPAt5b2tVxldx5h0jmv23RMsg8/UZKFVya7v92po= +github.com/blevesearch/zapx/v17 v17.2.3/go.mod h1:r7mb4QWbDQSkbAnOjCb9iCfkcrzajB4yBdJpuBIo/fE= github.com/bmatcuk/doublestar/v4 v4.10.0 h1:zU9WiOla1YA122oLM6i4EXvGW62DvKZVxIe6TYWexEs= github.com/bmatcuk/doublestar/v4 v4.10.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= @@ -336,8 +376,6 @@ github.com/maxatome/go-testdeep v1.14.0 h1:rRlLv1+kI8eOI3OaBXZwb3O7xY3exRzdW5QyX github.com/maxatome/go-testdeep v1.14.0/go.mod h1:lPZc/HAcJMP92l7yI6TRz1aZN5URwUBUAfUNvrclaNM= github.com/meguminnnnnnnnn/go-openai v0.1.2 h1:iXombGGjqjBrmE9WaSidUhhi3YQhf42QTHvHLMkgvCA= github.com/meguminnnnnnnnn/go-openai v0.1.2/go.mod h1:qs96ysDmxhE4BZoU45I43zcyfnaYxU3X+aRzLko/htY= -github.com/meilisearch/meilisearch-go v0.36.3 h1:Yx1aTY5jDgtbStPVkhJTDoLnZTy5sejQSPyjfNMy6e4= -github.com/meilisearch/meilisearch-go v0.36.3/go.mod h1:hWcR0MuWLSzHfbz9GGzIr3s9rnXLm1jqkmHkJPbUSvM= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= @@ -354,6 +392,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM= +github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= @@ -480,12 +520,12 @@ github.com/x-cray/logrus-prefixed-formatter v0.5.2 h1:00txxvfBM9muc0jiLIEAkAcIMJ github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= -github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= -github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= github.com/yargevad/filepathx v1.0.0 h1:SYcT+N3tYGi+NvazubCNlvgIPbzAk7i7y2dwg3I5FYc= github.com/yargevad/filepathx v1.0.0/go.mod h1:BprfX/gpYNJHJfc35GjRRpVcwWXS89gGulUIU5tK3tA= github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4= github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4= +go.etcd.io/bbolt v1.4.0 h1:TU77id3TnN/zKr7CO/uk+fBCwF2jGcMuw2B/FMAzYIk= +go.etcd.io/bbolt v1.4.0/go.mod h1:AsD+OCi/qPN1giOX1aiLAha3o1U8rAz65bvN4j0sRuk= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 h1:yI1/OhfEPy7J9eoa6Sj051C7n5dvpj0QX8g4sRchg04= diff --git a/server/core/internal/_mock/meilisearch_index_manager.go b/server/core/internal/_mock/meilisearch_index_manager.go deleted file mode 100644 index dd0cd48d..00000000 --- a/server/core/internal/_mock/meilisearch_index_manager.go +++ /dev/null @@ -1,10231 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package mock - -import ( - "context" - "encoding/json" - "io" - "sync" - "time" - - "github.com/meilisearch/meilisearch-go" -) - -// Ensure, that MeiliIndexManager does implement meilisearch.IndexManager. -// If this is not the case, regenerate this file with moq. -var _ meilisearch.IndexManager = &MeiliIndexManager{} - -// MeiliIndexManager is a mock implementation of meilisearch.IndexManager. -// -// func TestSomethingThatUsesIndexManager(t *testing.T) { -// -// // make and configure a mocked meilisearch.IndexManager -// mockedIndexManager := &MeiliIndexManager{ -// AddDocumentsFunc: func(documentsPtr interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the AddDocuments method") -// }, -// AddDocumentsCsvFunc: func(documents []byte, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsCsv method") -// }, -// AddDocumentsCsvFromReaderFunc: func(documents io.Reader, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsCsvFromReader method") -// }, -// AddDocumentsCsvFromReaderInBatchesFunc: func(documents io.Reader, batchSize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsCsvFromReaderInBatches method") -// }, -// AddDocumentsCsvFromReaderInBatchesWithContextFunc: func(ctx context.Context, documents io.Reader, batchSize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsCsvFromReaderInBatchesWithContext method") -// }, -// AddDocumentsCsvFromReaderWithContextFunc: func(ctx context.Context, documents io.Reader, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsCsvFromReaderWithContext method") -// }, -// AddDocumentsCsvInBatchesFunc: func(documents []byte, batchSize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsCsvInBatches method") -// }, -// AddDocumentsCsvInBatchesWithContextFunc: func(ctx context.Context, documents []byte, batchSize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsCsvInBatchesWithContext method") -// }, -// AddDocumentsCsvWithContextFunc: func(ctx context.Context, documents []byte, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsCsvWithContext method") -// }, -// AddDocumentsInBatchesFunc: func(documentsPtr interface{}, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsInBatches method") -// }, -// AddDocumentsInBatchesWithContextFunc: func(ctx context.Context, documentsPtr interface{}, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsInBatchesWithContext method") -// }, -// AddDocumentsNdjsonFunc: func(documents []byte, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsNdjson method") -// }, -// AddDocumentsNdjsonFromReaderFunc: func(documents io.Reader, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsNdjsonFromReader method") -// }, -// AddDocumentsNdjsonFromReaderInBatchesFunc: func(documents io.Reader, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsNdjsonFromReaderInBatches method") -// }, -// AddDocumentsNdjsonFromReaderInBatchesWithContextFunc: func(ctx context.Context, documents io.Reader, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsNdjsonFromReaderInBatchesWithContext method") -// }, -// AddDocumentsNdjsonFromReaderWithContextFunc: func(ctx context.Context, documents io.Reader, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsNdjsonFromReaderWithContext method") -// }, -// AddDocumentsNdjsonInBatchesFunc: func(documents []byte, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsNdjsonInBatches method") -// }, -// AddDocumentsNdjsonInBatchesWithContextFunc: func(ctx context.Context, documents []byte, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsNdjsonInBatchesWithContext method") -// }, -// AddDocumentsNdjsonWithContextFunc: func(ctx context.Context, documents []byte, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsNdjsonWithContext method") -// }, -// AddDocumentsWithContextFunc: func(ctx context.Context, documentsPtr interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the AddDocumentsWithContext method") -// }, -// CompactFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the Compact method") -// }, -// CompactWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the CompactWithContext method") -// }, -// DeleteFunc: func(uid string) (bool, error) { -// panic("mock out the Delete method") -// }, -// DeleteAllDocumentsFunc: func(opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the DeleteAllDocuments method") -// }, -// DeleteAllDocumentsWithContextFunc: func(ctx context.Context, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the DeleteAllDocumentsWithContext method") -// }, -// DeleteDocumentFunc: func(identifier string, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the DeleteDocument method") -// }, -// DeleteDocumentWithContextFunc: func(ctx context.Context, identifier string, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the DeleteDocumentWithContext method") -// }, -// DeleteDocumentsFunc: func(identifiers []string, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the DeleteDocuments method") -// }, -// DeleteDocumentsByFilterFunc: func(filter interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the DeleteDocumentsByFilter method") -// }, -// DeleteDocumentsByFilterWithContextFunc: func(ctx context.Context, filter interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the DeleteDocumentsByFilterWithContext method") -// }, -// DeleteDocumentsWithContextFunc: func(ctx context.Context, identifiers []string, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the DeleteDocumentsWithContext method") -// }, -// DeleteWithContextFunc: func(ctx context.Context, uid string) (bool, error) { -// panic("mock out the DeleteWithContext method") -// }, -// FacetSearchFunc: func(request *meilisearch.FacetSearchRequest) (*json.RawMessage, error) { -// panic("mock out the FacetSearch method") -// }, -// FacetSearchWithContextFunc: func(ctx context.Context, request *meilisearch.FacetSearchRequest) (*json.RawMessage, error) { -// panic("mock out the FacetSearchWithContext method") -// }, -// FetchInfoFunc: func() (*meilisearch.IndexResult, error) { -// panic("mock out the FetchInfo method") -// }, -// FetchInfoWithContextFunc: func(ctx context.Context) (*meilisearch.IndexResult, error) { -// panic("mock out the FetchInfoWithContext method") -// }, -// FetchPrimaryKeyFunc: func() (*string, error) { -// panic("mock out the FetchPrimaryKey method") -// }, -// FetchPrimaryKeyWithContextFunc: func(ctx context.Context) (*string, error) { -// panic("mock out the FetchPrimaryKeyWithContext method") -// }, -// GetDictionaryFunc: func() ([]string, error) { -// panic("mock out the GetDictionary method") -// }, -// GetDictionaryWithContextFunc: func(ctx context.Context) ([]string, error) { -// panic("mock out the GetDictionaryWithContext method") -// }, -// GetDisplayedAttributesFunc: func() (*[]string, error) { -// panic("mock out the GetDisplayedAttributes method") -// }, -// GetDisplayedAttributesWithContextFunc: func(ctx context.Context) (*[]string, error) { -// panic("mock out the GetDisplayedAttributesWithContext method") -// }, -// GetDistinctAttributeFunc: func() (*string, error) { -// panic("mock out the GetDistinctAttribute method") -// }, -// GetDistinctAttributeWithContextFunc: func(ctx context.Context) (*string, error) { -// panic("mock out the GetDistinctAttributeWithContext method") -// }, -// GetDocumentFunc: func(identifier string, request *meilisearch.DocumentQuery, documentPtr interface{}) error { -// panic("mock out the GetDocument method") -// }, -// GetDocumentManagerFunc: func() meilisearch.DocumentManager { -// panic("mock out the GetDocumentManager method") -// }, -// GetDocumentReaderFunc: func() meilisearch.DocumentReader { -// panic("mock out the GetDocumentReader method") -// }, -// GetDocumentWithContextFunc: func(ctx context.Context, identifier string, request *meilisearch.DocumentQuery, documentPtr interface{}) error { -// panic("mock out the GetDocumentWithContext method") -// }, -// GetDocumentsFunc: func(param *meilisearch.DocumentsQuery, resp *meilisearch.DocumentsResult) error { -// panic("mock out the GetDocuments method") -// }, -// GetDocumentsWithContextFunc: func(ctx context.Context, param *meilisearch.DocumentsQuery, resp *meilisearch.DocumentsResult) error { -// panic("mock out the GetDocumentsWithContext method") -// }, -// GetEmbeddersFunc: func() (map[string]meilisearch.Embedder, error) { -// panic("mock out the GetEmbedders method") -// }, -// GetEmbeddersWithContextFunc: func(ctx context.Context) (map[string]meilisearch.Embedder, error) { -// panic("mock out the GetEmbeddersWithContext method") -// }, -// GetFacetSearchFunc: func() (bool, error) { -// panic("mock out the GetFacetSearch method") -// }, -// GetFacetSearchWithContextFunc: func(ctx context.Context) (bool, error) { -// panic("mock out the GetFacetSearchWithContext method") -// }, -// GetFacetingFunc: func() (*meilisearch.Faceting, error) { -// panic("mock out the GetFaceting method") -// }, -// GetFacetingWithContextFunc: func(ctx context.Context) (*meilisearch.Faceting, error) { -// panic("mock out the GetFacetingWithContext method") -// }, -// GetFilterableAttributesFunc: func() (*[]interface{}, error) { -// panic("mock out the GetFilterableAttributes method") -// }, -// GetFilterableAttributesWithContextFunc: func(ctx context.Context) (*[]interface{}, error) { -// panic("mock out the GetFilterableAttributesWithContext method") -// }, -// GetIndexReaderFunc: func() meilisearch.IndexReader { -// panic("mock out the GetIndexReader method") -// }, -// GetLocalizedAttributesFunc: func() ([]*meilisearch.LocalizedAttributes, error) { -// panic("mock out the GetLocalizedAttributes method") -// }, -// GetLocalizedAttributesWithContextFunc: func(ctx context.Context) ([]*meilisearch.LocalizedAttributes, error) { -// panic("mock out the GetLocalizedAttributesWithContext method") -// }, -// GetNonSeparatorTokensFunc: func() ([]string, error) { -// panic("mock out the GetNonSeparatorTokens method") -// }, -// GetNonSeparatorTokensWithContextFunc: func(ctx context.Context) ([]string, error) { -// panic("mock out the GetNonSeparatorTokensWithContext method") -// }, -// GetPaginationFunc: func() (*meilisearch.Pagination, error) { -// panic("mock out the GetPagination method") -// }, -// GetPaginationWithContextFunc: func(ctx context.Context) (*meilisearch.Pagination, error) { -// panic("mock out the GetPaginationWithContext method") -// }, -// GetPrefixSearchFunc: func() (*string, error) { -// panic("mock out the GetPrefixSearch method") -// }, -// GetPrefixSearchWithContextFunc: func(ctx context.Context) (*string, error) { -// panic("mock out the GetPrefixSearchWithContext method") -// }, -// GetProximityPrecisionFunc: func() (meilisearch.ProximityPrecisionType, error) { -// panic("mock out the GetProximityPrecision method") -// }, -// GetProximityPrecisionWithContextFunc: func(ctx context.Context) (meilisearch.ProximityPrecisionType, error) { -// panic("mock out the GetProximityPrecisionWithContext method") -// }, -// GetRankingRulesFunc: func() (*[]string, error) { -// panic("mock out the GetRankingRules method") -// }, -// GetRankingRulesWithContextFunc: func(ctx context.Context) (*[]string, error) { -// panic("mock out the GetRankingRulesWithContext method") -// }, -// GetSearchFunc: func() meilisearch.SearchReader { -// panic("mock out the GetSearch method") -// }, -// GetSearchCutoffMsFunc: func() (int64, error) { -// panic("mock out the GetSearchCutoffMs method") -// }, -// GetSearchCutoffMsWithContextFunc: func(ctx context.Context) (int64, error) { -// panic("mock out the GetSearchCutoffMsWithContext method") -// }, -// GetSearchableAttributesFunc: func() (*[]string, error) { -// panic("mock out the GetSearchableAttributes method") -// }, -// GetSearchableAttributesWithContextFunc: func(ctx context.Context) (*[]string, error) { -// panic("mock out the GetSearchableAttributesWithContext method") -// }, -// GetSeparatorTokensFunc: func() ([]string, error) { -// panic("mock out the GetSeparatorTokens method") -// }, -// GetSeparatorTokensWithContextFunc: func(ctx context.Context) ([]string, error) { -// panic("mock out the GetSeparatorTokensWithContext method") -// }, -// GetSettingsFunc: func() (*meilisearch.Settings, error) { -// panic("mock out the GetSettings method") -// }, -// GetSettingsManagerFunc: func() meilisearch.SettingsManager { -// panic("mock out the GetSettingsManager method") -// }, -// GetSettingsReaderFunc: func() meilisearch.SettingsReader { -// panic("mock out the GetSettingsReader method") -// }, -// GetSettingsWithContextFunc: func(ctx context.Context) (*meilisearch.Settings, error) { -// panic("mock out the GetSettingsWithContext method") -// }, -// GetSortableAttributesFunc: func() (*[]string, error) { -// panic("mock out the GetSortableAttributes method") -// }, -// GetSortableAttributesWithContextFunc: func(ctx context.Context) (*[]string, error) { -// panic("mock out the GetSortableAttributesWithContext method") -// }, -// GetStatsFunc: func(param *meilisearch.StatsParams) (*meilisearch.StatsIndex, error) { -// panic("mock out the GetStats method") -// }, -// GetStatsWithContextFunc: func(ctx context.Context, param *meilisearch.StatsParams) (*meilisearch.StatsIndex, error) { -// panic("mock out the GetStatsWithContext method") -// }, -// GetStopWordsFunc: func() (*[]string, error) { -// panic("mock out the GetStopWords method") -// }, -// GetStopWordsWithContextFunc: func(ctx context.Context) (*[]string, error) { -// panic("mock out the GetStopWordsWithContext method") -// }, -// GetSynonymsFunc: func() (*map[string][]string, error) { -// panic("mock out the GetSynonyms method") -// }, -// GetSynonymsWithContextFunc: func(ctx context.Context) (*map[string][]string, error) { -// panic("mock out the GetSynonymsWithContext method") -// }, -// GetTaskFunc: func(taskUID int64) (*meilisearch.Task, error) { -// panic("mock out the GetTask method") -// }, -// GetTaskReaderFunc: func() meilisearch.TaskReader { -// panic("mock out the GetTaskReader method") -// }, -// GetTaskWithContextFunc: func(ctx context.Context, taskUID int64) (*meilisearch.Task, error) { -// panic("mock out the GetTaskWithContext method") -// }, -// GetTasksFunc: func(param *meilisearch.TasksQuery) (*meilisearch.TaskResult, error) { -// panic("mock out the GetTasks method") -// }, -// GetTasksWithContextFunc: func(ctx context.Context, param *meilisearch.TasksQuery) (*meilisearch.TaskResult, error) { -// panic("mock out the GetTasksWithContext method") -// }, -// GetTypoToleranceFunc: func() (*meilisearch.TypoTolerance, error) { -// panic("mock out the GetTypoTolerance method") -// }, -// GetTypoToleranceWithContextFunc: func(ctx context.Context) (*meilisearch.TypoTolerance, error) { -// panic("mock out the GetTypoToleranceWithContext method") -// }, -// ResetDictionaryFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetDictionary method") -// }, -// ResetDictionaryWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetDictionaryWithContext method") -// }, -// ResetDisplayedAttributesFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetDisplayedAttributes method") -// }, -// ResetDisplayedAttributesWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetDisplayedAttributesWithContext method") -// }, -// ResetDistinctAttributeFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetDistinctAttribute method") -// }, -// ResetDistinctAttributeWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetDistinctAttributeWithContext method") -// }, -// ResetEmbeddersFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetEmbedders method") -// }, -// ResetEmbeddersWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetEmbeddersWithContext method") -// }, -// ResetFacetSearchFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetFacetSearch method") -// }, -// ResetFacetSearchWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetFacetSearchWithContext method") -// }, -// ResetFacetingFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetFaceting method") -// }, -// ResetFacetingWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetFacetingWithContext method") -// }, -// ResetFilterableAttributesFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetFilterableAttributes method") -// }, -// ResetFilterableAttributesWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetFilterableAttributesWithContext method") -// }, -// ResetLocalizedAttributesFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetLocalizedAttributes method") -// }, -// ResetLocalizedAttributesWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetLocalizedAttributesWithContext method") -// }, -// ResetNonSeparatorTokensFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetNonSeparatorTokens method") -// }, -// ResetNonSeparatorTokensWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetNonSeparatorTokensWithContext method") -// }, -// ResetPaginationFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetPagination method") -// }, -// ResetPaginationWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetPaginationWithContext method") -// }, -// ResetPrefixSearchFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetPrefixSearch method") -// }, -// ResetPrefixSearchWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetPrefixSearchWithContext method") -// }, -// ResetProximityPrecisionFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetProximityPrecision method") -// }, -// ResetProximityPrecisionWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetProximityPrecisionWithContext method") -// }, -// ResetRankingRulesFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetRankingRules method") -// }, -// ResetRankingRulesWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetRankingRulesWithContext method") -// }, -// ResetSearchCutoffMsFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetSearchCutoffMs method") -// }, -// ResetSearchCutoffMsWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetSearchCutoffMsWithContext method") -// }, -// ResetSearchableAttributesFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetSearchableAttributes method") -// }, -// ResetSearchableAttributesWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetSearchableAttributesWithContext method") -// }, -// ResetSeparatorTokensFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetSeparatorTokens method") -// }, -// ResetSeparatorTokensWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetSeparatorTokensWithContext method") -// }, -// ResetSettingsFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetSettings method") -// }, -// ResetSettingsWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetSettingsWithContext method") -// }, -// ResetSortableAttributesFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetSortableAttributes method") -// }, -// ResetSortableAttributesWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetSortableAttributesWithContext method") -// }, -// ResetStopWordsFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetStopWords method") -// }, -// ResetStopWordsWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetStopWordsWithContext method") -// }, -// ResetSynonymsFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetSynonyms method") -// }, -// ResetSynonymsWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetSynonymsWithContext method") -// }, -// ResetTypoToleranceFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetTypoTolerance method") -// }, -// ResetTypoToleranceWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the ResetTypoToleranceWithContext method") -// }, -// SearchFunc: func(query string, request *meilisearch.SearchRequest) (*meilisearch.SearchResponse, error) { -// panic("mock out the Search method") -// }, -// SearchRawFunc: func(query string, request *meilisearch.SearchRequest) (*json.RawMessage, error) { -// panic("mock out the SearchRaw method") -// }, -// SearchRawWithContextFunc: func(ctx context.Context, query string, request *meilisearch.SearchRequest) (*json.RawMessage, error) { -// panic("mock out the SearchRawWithContext method") -// }, -// SearchSimilarDocumentsFunc: func(param *meilisearch.SimilarDocumentQuery, resp *meilisearch.SimilarDocumentResult) error { -// panic("mock out the SearchSimilarDocuments method") -// }, -// SearchSimilarDocumentsWithContextFunc: func(ctx context.Context, param *meilisearch.SimilarDocumentQuery, resp *meilisearch.SimilarDocumentResult) error { -// panic("mock out the SearchSimilarDocumentsWithContext method") -// }, -// SearchWithContextFunc: func(ctx context.Context, query string, request *meilisearch.SearchRequest) (*meilisearch.SearchResponse, error) { -// panic("mock out the SearchWithContext method") -// }, -// UpdateDictionaryFunc: func(words []string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDictionary method") -// }, -// UpdateDictionaryWithContextFunc: func(ctx context.Context, words []string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDictionaryWithContext method") -// }, -// UpdateDisplayedAttributesFunc: func(request *[]string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDisplayedAttributes method") -// }, -// UpdateDisplayedAttributesWithContextFunc: func(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDisplayedAttributesWithContext method") -// }, -// UpdateDistinctAttributeFunc: func(request string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDistinctAttribute method") -// }, -// UpdateDistinctAttributeWithContextFunc: func(ctx context.Context, request string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDistinctAttributeWithContext method") -// }, -// UpdateDocumentsFunc: func(documentsPtr interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDocuments method") -// }, -// UpdateDocumentsByFunctionFunc: func(req *meilisearch.UpdateDocumentByFunctionRequest) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDocumentsByFunction method") -// }, -// UpdateDocumentsByFunctionWithContextFunc: func(ctx context.Context, req *meilisearch.UpdateDocumentByFunctionRequest) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDocumentsByFunctionWithContext method") -// }, -// UpdateDocumentsCsvFunc: func(documents []byte, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDocumentsCsv method") -// }, -// UpdateDocumentsCsvInBatchesFunc: func(documents []byte, batchsize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDocumentsCsvInBatches method") -// }, -// UpdateDocumentsCsvInBatchesWithContextFunc: func(ctx context.Context, documents []byte, batchsize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDocumentsCsvInBatchesWithContext method") -// }, -// UpdateDocumentsCsvWithContextFunc: func(ctx context.Context, documents []byte, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDocumentsCsvWithContext method") -// }, -// UpdateDocumentsInBatchesFunc: func(documentsPtr interface{}, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDocumentsInBatches method") -// }, -// UpdateDocumentsInBatchesWithContextFunc: func(ctx context.Context, documentsPtr interface{}, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDocumentsInBatchesWithContext method") -// }, -// UpdateDocumentsNdjsonFunc: func(documents []byte, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDocumentsNdjson method") -// }, -// UpdateDocumentsNdjsonInBatchesFunc: func(documents []byte, batchsize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDocumentsNdjsonInBatches method") -// }, -// UpdateDocumentsNdjsonInBatchesWithContextFunc: func(ctx context.Context, documents []byte, batchsize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDocumentsNdjsonInBatchesWithContext method") -// }, -// UpdateDocumentsNdjsonWithContextFunc: func(ctx context.Context, documents []byte, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDocumentsNdjsonWithContext method") -// }, -// UpdateDocumentsWithContextFunc: func(ctx context.Context, documentsPtr interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateDocumentsWithContext method") -// }, -// UpdateEmbeddersFunc: func(request map[string]meilisearch.Embedder) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateEmbedders method") -// }, -// UpdateEmbeddersWithContextFunc: func(ctx context.Context, request map[string]meilisearch.Embedder) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateEmbeddersWithContext method") -// }, -// UpdateFacetSearchFunc: func(request bool) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateFacetSearch method") -// }, -// UpdateFacetSearchWithContextFunc: func(ctx context.Context, request bool) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateFacetSearchWithContext method") -// }, -// UpdateFacetingFunc: func(request *meilisearch.Faceting) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateFaceting method") -// }, -// UpdateFacetingWithContextFunc: func(ctx context.Context, request *meilisearch.Faceting) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateFacetingWithContext method") -// }, -// UpdateFilterableAttributesFunc: func(request *[]interface{}) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateFilterableAttributes method") -// }, -// UpdateFilterableAttributesWithContextFunc: func(ctx context.Context, request *[]interface{}) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateFilterableAttributesWithContext method") -// }, -// UpdateIndexFunc: func(params *meilisearch.UpdateIndexRequestParams) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateIndex method") -// }, -// UpdateIndexWithContextFunc: func(ctx context.Context, params *meilisearch.UpdateIndexRequestParams) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateIndexWithContext method") -// }, -// UpdateLocalizedAttributesFunc: func(request []*meilisearch.LocalizedAttributes) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateLocalizedAttributes method") -// }, -// UpdateLocalizedAttributesWithContextFunc: func(ctx context.Context, request []*meilisearch.LocalizedAttributes) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateLocalizedAttributesWithContext method") -// }, -// UpdateNonSeparatorTokensFunc: func(tokens []string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateNonSeparatorTokens method") -// }, -// UpdateNonSeparatorTokensWithContextFunc: func(ctx context.Context, tokens []string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateNonSeparatorTokensWithContext method") -// }, -// UpdatePaginationFunc: func(request *meilisearch.Pagination) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdatePagination method") -// }, -// UpdatePaginationWithContextFunc: func(ctx context.Context, request *meilisearch.Pagination) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdatePaginationWithContext method") -// }, -// UpdatePrefixSearchFunc: func(request string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdatePrefixSearch method") -// }, -// UpdatePrefixSearchWithContextFunc: func(ctx context.Context, request string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdatePrefixSearchWithContext method") -// }, -// UpdateProximityPrecisionFunc: func(proximityType meilisearch.ProximityPrecisionType) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateProximityPrecision method") -// }, -// UpdateProximityPrecisionWithContextFunc: func(ctx context.Context, proximityType meilisearch.ProximityPrecisionType) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateProximityPrecisionWithContext method") -// }, -// UpdateRankingRulesFunc: func(request *[]string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateRankingRules method") -// }, -// UpdateRankingRulesWithContextFunc: func(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateRankingRulesWithContext method") -// }, -// UpdateSearchCutoffMsFunc: func(request int64) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateSearchCutoffMs method") -// }, -// UpdateSearchCutoffMsWithContextFunc: func(ctx context.Context, request int64) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateSearchCutoffMsWithContext method") -// }, -// UpdateSearchableAttributesFunc: func(request *[]string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateSearchableAttributes method") -// }, -// UpdateSearchableAttributesWithContextFunc: func(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateSearchableAttributesWithContext method") -// }, -// UpdateSeparatorTokensFunc: func(tokens []string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateSeparatorTokens method") -// }, -// UpdateSeparatorTokensWithContextFunc: func(ctx context.Context, tokens []string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateSeparatorTokensWithContext method") -// }, -// UpdateSettingsFunc: func(request *meilisearch.Settings) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateSettings method") -// }, -// UpdateSettingsWithContextFunc: func(ctx context.Context, request *meilisearch.Settings) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateSettingsWithContext method") -// }, -// UpdateSortableAttributesFunc: func(request *[]string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateSortableAttributes method") -// }, -// UpdateSortableAttributesWithContextFunc: func(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateSortableAttributesWithContext method") -// }, -// UpdateStopWordsFunc: func(request *[]string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateStopWords method") -// }, -// UpdateStopWordsWithContextFunc: func(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateStopWordsWithContext method") -// }, -// UpdateSynonymsFunc: func(request *map[string][]string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateSynonyms method") -// }, -// UpdateSynonymsWithContextFunc: func(ctx context.Context, request *map[string][]string) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateSynonymsWithContext method") -// }, -// UpdateTypoToleranceFunc: func(request *meilisearch.TypoTolerance) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateTypoTolerance method") -// }, -// UpdateTypoToleranceWithContextFunc: func(ctx context.Context, request *meilisearch.TypoTolerance) (*meilisearch.TaskInfo, error) { -// panic("mock out the UpdateTypoToleranceWithContext method") -// }, -// WaitForTaskFunc: func(taskUID int64, interval time.Duration) (*meilisearch.Task, error) { -// panic("mock out the WaitForTask method") -// }, -// WaitForTaskWithContextFunc: func(ctx context.Context, taskUID int64, interval time.Duration) (*meilisearch.Task, error) { -// panic("mock out the WaitForTaskWithContext method") -// }, -// } -// -// // use mockedIndexManager in code that requires meilisearch.IndexManager -// // and then make assertions. -// -// } -type MeiliIndexManager struct { - // AddDocumentsFunc mocks the AddDocuments method. - AddDocumentsFunc func(documentsPtr interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // AddDocumentsCsvFunc mocks the AddDocumentsCsv method. - AddDocumentsCsvFunc func(documents []byte, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) - - // AddDocumentsCsvFromReaderFunc mocks the AddDocumentsCsvFromReader method. - AddDocumentsCsvFromReaderFunc func(documents io.Reader, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) - - // AddDocumentsCsvFromReaderInBatchesFunc mocks the AddDocumentsCsvFromReaderInBatches method. - AddDocumentsCsvFromReaderInBatchesFunc func(documents io.Reader, batchSize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) - - // AddDocumentsCsvFromReaderInBatchesWithContextFunc mocks the AddDocumentsCsvFromReaderInBatchesWithContext method. - AddDocumentsCsvFromReaderInBatchesWithContextFunc func(ctx context.Context, documents io.Reader, batchSize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) - - // AddDocumentsCsvFromReaderWithContextFunc mocks the AddDocumentsCsvFromReaderWithContext method. - AddDocumentsCsvFromReaderWithContextFunc func(ctx context.Context, documents io.Reader, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) - - // AddDocumentsCsvInBatchesFunc mocks the AddDocumentsCsvInBatches method. - AddDocumentsCsvInBatchesFunc func(documents []byte, batchSize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) - - // AddDocumentsCsvInBatchesWithContextFunc mocks the AddDocumentsCsvInBatchesWithContext method. - AddDocumentsCsvInBatchesWithContextFunc func(ctx context.Context, documents []byte, batchSize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) - - // AddDocumentsCsvWithContextFunc mocks the AddDocumentsCsvWithContext method. - AddDocumentsCsvWithContextFunc func(ctx context.Context, documents []byte, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) - - // AddDocumentsInBatchesFunc mocks the AddDocumentsInBatches method. - AddDocumentsInBatchesFunc func(documentsPtr interface{}, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) - - // AddDocumentsInBatchesWithContextFunc mocks the AddDocumentsInBatchesWithContext method. - AddDocumentsInBatchesWithContextFunc func(ctx context.Context, documentsPtr interface{}, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) - - // AddDocumentsNdjsonFunc mocks the AddDocumentsNdjson method. - AddDocumentsNdjsonFunc func(documents []byte, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // AddDocumentsNdjsonFromReaderFunc mocks the AddDocumentsNdjsonFromReader method. - AddDocumentsNdjsonFromReaderFunc func(documents io.Reader, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // AddDocumentsNdjsonFromReaderInBatchesFunc mocks the AddDocumentsNdjsonFromReaderInBatches method. - AddDocumentsNdjsonFromReaderInBatchesFunc func(documents io.Reader, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) - - // AddDocumentsNdjsonFromReaderInBatchesWithContextFunc mocks the AddDocumentsNdjsonFromReaderInBatchesWithContext method. - AddDocumentsNdjsonFromReaderInBatchesWithContextFunc func(ctx context.Context, documents io.Reader, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) - - // AddDocumentsNdjsonFromReaderWithContextFunc mocks the AddDocumentsNdjsonFromReaderWithContext method. - AddDocumentsNdjsonFromReaderWithContextFunc func(ctx context.Context, documents io.Reader, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // AddDocumentsNdjsonInBatchesFunc mocks the AddDocumentsNdjsonInBatches method. - AddDocumentsNdjsonInBatchesFunc func(documents []byte, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) - - // AddDocumentsNdjsonInBatchesWithContextFunc mocks the AddDocumentsNdjsonInBatchesWithContext method. - AddDocumentsNdjsonInBatchesWithContextFunc func(ctx context.Context, documents []byte, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) - - // AddDocumentsNdjsonWithContextFunc mocks the AddDocumentsNdjsonWithContext method. - AddDocumentsNdjsonWithContextFunc func(ctx context.Context, documents []byte, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // AddDocumentsWithContextFunc mocks the AddDocumentsWithContext method. - AddDocumentsWithContextFunc func(ctx context.Context, documentsPtr interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // CompactFunc mocks the Compact method. - CompactFunc func() (*meilisearch.TaskInfo, error) - - // CompactWithContextFunc mocks the CompactWithContext method. - CompactWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // DeleteFunc mocks the Delete method. - DeleteFunc func(uid string) (bool, error) - - // DeleteAllDocumentsFunc mocks the DeleteAllDocuments method. - DeleteAllDocumentsFunc func(opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // DeleteAllDocumentsWithContextFunc mocks the DeleteAllDocumentsWithContext method. - DeleteAllDocumentsWithContextFunc func(ctx context.Context, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // DeleteDocumentFunc mocks the DeleteDocument method. - DeleteDocumentFunc func(identifier string, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // DeleteDocumentWithContextFunc mocks the DeleteDocumentWithContext method. - DeleteDocumentWithContextFunc func(ctx context.Context, identifier string, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // DeleteDocumentsFunc mocks the DeleteDocuments method. - DeleteDocumentsFunc func(identifiers []string, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // DeleteDocumentsByFilterFunc mocks the DeleteDocumentsByFilter method. - DeleteDocumentsByFilterFunc func(filter interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // DeleteDocumentsByFilterWithContextFunc mocks the DeleteDocumentsByFilterWithContext method. - DeleteDocumentsByFilterWithContextFunc func(ctx context.Context, filter interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // DeleteDocumentsWithContextFunc mocks the DeleteDocumentsWithContext method. - DeleteDocumentsWithContextFunc func(ctx context.Context, identifiers []string, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // DeleteWithContextFunc mocks the DeleteWithContext method. - DeleteWithContextFunc func(ctx context.Context, uid string) (bool, error) - - // FacetSearchFunc mocks the FacetSearch method. - FacetSearchFunc func(request *meilisearch.FacetSearchRequest) (*json.RawMessage, error) - - // FacetSearchWithContextFunc mocks the FacetSearchWithContext method. - FacetSearchWithContextFunc func(ctx context.Context, request *meilisearch.FacetSearchRequest) (*json.RawMessage, error) - - // FetchInfoFunc mocks the FetchInfo method. - FetchInfoFunc func() (*meilisearch.IndexResult, error) - - // FetchInfoWithContextFunc mocks the FetchInfoWithContext method. - FetchInfoWithContextFunc func(ctx context.Context) (*meilisearch.IndexResult, error) - - // FetchPrimaryKeyFunc mocks the FetchPrimaryKey method. - FetchPrimaryKeyFunc func() (*string, error) - - // FetchPrimaryKeyWithContextFunc mocks the FetchPrimaryKeyWithContext method. - FetchPrimaryKeyWithContextFunc func(ctx context.Context) (*string, error) - - // GetDictionaryFunc mocks the GetDictionary method. - GetDictionaryFunc func() ([]string, error) - - // GetDictionaryWithContextFunc mocks the GetDictionaryWithContext method. - GetDictionaryWithContextFunc func(ctx context.Context) ([]string, error) - - // GetDisplayedAttributesFunc mocks the GetDisplayedAttributes method. - GetDisplayedAttributesFunc func() (*[]string, error) - - // GetDisplayedAttributesWithContextFunc mocks the GetDisplayedAttributesWithContext method. - GetDisplayedAttributesWithContextFunc func(ctx context.Context) (*[]string, error) - - // GetDistinctAttributeFunc mocks the GetDistinctAttribute method. - GetDistinctAttributeFunc func() (*string, error) - - // GetDistinctAttributeWithContextFunc mocks the GetDistinctAttributeWithContext method. - GetDistinctAttributeWithContextFunc func(ctx context.Context) (*string, error) - - // GetDocumentFunc mocks the GetDocument method. - GetDocumentFunc func(identifier string, request *meilisearch.DocumentQuery, documentPtr interface{}) error - - // GetDocumentManagerFunc mocks the GetDocumentManager method. - GetDocumentManagerFunc func() meilisearch.DocumentManager - - // GetDocumentReaderFunc mocks the GetDocumentReader method. - GetDocumentReaderFunc func() meilisearch.DocumentReader - - // GetDocumentWithContextFunc mocks the GetDocumentWithContext method. - GetDocumentWithContextFunc func(ctx context.Context, identifier string, request *meilisearch.DocumentQuery, documentPtr interface{}) error - - // GetDocumentsFunc mocks the GetDocuments method. - GetDocumentsFunc func(param *meilisearch.DocumentsQuery, resp *meilisearch.DocumentsResult) error - - // GetDocumentsWithContextFunc mocks the GetDocumentsWithContext method. - GetDocumentsWithContextFunc func(ctx context.Context, param *meilisearch.DocumentsQuery, resp *meilisearch.DocumentsResult) error - - // GetEmbeddersFunc mocks the GetEmbedders method. - GetEmbeddersFunc func() (map[string]meilisearch.Embedder, error) - - // GetEmbeddersWithContextFunc mocks the GetEmbeddersWithContext method. - GetEmbeddersWithContextFunc func(ctx context.Context) (map[string]meilisearch.Embedder, error) - - // GetFacetSearchFunc mocks the GetFacetSearch method. - GetFacetSearchFunc func() (bool, error) - - // GetFacetSearchWithContextFunc mocks the GetFacetSearchWithContext method. - GetFacetSearchWithContextFunc func(ctx context.Context) (bool, error) - - // GetFacetingFunc mocks the GetFaceting method. - GetFacetingFunc func() (*meilisearch.Faceting, error) - - // GetFacetingWithContextFunc mocks the GetFacetingWithContext method. - GetFacetingWithContextFunc func(ctx context.Context) (*meilisearch.Faceting, error) - - // GetFilterableAttributesFunc mocks the GetFilterableAttributes method. - GetFilterableAttributesFunc func() (*[]interface{}, error) - - // GetFilterableAttributesWithContextFunc mocks the GetFilterableAttributesWithContext method. - GetFilterableAttributesWithContextFunc func(ctx context.Context) (*[]interface{}, error) - - // GetIndexReaderFunc mocks the GetIndexReader method. - GetIndexReaderFunc func() meilisearch.IndexReader - - // GetLocalizedAttributesFunc mocks the GetLocalizedAttributes method. - GetLocalizedAttributesFunc func() ([]*meilisearch.LocalizedAttributes, error) - - // GetLocalizedAttributesWithContextFunc mocks the GetLocalizedAttributesWithContext method. - GetLocalizedAttributesWithContextFunc func(ctx context.Context) ([]*meilisearch.LocalizedAttributes, error) - - // GetNonSeparatorTokensFunc mocks the GetNonSeparatorTokens method. - GetNonSeparatorTokensFunc func() ([]string, error) - - // GetNonSeparatorTokensWithContextFunc mocks the GetNonSeparatorTokensWithContext method. - GetNonSeparatorTokensWithContextFunc func(ctx context.Context) ([]string, error) - - // GetPaginationFunc mocks the GetPagination method. - GetPaginationFunc func() (*meilisearch.Pagination, error) - - // GetPaginationWithContextFunc mocks the GetPaginationWithContext method. - GetPaginationWithContextFunc func(ctx context.Context) (*meilisearch.Pagination, error) - - // GetPrefixSearchFunc mocks the GetPrefixSearch method. - GetPrefixSearchFunc func() (*string, error) - - // GetPrefixSearchWithContextFunc mocks the GetPrefixSearchWithContext method. - GetPrefixSearchWithContextFunc func(ctx context.Context) (*string, error) - - // GetProximityPrecisionFunc mocks the GetProximityPrecision method. - GetProximityPrecisionFunc func() (meilisearch.ProximityPrecisionType, error) - - // GetProximityPrecisionWithContextFunc mocks the GetProximityPrecisionWithContext method. - GetProximityPrecisionWithContextFunc func(ctx context.Context) (meilisearch.ProximityPrecisionType, error) - - // GetRankingRulesFunc mocks the GetRankingRules method. - GetRankingRulesFunc func() (*[]string, error) - - // GetRankingRulesWithContextFunc mocks the GetRankingRulesWithContext method. - GetRankingRulesWithContextFunc func(ctx context.Context) (*[]string, error) - - // GetSearchFunc mocks the GetSearch method. - GetSearchFunc func() meilisearch.SearchReader - - // GetSearchCutoffMsFunc mocks the GetSearchCutoffMs method. - GetSearchCutoffMsFunc func() (int64, error) - - // GetSearchCutoffMsWithContextFunc mocks the GetSearchCutoffMsWithContext method. - GetSearchCutoffMsWithContextFunc func(ctx context.Context) (int64, error) - - // GetSearchableAttributesFunc mocks the GetSearchableAttributes method. - GetSearchableAttributesFunc func() (*[]string, error) - - // GetSearchableAttributesWithContextFunc mocks the GetSearchableAttributesWithContext method. - GetSearchableAttributesWithContextFunc func(ctx context.Context) (*[]string, error) - - // GetSeparatorTokensFunc mocks the GetSeparatorTokens method. - GetSeparatorTokensFunc func() ([]string, error) - - // GetSeparatorTokensWithContextFunc mocks the GetSeparatorTokensWithContext method. - GetSeparatorTokensWithContextFunc func(ctx context.Context) ([]string, error) - - // GetSettingsFunc mocks the GetSettings method. - GetSettingsFunc func() (*meilisearch.Settings, error) - - // GetSettingsManagerFunc mocks the GetSettingsManager method. - GetSettingsManagerFunc func() meilisearch.SettingsManager - - // GetSettingsReaderFunc mocks the GetSettingsReader method. - GetSettingsReaderFunc func() meilisearch.SettingsReader - - // GetSettingsWithContextFunc mocks the GetSettingsWithContext method. - GetSettingsWithContextFunc func(ctx context.Context) (*meilisearch.Settings, error) - - // GetSortableAttributesFunc mocks the GetSortableAttributes method. - GetSortableAttributesFunc func() (*[]string, error) - - // GetSortableAttributesWithContextFunc mocks the GetSortableAttributesWithContext method. - GetSortableAttributesWithContextFunc func(ctx context.Context) (*[]string, error) - - // GetStatsFunc mocks the GetStats method. - GetStatsFunc func(param *meilisearch.StatsParams) (*meilisearch.StatsIndex, error) - - // GetStatsWithContextFunc mocks the GetStatsWithContext method. - GetStatsWithContextFunc func(ctx context.Context, param *meilisearch.StatsParams) (*meilisearch.StatsIndex, error) - - // GetStopWordsFunc mocks the GetStopWords method. - GetStopWordsFunc func() (*[]string, error) - - // GetStopWordsWithContextFunc mocks the GetStopWordsWithContext method. - GetStopWordsWithContextFunc func(ctx context.Context) (*[]string, error) - - // GetSynonymsFunc mocks the GetSynonyms method. - GetSynonymsFunc func() (*map[string][]string, error) - - // GetSynonymsWithContextFunc mocks the GetSynonymsWithContext method. - GetSynonymsWithContextFunc func(ctx context.Context) (*map[string][]string, error) - - // GetTaskFunc mocks the GetTask method. - GetTaskFunc func(taskUID int64) (*meilisearch.Task, error) - - // GetTaskReaderFunc mocks the GetTaskReader method. - GetTaskReaderFunc func() meilisearch.TaskReader - - // GetTaskWithContextFunc mocks the GetTaskWithContext method. - GetTaskWithContextFunc func(ctx context.Context, taskUID int64) (*meilisearch.Task, error) - - // GetTasksFunc mocks the GetTasks method. - GetTasksFunc func(param *meilisearch.TasksQuery) (*meilisearch.TaskResult, error) - - // GetTasksWithContextFunc mocks the GetTasksWithContext method. - GetTasksWithContextFunc func(ctx context.Context, param *meilisearch.TasksQuery) (*meilisearch.TaskResult, error) - - // GetTypoToleranceFunc mocks the GetTypoTolerance method. - GetTypoToleranceFunc func() (*meilisearch.TypoTolerance, error) - - // GetTypoToleranceWithContextFunc mocks the GetTypoToleranceWithContext method. - GetTypoToleranceWithContextFunc func(ctx context.Context) (*meilisearch.TypoTolerance, error) - - // ResetDictionaryFunc mocks the ResetDictionary method. - ResetDictionaryFunc func() (*meilisearch.TaskInfo, error) - - // ResetDictionaryWithContextFunc mocks the ResetDictionaryWithContext method. - ResetDictionaryWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetDisplayedAttributesFunc mocks the ResetDisplayedAttributes method. - ResetDisplayedAttributesFunc func() (*meilisearch.TaskInfo, error) - - // ResetDisplayedAttributesWithContextFunc mocks the ResetDisplayedAttributesWithContext method. - ResetDisplayedAttributesWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetDistinctAttributeFunc mocks the ResetDistinctAttribute method. - ResetDistinctAttributeFunc func() (*meilisearch.TaskInfo, error) - - // ResetDistinctAttributeWithContextFunc mocks the ResetDistinctAttributeWithContext method. - ResetDistinctAttributeWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetEmbeddersFunc mocks the ResetEmbedders method. - ResetEmbeddersFunc func() (*meilisearch.TaskInfo, error) - - // ResetEmbeddersWithContextFunc mocks the ResetEmbeddersWithContext method. - ResetEmbeddersWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetFacetSearchFunc mocks the ResetFacetSearch method. - ResetFacetSearchFunc func() (*meilisearch.TaskInfo, error) - - // ResetFacetSearchWithContextFunc mocks the ResetFacetSearchWithContext method. - ResetFacetSearchWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetFacetingFunc mocks the ResetFaceting method. - ResetFacetingFunc func() (*meilisearch.TaskInfo, error) - - // ResetFacetingWithContextFunc mocks the ResetFacetingWithContext method. - ResetFacetingWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetFilterableAttributesFunc mocks the ResetFilterableAttributes method. - ResetFilterableAttributesFunc func() (*meilisearch.TaskInfo, error) - - // ResetFilterableAttributesWithContextFunc mocks the ResetFilterableAttributesWithContext method. - ResetFilterableAttributesWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetLocalizedAttributesFunc mocks the ResetLocalizedAttributes method. - ResetLocalizedAttributesFunc func() (*meilisearch.TaskInfo, error) - - // ResetLocalizedAttributesWithContextFunc mocks the ResetLocalizedAttributesWithContext method. - ResetLocalizedAttributesWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetNonSeparatorTokensFunc mocks the ResetNonSeparatorTokens method. - ResetNonSeparatorTokensFunc func() (*meilisearch.TaskInfo, error) - - // ResetNonSeparatorTokensWithContextFunc mocks the ResetNonSeparatorTokensWithContext method. - ResetNonSeparatorTokensWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetPaginationFunc mocks the ResetPagination method. - ResetPaginationFunc func() (*meilisearch.TaskInfo, error) - - // ResetPaginationWithContextFunc mocks the ResetPaginationWithContext method. - ResetPaginationWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetPrefixSearchFunc mocks the ResetPrefixSearch method. - ResetPrefixSearchFunc func() (*meilisearch.TaskInfo, error) - - // ResetPrefixSearchWithContextFunc mocks the ResetPrefixSearchWithContext method. - ResetPrefixSearchWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetProximityPrecisionFunc mocks the ResetProximityPrecision method. - ResetProximityPrecisionFunc func() (*meilisearch.TaskInfo, error) - - // ResetProximityPrecisionWithContextFunc mocks the ResetProximityPrecisionWithContext method. - ResetProximityPrecisionWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetRankingRulesFunc mocks the ResetRankingRules method. - ResetRankingRulesFunc func() (*meilisearch.TaskInfo, error) - - // ResetRankingRulesWithContextFunc mocks the ResetRankingRulesWithContext method. - ResetRankingRulesWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetSearchCutoffMsFunc mocks the ResetSearchCutoffMs method. - ResetSearchCutoffMsFunc func() (*meilisearch.TaskInfo, error) - - // ResetSearchCutoffMsWithContextFunc mocks the ResetSearchCutoffMsWithContext method. - ResetSearchCutoffMsWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetSearchableAttributesFunc mocks the ResetSearchableAttributes method. - ResetSearchableAttributesFunc func() (*meilisearch.TaskInfo, error) - - // ResetSearchableAttributesWithContextFunc mocks the ResetSearchableAttributesWithContext method. - ResetSearchableAttributesWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetSeparatorTokensFunc mocks the ResetSeparatorTokens method. - ResetSeparatorTokensFunc func() (*meilisearch.TaskInfo, error) - - // ResetSeparatorTokensWithContextFunc mocks the ResetSeparatorTokensWithContext method. - ResetSeparatorTokensWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetSettingsFunc mocks the ResetSettings method. - ResetSettingsFunc func() (*meilisearch.TaskInfo, error) - - // ResetSettingsWithContextFunc mocks the ResetSettingsWithContext method. - ResetSettingsWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetSortableAttributesFunc mocks the ResetSortableAttributes method. - ResetSortableAttributesFunc func() (*meilisearch.TaskInfo, error) - - // ResetSortableAttributesWithContextFunc mocks the ResetSortableAttributesWithContext method. - ResetSortableAttributesWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetStopWordsFunc mocks the ResetStopWords method. - ResetStopWordsFunc func() (*meilisearch.TaskInfo, error) - - // ResetStopWordsWithContextFunc mocks the ResetStopWordsWithContext method. - ResetStopWordsWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetSynonymsFunc mocks the ResetSynonyms method. - ResetSynonymsFunc func() (*meilisearch.TaskInfo, error) - - // ResetSynonymsWithContextFunc mocks the ResetSynonymsWithContext method. - ResetSynonymsWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // ResetTypoToleranceFunc mocks the ResetTypoTolerance method. - ResetTypoToleranceFunc func() (*meilisearch.TaskInfo, error) - - // ResetTypoToleranceWithContextFunc mocks the ResetTypoToleranceWithContext method. - ResetTypoToleranceWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // SearchFunc mocks the Search method. - SearchFunc func(query string, request *meilisearch.SearchRequest) (*meilisearch.SearchResponse, error) - - // SearchRawFunc mocks the SearchRaw method. - SearchRawFunc func(query string, request *meilisearch.SearchRequest) (*json.RawMessage, error) - - // SearchRawWithContextFunc mocks the SearchRawWithContext method. - SearchRawWithContextFunc func(ctx context.Context, query string, request *meilisearch.SearchRequest) (*json.RawMessage, error) - - // SearchSimilarDocumentsFunc mocks the SearchSimilarDocuments method. - SearchSimilarDocumentsFunc func(param *meilisearch.SimilarDocumentQuery, resp *meilisearch.SimilarDocumentResult) error - - // SearchSimilarDocumentsWithContextFunc mocks the SearchSimilarDocumentsWithContext method. - SearchSimilarDocumentsWithContextFunc func(ctx context.Context, param *meilisearch.SimilarDocumentQuery, resp *meilisearch.SimilarDocumentResult) error - - // SearchWithContextFunc mocks the SearchWithContext method. - SearchWithContextFunc func(ctx context.Context, query string, request *meilisearch.SearchRequest) (*meilisearch.SearchResponse, error) - - // UpdateDictionaryFunc mocks the UpdateDictionary method. - UpdateDictionaryFunc func(words []string) (*meilisearch.TaskInfo, error) - - // UpdateDictionaryWithContextFunc mocks the UpdateDictionaryWithContext method. - UpdateDictionaryWithContextFunc func(ctx context.Context, words []string) (*meilisearch.TaskInfo, error) - - // UpdateDisplayedAttributesFunc mocks the UpdateDisplayedAttributes method. - UpdateDisplayedAttributesFunc func(request *[]string) (*meilisearch.TaskInfo, error) - - // UpdateDisplayedAttributesWithContextFunc mocks the UpdateDisplayedAttributesWithContext method. - UpdateDisplayedAttributesWithContextFunc func(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) - - // UpdateDistinctAttributeFunc mocks the UpdateDistinctAttribute method. - UpdateDistinctAttributeFunc func(request string) (*meilisearch.TaskInfo, error) - - // UpdateDistinctAttributeWithContextFunc mocks the UpdateDistinctAttributeWithContext method. - UpdateDistinctAttributeWithContextFunc func(ctx context.Context, request string) (*meilisearch.TaskInfo, error) - - // UpdateDocumentsFunc mocks the UpdateDocuments method. - UpdateDocumentsFunc func(documentsPtr interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // UpdateDocumentsByFunctionFunc mocks the UpdateDocumentsByFunction method. - UpdateDocumentsByFunctionFunc func(req *meilisearch.UpdateDocumentByFunctionRequest) (*meilisearch.TaskInfo, error) - - // UpdateDocumentsByFunctionWithContextFunc mocks the UpdateDocumentsByFunctionWithContext method. - UpdateDocumentsByFunctionWithContextFunc func(ctx context.Context, req *meilisearch.UpdateDocumentByFunctionRequest) (*meilisearch.TaskInfo, error) - - // UpdateDocumentsCsvFunc mocks the UpdateDocumentsCsv method. - UpdateDocumentsCsvFunc func(documents []byte, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) - - // UpdateDocumentsCsvInBatchesFunc mocks the UpdateDocumentsCsvInBatches method. - UpdateDocumentsCsvInBatchesFunc func(documents []byte, batchsize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) - - // UpdateDocumentsCsvInBatchesWithContextFunc mocks the UpdateDocumentsCsvInBatchesWithContext method. - UpdateDocumentsCsvInBatchesWithContextFunc func(ctx context.Context, documents []byte, batchsize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) - - // UpdateDocumentsCsvWithContextFunc mocks the UpdateDocumentsCsvWithContext method. - UpdateDocumentsCsvWithContextFunc func(ctx context.Context, documents []byte, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) - - // UpdateDocumentsInBatchesFunc mocks the UpdateDocumentsInBatches method. - UpdateDocumentsInBatchesFunc func(documentsPtr interface{}, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) - - // UpdateDocumentsInBatchesWithContextFunc mocks the UpdateDocumentsInBatchesWithContext method. - UpdateDocumentsInBatchesWithContextFunc func(ctx context.Context, documentsPtr interface{}, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) - - // UpdateDocumentsNdjsonFunc mocks the UpdateDocumentsNdjson method. - UpdateDocumentsNdjsonFunc func(documents []byte, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // UpdateDocumentsNdjsonInBatchesFunc mocks the UpdateDocumentsNdjsonInBatches method. - UpdateDocumentsNdjsonInBatchesFunc func(documents []byte, batchsize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) - - // UpdateDocumentsNdjsonInBatchesWithContextFunc mocks the UpdateDocumentsNdjsonInBatchesWithContext method. - UpdateDocumentsNdjsonInBatchesWithContextFunc func(ctx context.Context, documents []byte, batchsize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) - - // UpdateDocumentsNdjsonWithContextFunc mocks the UpdateDocumentsNdjsonWithContext method. - UpdateDocumentsNdjsonWithContextFunc func(ctx context.Context, documents []byte, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // UpdateDocumentsWithContextFunc mocks the UpdateDocumentsWithContext method. - UpdateDocumentsWithContextFunc func(ctx context.Context, documentsPtr interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) - - // UpdateEmbeddersFunc mocks the UpdateEmbedders method. - UpdateEmbeddersFunc func(request map[string]meilisearch.Embedder) (*meilisearch.TaskInfo, error) - - // UpdateEmbeddersWithContextFunc mocks the UpdateEmbeddersWithContext method. - UpdateEmbeddersWithContextFunc func(ctx context.Context, request map[string]meilisearch.Embedder) (*meilisearch.TaskInfo, error) - - // UpdateFacetSearchFunc mocks the UpdateFacetSearch method. - UpdateFacetSearchFunc func(request bool) (*meilisearch.TaskInfo, error) - - // UpdateFacetSearchWithContextFunc mocks the UpdateFacetSearchWithContext method. - UpdateFacetSearchWithContextFunc func(ctx context.Context, request bool) (*meilisearch.TaskInfo, error) - - // UpdateFacetingFunc mocks the UpdateFaceting method. - UpdateFacetingFunc func(request *meilisearch.Faceting) (*meilisearch.TaskInfo, error) - - // UpdateFacetingWithContextFunc mocks the UpdateFacetingWithContext method. - UpdateFacetingWithContextFunc func(ctx context.Context, request *meilisearch.Faceting) (*meilisearch.TaskInfo, error) - - // UpdateFilterableAttributesFunc mocks the UpdateFilterableAttributes method. - UpdateFilterableAttributesFunc func(request *[]interface{}) (*meilisearch.TaskInfo, error) - - // UpdateFilterableAttributesWithContextFunc mocks the UpdateFilterableAttributesWithContext method. - UpdateFilterableAttributesWithContextFunc func(ctx context.Context, request *[]interface{}) (*meilisearch.TaskInfo, error) - - // UpdateIndexFunc mocks the UpdateIndex method. - UpdateIndexFunc func(params *meilisearch.UpdateIndexRequestParams) (*meilisearch.TaskInfo, error) - - // UpdateIndexWithContextFunc mocks the UpdateIndexWithContext method. - UpdateIndexWithContextFunc func(ctx context.Context, params *meilisearch.UpdateIndexRequestParams) (*meilisearch.TaskInfo, error) - - // UpdateLocalizedAttributesFunc mocks the UpdateLocalizedAttributes method. - UpdateLocalizedAttributesFunc func(request []*meilisearch.LocalizedAttributes) (*meilisearch.TaskInfo, error) - - // UpdateLocalizedAttributesWithContextFunc mocks the UpdateLocalizedAttributesWithContext method. - UpdateLocalizedAttributesWithContextFunc func(ctx context.Context, request []*meilisearch.LocalizedAttributes) (*meilisearch.TaskInfo, error) - - // UpdateNonSeparatorTokensFunc mocks the UpdateNonSeparatorTokens method. - UpdateNonSeparatorTokensFunc func(tokens []string) (*meilisearch.TaskInfo, error) - - // UpdateNonSeparatorTokensWithContextFunc mocks the UpdateNonSeparatorTokensWithContext method. - UpdateNonSeparatorTokensWithContextFunc func(ctx context.Context, tokens []string) (*meilisearch.TaskInfo, error) - - // UpdatePaginationFunc mocks the UpdatePagination method. - UpdatePaginationFunc func(request *meilisearch.Pagination) (*meilisearch.TaskInfo, error) - - // UpdatePaginationWithContextFunc mocks the UpdatePaginationWithContext method. - UpdatePaginationWithContextFunc func(ctx context.Context, request *meilisearch.Pagination) (*meilisearch.TaskInfo, error) - - // UpdatePrefixSearchFunc mocks the UpdatePrefixSearch method. - UpdatePrefixSearchFunc func(request string) (*meilisearch.TaskInfo, error) - - // UpdatePrefixSearchWithContextFunc mocks the UpdatePrefixSearchWithContext method. - UpdatePrefixSearchWithContextFunc func(ctx context.Context, request string) (*meilisearch.TaskInfo, error) - - // UpdateProximityPrecisionFunc mocks the UpdateProximityPrecision method. - UpdateProximityPrecisionFunc func(proximityType meilisearch.ProximityPrecisionType) (*meilisearch.TaskInfo, error) - - // UpdateProximityPrecisionWithContextFunc mocks the UpdateProximityPrecisionWithContext method. - UpdateProximityPrecisionWithContextFunc func(ctx context.Context, proximityType meilisearch.ProximityPrecisionType) (*meilisearch.TaskInfo, error) - - // UpdateRankingRulesFunc mocks the UpdateRankingRules method. - UpdateRankingRulesFunc func(request *[]string) (*meilisearch.TaskInfo, error) - - // UpdateRankingRulesWithContextFunc mocks the UpdateRankingRulesWithContext method. - UpdateRankingRulesWithContextFunc func(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) - - // UpdateSearchCutoffMsFunc mocks the UpdateSearchCutoffMs method. - UpdateSearchCutoffMsFunc func(request int64) (*meilisearch.TaskInfo, error) - - // UpdateSearchCutoffMsWithContextFunc mocks the UpdateSearchCutoffMsWithContext method. - UpdateSearchCutoffMsWithContextFunc func(ctx context.Context, request int64) (*meilisearch.TaskInfo, error) - - // UpdateSearchableAttributesFunc mocks the UpdateSearchableAttributes method. - UpdateSearchableAttributesFunc func(request *[]string) (*meilisearch.TaskInfo, error) - - // UpdateSearchableAttributesWithContextFunc mocks the UpdateSearchableAttributesWithContext method. - UpdateSearchableAttributesWithContextFunc func(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) - - // UpdateSeparatorTokensFunc mocks the UpdateSeparatorTokens method. - UpdateSeparatorTokensFunc func(tokens []string) (*meilisearch.TaskInfo, error) - - // UpdateSeparatorTokensWithContextFunc mocks the UpdateSeparatorTokensWithContext method. - UpdateSeparatorTokensWithContextFunc func(ctx context.Context, tokens []string) (*meilisearch.TaskInfo, error) - - // UpdateSettingsFunc mocks the UpdateSettings method. - UpdateSettingsFunc func(request *meilisearch.Settings) (*meilisearch.TaskInfo, error) - - // UpdateSettingsWithContextFunc mocks the UpdateSettingsWithContext method. - UpdateSettingsWithContextFunc func(ctx context.Context, request *meilisearch.Settings) (*meilisearch.TaskInfo, error) - - // UpdateSortableAttributesFunc mocks the UpdateSortableAttributes method. - UpdateSortableAttributesFunc func(request *[]string) (*meilisearch.TaskInfo, error) - - // UpdateSortableAttributesWithContextFunc mocks the UpdateSortableAttributesWithContext method. - UpdateSortableAttributesWithContextFunc func(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) - - // UpdateStopWordsFunc mocks the UpdateStopWords method. - UpdateStopWordsFunc func(request *[]string) (*meilisearch.TaskInfo, error) - - // UpdateStopWordsWithContextFunc mocks the UpdateStopWordsWithContext method. - UpdateStopWordsWithContextFunc func(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) - - // UpdateSynonymsFunc mocks the UpdateSynonyms method. - UpdateSynonymsFunc func(request *map[string][]string) (*meilisearch.TaskInfo, error) - - // UpdateSynonymsWithContextFunc mocks the UpdateSynonymsWithContext method. - UpdateSynonymsWithContextFunc func(ctx context.Context, request *map[string][]string) (*meilisearch.TaskInfo, error) - - // UpdateTypoToleranceFunc mocks the UpdateTypoTolerance method. - UpdateTypoToleranceFunc func(request *meilisearch.TypoTolerance) (*meilisearch.TaskInfo, error) - - // UpdateTypoToleranceWithContextFunc mocks the UpdateTypoToleranceWithContext method. - UpdateTypoToleranceWithContextFunc func(ctx context.Context, request *meilisearch.TypoTolerance) (*meilisearch.TaskInfo, error) - - // WaitForTaskFunc mocks the WaitForTask method. - WaitForTaskFunc func(taskUID int64, interval time.Duration) (*meilisearch.Task, error) - - // WaitForTaskWithContextFunc mocks the WaitForTaskWithContext method. - WaitForTaskWithContextFunc func(ctx context.Context, taskUID int64, interval time.Duration) (*meilisearch.Task, error) - - // calls tracks calls to the methods. - calls struct { - // AddDocuments holds details about calls to the AddDocuments method. - AddDocuments []struct { - // DocumentsPtr is the documentsPtr argument value. - DocumentsPtr interface{} - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // AddDocumentsCsv holds details about calls to the AddDocumentsCsv method. - AddDocumentsCsv []struct { - // Documents is the documents argument value. - Documents []byte - // Options is the options argument value. - Options *meilisearch.CsvDocumentsQuery - } - // AddDocumentsCsvFromReader holds details about calls to the AddDocumentsCsvFromReader method. - AddDocumentsCsvFromReader []struct { - // Documents is the documents argument value. - Documents io.Reader - // Options is the options argument value. - Options *meilisearch.CsvDocumentsQuery - } - // AddDocumentsCsvFromReaderInBatches holds details about calls to the AddDocumentsCsvFromReaderInBatches method. - AddDocumentsCsvFromReaderInBatches []struct { - // Documents is the documents argument value. - Documents io.Reader - // BatchSize is the batchSize argument value. - BatchSize int - // Options is the options argument value. - Options *meilisearch.CsvDocumentsQuery - } - // AddDocumentsCsvFromReaderInBatchesWithContext holds details about calls to the AddDocumentsCsvFromReaderInBatchesWithContext method. - AddDocumentsCsvFromReaderInBatchesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Documents is the documents argument value. - Documents io.Reader - // BatchSize is the batchSize argument value. - BatchSize int - // Options is the options argument value. - Options *meilisearch.CsvDocumentsQuery - } - // AddDocumentsCsvFromReaderWithContext holds details about calls to the AddDocumentsCsvFromReaderWithContext method. - AddDocumentsCsvFromReaderWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Documents is the documents argument value. - Documents io.Reader - // Options is the options argument value. - Options *meilisearch.CsvDocumentsQuery - } - // AddDocumentsCsvInBatches holds details about calls to the AddDocumentsCsvInBatches method. - AddDocumentsCsvInBatches []struct { - // Documents is the documents argument value. - Documents []byte - // BatchSize is the batchSize argument value. - BatchSize int - // Options is the options argument value. - Options *meilisearch.CsvDocumentsQuery - } - // AddDocumentsCsvInBatchesWithContext holds details about calls to the AddDocumentsCsvInBatchesWithContext method. - AddDocumentsCsvInBatchesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Documents is the documents argument value. - Documents []byte - // BatchSize is the batchSize argument value. - BatchSize int - // Options is the options argument value. - Options *meilisearch.CsvDocumentsQuery - } - // AddDocumentsCsvWithContext holds details about calls to the AddDocumentsCsvWithContext method. - AddDocumentsCsvWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Documents is the documents argument value. - Documents []byte - // Options is the options argument value. - Options *meilisearch.CsvDocumentsQuery - } - // AddDocumentsInBatches holds details about calls to the AddDocumentsInBatches method. - AddDocumentsInBatches []struct { - // DocumentsPtr is the documentsPtr argument value. - DocumentsPtr interface{} - // BatchSize is the batchSize argument value. - BatchSize int - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // AddDocumentsInBatchesWithContext holds details about calls to the AddDocumentsInBatchesWithContext method. - AddDocumentsInBatchesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // DocumentsPtr is the documentsPtr argument value. - DocumentsPtr interface{} - // BatchSize is the batchSize argument value. - BatchSize int - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // AddDocumentsNdjson holds details about calls to the AddDocumentsNdjson method. - AddDocumentsNdjson []struct { - // Documents is the documents argument value. - Documents []byte - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // AddDocumentsNdjsonFromReader holds details about calls to the AddDocumentsNdjsonFromReader method. - AddDocumentsNdjsonFromReader []struct { - // Documents is the documents argument value. - Documents io.Reader - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // AddDocumentsNdjsonFromReaderInBatches holds details about calls to the AddDocumentsNdjsonFromReaderInBatches method. - AddDocumentsNdjsonFromReaderInBatches []struct { - // Documents is the documents argument value. - Documents io.Reader - // BatchSize is the batchSize argument value. - BatchSize int - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // AddDocumentsNdjsonFromReaderInBatchesWithContext holds details about calls to the AddDocumentsNdjsonFromReaderInBatchesWithContext method. - AddDocumentsNdjsonFromReaderInBatchesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Documents is the documents argument value. - Documents io.Reader - // BatchSize is the batchSize argument value. - BatchSize int - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // AddDocumentsNdjsonFromReaderWithContext holds details about calls to the AddDocumentsNdjsonFromReaderWithContext method. - AddDocumentsNdjsonFromReaderWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Documents is the documents argument value. - Documents io.Reader - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // AddDocumentsNdjsonInBatches holds details about calls to the AddDocumentsNdjsonInBatches method. - AddDocumentsNdjsonInBatches []struct { - // Documents is the documents argument value. - Documents []byte - // BatchSize is the batchSize argument value. - BatchSize int - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // AddDocumentsNdjsonInBatchesWithContext holds details about calls to the AddDocumentsNdjsonInBatchesWithContext method. - AddDocumentsNdjsonInBatchesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Documents is the documents argument value. - Documents []byte - // BatchSize is the batchSize argument value. - BatchSize int - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // AddDocumentsNdjsonWithContext holds details about calls to the AddDocumentsNdjsonWithContext method. - AddDocumentsNdjsonWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Documents is the documents argument value. - Documents []byte - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // AddDocumentsWithContext holds details about calls to the AddDocumentsWithContext method. - AddDocumentsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // DocumentsPtr is the documentsPtr argument value. - DocumentsPtr interface{} - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // Compact holds details about calls to the Compact method. - Compact []struct { - } - // CompactWithContext holds details about calls to the CompactWithContext method. - CompactWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // Delete holds details about calls to the Delete method. - Delete []struct { - // UID is the uid argument value. - UID string - } - // DeleteAllDocuments holds details about calls to the DeleteAllDocuments method. - DeleteAllDocuments []struct { - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // DeleteAllDocumentsWithContext holds details about calls to the DeleteAllDocumentsWithContext method. - DeleteAllDocumentsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // DeleteDocument holds details about calls to the DeleteDocument method. - DeleteDocument []struct { - // Identifier is the identifier argument value. - Identifier string - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // DeleteDocumentWithContext holds details about calls to the DeleteDocumentWithContext method. - DeleteDocumentWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Identifier is the identifier argument value. - Identifier string - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // DeleteDocuments holds details about calls to the DeleteDocuments method. - DeleteDocuments []struct { - // Identifiers is the identifiers argument value. - Identifiers []string - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // DeleteDocumentsByFilter holds details about calls to the DeleteDocumentsByFilter method. - DeleteDocumentsByFilter []struct { - // Filter is the filter argument value. - Filter interface{} - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // DeleteDocumentsByFilterWithContext holds details about calls to the DeleteDocumentsByFilterWithContext method. - DeleteDocumentsByFilterWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Filter is the filter argument value. - Filter interface{} - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // DeleteDocumentsWithContext holds details about calls to the DeleteDocumentsWithContext method. - DeleteDocumentsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Identifiers is the identifiers argument value. - Identifiers []string - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // DeleteWithContext holds details about calls to the DeleteWithContext method. - DeleteWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // UID is the uid argument value. - UID string - } - // FacetSearch holds details about calls to the FacetSearch method. - FacetSearch []struct { - // Request is the request argument value. - Request *meilisearch.FacetSearchRequest - } - // FacetSearchWithContext holds details about calls to the FacetSearchWithContext method. - FacetSearchWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request *meilisearch.FacetSearchRequest - } - // FetchInfo holds details about calls to the FetchInfo method. - FetchInfo []struct { - } - // FetchInfoWithContext holds details about calls to the FetchInfoWithContext method. - FetchInfoWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // FetchPrimaryKey holds details about calls to the FetchPrimaryKey method. - FetchPrimaryKey []struct { - } - // FetchPrimaryKeyWithContext holds details about calls to the FetchPrimaryKeyWithContext method. - FetchPrimaryKeyWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetDictionary holds details about calls to the GetDictionary method. - GetDictionary []struct { - } - // GetDictionaryWithContext holds details about calls to the GetDictionaryWithContext method. - GetDictionaryWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetDisplayedAttributes holds details about calls to the GetDisplayedAttributes method. - GetDisplayedAttributes []struct { - } - // GetDisplayedAttributesWithContext holds details about calls to the GetDisplayedAttributesWithContext method. - GetDisplayedAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetDistinctAttribute holds details about calls to the GetDistinctAttribute method. - GetDistinctAttribute []struct { - } - // GetDistinctAttributeWithContext holds details about calls to the GetDistinctAttributeWithContext method. - GetDistinctAttributeWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetDocument holds details about calls to the GetDocument method. - GetDocument []struct { - // Identifier is the identifier argument value. - Identifier string - // Request is the request argument value. - Request *meilisearch.DocumentQuery - // DocumentPtr is the documentPtr argument value. - DocumentPtr interface{} - } - // GetDocumentManager holds details about calls to the GetDocumentManager method. - GetDocumentManager []struct { - } - // GetDocumentReader holds details about calls to the GetDocumentReader method. - GetDocumentReader []struct { - } - // GetDocumentWithContext holds details about calls to the GetDocumentWithContext method. - GetDocumentWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Identifier is the identifier argument value. - Identifier string - // Request is the request argument value. - Request *meilisearch.DocumentQuery - // DocumentPtr is the documentPtr argument value. - DocumentPtr interface{} - } - // GetDocuments holds details about calls to the GetDocuments method. - GetDocuments []struct { - // Param is the param argument value. - Param *meilisearch.DocumentsQuery - // Resp is the resp argument value. - Resp *meilisearch.DocumentsResult - } - // GetDocumentsWithContext holds details about calls to the GetDocumentsWithContext method. - GetDocumentsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Param is the param argument value. - Param *meilisearch.DocumentsQuery - // Resp is the resp argument value. - Resp *meilisearch.DocumentsResult - } - // GetEmbedders holds details about calls to the GetEmbedders method. - GetEmbedders []struct { - } - // GetEmbeddersWithContext holds details about calls to the GetEmbeddersWithContext method. - GetEmbeddersWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetFacetSearch holds details about calls to the GetFacetSearch method. - GetFacetSearch []struct { - } - // GetFacetSearchWithContext holds details about calls to the GetFacetSearchWithContext method. - GetFacetSearchWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetFaceting holds details about calls to the GetFaceting method. - GetFaceting []struct { - } - // GetFacetingWithContext holds details about calls to the GetFacetingWithContext method. - GetFacetingWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetFilterableAttributes holds details about calls to the GetFilterableAttributes method. - GetFilterableAttributes []struct { - } - // GetFilterableAttributesWithContext holds details about calls to the GetFilterableAttributesWithContext method. - GetFilterableAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetIndexReader holds details about calls to the GetIndexReader method. - GetIndexReader []struct { - } - // GetLocalizedAttributes holds details about calls to the GetLocalizedAttributes method. - GetLocalizedAttributes []struct { - } - // GetLocalizedAttributesWithContext holds details about calls to the GetLocalizedAttributesWithContext method. - GetLocalizedAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetNonSeparatorTokens holds details about calls to the GetNonSeparatorTokens method. - GetNonSeparatorTokens []struct { - } - // GetNonSeparatorTokensWithContext holds details about calls to the GetNonSeparatorTokensWithContext method. - GetNonSeparatorTokensWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetPagination holds details about calls to the GetPagination method. - GetPagination []struct { - } - // GetPaginationWithContext holds details about calls to the GetPaginationWithContext method. - GetPaginationWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetPrefixSearch holds details about calls to the GetPrefixSearch method. - GetPrefixSearch []struct { - } - // GetPrefixSearchWithContext holds details about calls to the GetPrefixSearchWithContext method. - GetPrefixSearchWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetProximityPrecision holds details about calls to the GetProximityPrecision method. - GetProximityPrecision []struct { - } - // GetProximityPrecisionWithContext holds details about calls to the GetProximityPrecisionWithContext method. - GetProximityPrecisionWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetRankingRules holds details about calls to the GetRankingRules method. - GetRankingRules []struct { - } - // GetRankingRulesWithContext holds details about calls to the GetRankingRulesWithContext method. - GetRankingRulesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetSearch holds details about calls to the GetSearch method. - GetSearch []struct { - } - // GetSearchCutoffMs holds details about calls to the GetSearchCutoffMs method. - GetSearchCutoffMs []struct { - } - // GetSearchCutoffMsWithContext holds details about calls to the GetSearchCutoffMsWithContext method. - GetSearchCutoffMsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetSearchableAttributes holds details about calls to the GetSearchableAttributes method. - GetSearchableAttributes []struct { - } - // GetSearchableAttributesWithContext holds details about calls to the GetSearchableAttributesWithContext method. - GetSearchableAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetSeparatorTokens holds details about calls to the GetSeparatorTokens method. - GetSeparatorTokens []struct { - } - // GetSeparatorTokensWithContext holds details about calls to the GetSeparatorTokensWithContext method. - GetSeparatorTokensWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetSettings holds details about calls to the GetSettings method. - GetSettings []struct { - } - // GetSettingsManager holds details about calls to the GetSettingsManager method. - GetSettingsManager []struct { - } - // GetSettingsReader holds details about calls to the GetSettingsReader method. - GetSettingsReader []struct { - } - // GetSettingsWithContext holds details about calls to the GetSettingsWithContext method. - GetSettingsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetSortableAttributes holds details about calls to the GetSortableAttributes method. - GetSortableAttributes []struct { - } - // GetSortableAttributesWithContext holds details about calls to the GetSortableAttributesWithContext method. - GetSortableAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetStats holds details about calls to the GetStats method. - GetStats []struct { - // Param is the param argument value. - Param *meilisearch.StatsParams - } - // GetStatsWithContext holds details about calls to the GetStatsWithContext method. - GetStatsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Param is the param argument value. - Param *meilisearch.StatsParams - } - // GetStopWords holds details about calls to the GetStopWords method. - GetStopWords []struct { - } - // GetStopWordsWithContext holds details about calls to the GetStopWordsWithContext method. - GetStopWordsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetSynonyms holds details about calls to the GetSynonyms method. - GetSynonyms []struct { - } - // GetSynonymsWithContext holds details about calls to the GetSynonymsWithContext method. - GetSynonymsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetTask holds details about calls to the GetTask method. - GetTask []struct { - // TaskUID is the taskUID argument value. - TaskUID int64 - } - // GetTaskReader holds details about calls to the GetTaskReader method. - GetTaskReader []struct { - } - // GetTaskWithContext holds details about calls to the GetTaskWithContext method. - GetTaskWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // TaskUID is the taskUID argument value. - TaskUID int64 - } - // GetTasks holds details about calls to the GetTasks method. - GetTasks []struct { - // Param is the param argument value. - Param *meilisearch.TasksQuery - } - // GetTasksWithContext holds details about calls to the GetTasksWithContext method. - GetTasksWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Param is the param argument value. - Param *meilisearch.TasksQuery - } - // GetTypoTolerance holds details about calls to the GetTypoTolerance method. - GetTypoTolerance []struct { - } - // GetTypoToleranceWithContext holds details about calls to the GetTypoToleranceWithContext method. - GetTypoToleranceWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetDictionary holds details about calls to the ResetDictionary method. - ResetDictionary []struct { - } - // ResetDictionaryWithContext holds details about calls to the ResetDictionaryWithContext method. - ResetDictionaryWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetDisplayedAttributes holds details about calls to the ResetDisplayedAttributes method. - ResetDisplayedAttributes []struct { - } - // ResetDisplayedAttributesWithContext holds details about calls to the ResetDisplayedAttributesWithContext method. - ResetDisplayedAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetDistinctAttribute holds details about calls to the ResetDistinctAttribute method. - ResetDistinctAttribute []struct { - } - // ResetDistinctAttributeWithContext holds details about calls to the ResetDistinctAttributeWithContext method. - ResetDistinctAttributeWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetEmbedders holds details about calls to the ResetEmbedders method. - ResetEmbedders []struct { - } - // ResetEmbeddersWithContext holds details about calls to the ResetEmbeddersWithContext method. - ResetEmbeddersWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetFacetSearch holds details about calls to the ResetFacetSearch method. - ResetFacetSearch []struct { - } - // ResetFacetSearchWithContext holds details about calls to the ResetFacetSearchWithContext method. - ResetFacetSearchWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetFaceting holds details about calls to the ResetFaceting method. - ResetFaceting []struct { - } - // ResetFacetingWithContext holds details about calls to the ResetFacetingWithContext method. - ResetFacetingWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetFilterableAttributes holds details about calls to the ResetFilterableAttributes method. - ResetFilterableAttributes []struct { - } - // ResetFilterableAttributesWithContext holds details about calls to the ResetFilterableAttributesWithContext method. - ResetFilterableAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetLocalizedAttributes holds details about calls to the ResetLocalizedAttributes method. - ResetLocalizedAttributes []struct { - } - // ResetLocalizedAttributesWithContext holds details about calls to the ResetLocalizedAttributesWithContext method. - ResetLocalizedAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetNonSeparatorTokens holds details about calls to the ResetNonSeparatorTokens method. - ResetNonSeparatorTokens []struct { - } - // ResetNonSeparatorTokensWithContext holds details about calls to the ResetNonSeparatorTokensWithContext method. - ResetNonSeparatorTokensWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetPagination holds details about calls to the ResetPagination method. - ResetPagination []struct { - } - // ResetPaginationWithContext holds details about calls to the ResetPaginationWithContext method. - ResetPaginationWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetPrefixSearch holds details about calls to the ResetPrefixSearch method. - ResetPrefixSearch []struct { - } - // ResetPrefixSearchWithContext holds details about calls to the ResetPrefixSearchWithContext method. - ResetPrefixSearchWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetProximityPrecision holds details about calls to the ResetProximityPrecision method. - ResetProximityPrecision []struct { - } - // ResetProximityPrecisionWithContext holds details about calls to the ResetProximityPrecisionWithContext method. - ResetProximityPrecisionWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetRankingRules holds details about calls to the ResetRankingRules method. - ResetRankingRules []struct { - } - // ResetRankingRulesWithContext holds details about calls to the ResetRankingRulesWithContext method. - ResetRankingRulesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetSearchCutoffMs holds details about calls to the ResetSearchCutoffMs method. - ResetSearchCutoffMs []struct { - } - // ResetSearchCutoffMsWithContext holds details about calls to the ResetSearchCutoffMsWithContext method. - ResetSearchCutoffMsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetSearchableAttributes holds details about calls to the ResetSearchableAttributes method. - ResetSearchableAttributes []struct { - } - // ResetSearchableAttributesWithContext holds details about calls to the ResetSearchableAttributesWithContext method. - ResetSearchableAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetSeparatorTokens holds details about calls to the ResetSeparatorTokens method. - ResetSeparatorTokens []struct { - } - // ResetSeparatorTokensWithContext holds details about calls to the ResetSeparatorTokensWithContext method. - ResetSeparatorTokensWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetSettings holds details about calls to the ResetSettings method. - ResetSettings []struct { - } - // ResetSettingsWithContext holds details about calls to the ResetSettingsWithContext method. - ResetSettingsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetSortableAttributes holds details about calls to the ResetSortableAttributes method. - ResetSortableAttributes []struct { - } - // ResetSortableAttributesWithContext holds details about calls to the ResetSortableAttributesWithContext method. - ResetSortableAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetStopWords holds details about calls to the ResetStopWords method. - ResetStopWords []struct { - } - // ResetStopWordsWithContext holds details about calls to the ResetStopWordsWithContext method. - ResetStopWordsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetSynonyms holds details about calls to the ResetSynonyms method. - ResetSynonyms []struct { - } - // ResetSynonymsWithContext holds details about calls to the ResetSynonymsWithContext method. - ResetSynonymsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // ResetTypoTolerance holds details about calls to the ResetTypoTolerance method. - ResetTypoTolerance []struct { - } - // ResetTypoToleranceWithContext holds details about calls to the ResetTypoToleranceWithContext method. - ResetTypoToleranceWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // Search holds details about calls to the Search method. - Search []struct { - // Query is the query argument value. - Query string - // Request is the request argument value. - Request *meilisearch.SearchRequest - } - // SearchRaw holds details about calls to the SearchRaw method. - SearchRaw []struct { - // Query is the query argument value. - Query string - // Request is the request argument value. - Request *meilisearch.SearchRequest - } - // SearchRawWithContext holds details about calls to the SearchRawWithContext method. - SearchRawWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Query is the query argument value. - Query string - // Request is the request argument value. - Request *meilisearch.SearchRequest - } - // SearchSimilarDocuments holds details about calls to the SearchSimilarDocuments method. - SearchSimilarDocuments []struct { - // Param is the param argument value. - Param *meilisearch.SimilarDocumentQuery - // Resp is the resp argument value. - Resp *meilisearch.SimilarDocumentResult - } - // SearchSimilarDocumentsWithContext holds details about calls to the SearchSimilarDocumentsWithContext method. - SearchSimilarDocumentsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Param is the param argument value. - Param *meilisearch.SimilarDocumentQuery - // Resp is the resp argument value. - Resp *meilisearch.SimilarDocumentResult - } - // SearchWithContext holds details about calls to the SearchWithContext method. - SearchWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Query is the query argument value. - Query string - // Request is the request argument value. - Request *meilisearch.SearchRequest - } - // UpdateDictionary holds details about calls to the UpdateDictionary method. - UpdateDictionary []struct { - // Words is the words argument value. - Words []string - } - // UpdateDictionaryWithContext holds details about calls to the UpdateDictionaryWithContext method. - UpdateDictionaryWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Words is the words argument value. - Words []string - } - // UpdateDisplayedAttributes holds details about calls to the UpdateDisplayedAttributes method. - UpdateDisplayedAttributes []struct { - // Request is the request argument value. - Request *[]string - } - // UpdateDisplayedAttributesWithContext holds details about calls to the UpdateDisplayedAttributesWithContext method. - UpdateDisplayedAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request *[]string - } - // UpdateDistinctAttribute holds details about calls to the UpdateDistinctAttribute method. - UpdateDistinctAttribute []struct { - // Request is the request argument value. - Request string - } - // UpdateDistinctAttributeWithContext holds details about calls to the UpdateDistinctAttributeWithContext method. - UpdateDistinctAttributeWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request string - } - // UpdateDocuments holds details about calls to the UpdateDocuments method. - UpdateDocuments []struct { - // DocumentsPtr is the documentsPtr argument value. - DocumentsPtr interface{} - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // UpdateDocumentsByFunction holds details about calls to the UpdateDocumentsByFunction method. - UpdateDocumentsByFunction []struct { - // Req is the req argument value. - Req *meilisearch.UpdateDocumentByFunctionRequest - } - // UpdateDocumentsByFunctionWithContext holds details about calls to the UpdateDocumentsByFunctionWithContext method. - UpdateDocumentsByFunctionWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Req is the req argument value. - Req *meilisearch.UpdateDocumentByFunctionRequest - } - // UpdateDocumentsCsv holds details about calls to the UpdateDocumentsCsv method. - UpdateDocumentsCsv []struct { - // Documents is the documents argument value. - Documents []byte - // Options is the options argument value. - Options *meilisearch.CsvDocumentsQuery - } - // UpdateDocumentsCsvInBatches holds details about calls to the UpdateDocumentsCsvInBatches method. - UpdateDocumentsCsvInBatches []struct { - // Documents is the documents argument value. - Documents []byte - // Batchsize is the batchsize argument value. - Batchsize int - // Options is the options argument value. - Options *meilisearch.CsvDocumentsQuery - } - // UpdateDocumentsCsvInBatchesWithContext holds details about calls to the UpdateDocumentsCsvInBatchesWithContext method. - UpdateDocumentsCsvInBatchesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Documents is the documents argument value. - Documents []byte - // Batchsize is the batchsize argument value. - Batchsize int - // Options is the options argument value. - Options *meilisearch.CsvDocumentsQuery - } - // UpdateDocumentsCsvWithContext holds details about calls to the UpdateDocumentsCsvWithContext method. - UpdateDocumentsCsvWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Documents is the documents argument value. - Documents []byte - // Options is the options argument value. - Options *meilisearch.CsvDocumentsQuery - } - // UpdateDocumentsInBatches holds details about calls to the UpdateDocumentsInBatches method. - UpdateDocumentsInBatches []struct { - // DocumentsPtr is the documentsPtr argument value. - DocumentsPtr interface{} - // BatchSize is the batchSize argument value. - BatchSize int - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // UpdateDocumentsInBatchesWithContext holds details about calls to the UpdateDocumentsInBatchesWithContext method. - UpdateDocumentsInBatchesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // DocumentsPtr is the documentsPtr argument value. - DocumentsPtr interface{} - // BatchSize is the batchSize argument value. - BatchSize int - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // UpdateDocumentsNdjson holds details about calls to the UpdateDocumentsNdjson method. - UpdateDocumentsNdjson []struct { - // Documents is the documents argument value. - Documents []byte - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // UpdateDocumentsNdjsonInBatches holds details about calls to the UpdateDocumentsNdjsonInBatches method. - UpdateDocumentsNdjsonInBatches []struct { - // Documents is the documents argument value. - Documents []byte - // Batchsize is the batchsize argument value. - Batchsize int - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // UpdateDocumentsNdjsonInBatchesWithContext holds details about calls to the UpdateDocumentsNdjsonInBatchesWithContext method. - UpdateDocumentsNdjsonInBatchesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Documents is the documents argument value. - Documents []byte - // Batchsize is the batchsize argument value. - Batchsize int - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // UpdateDocumentsNdjsonWithContext holds details about calls to the UpdateDocumentsNdjsonWithContext method. - UpdateDocumentsNdjsonWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Documents is the documents argument value. - Documents []byte - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // UpdateDocumentsWithContext holds details about calls to the UpdateDocumentsWithContext method. - UpdateDocumentsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // DocumentsPtr is the documentsPtr argument value. - DocumentsPtr interface{} - // Opts is the opts argument value. - Opts *meilisearch.DocumentOptions - } - // UpdateEmbedders holds details about calls to the UpdateEmbedders method. - UpdateEmbedders []struct { - // Request is the request argument value. - Request map[string]meilisearch.Embedder - } - // UpdateEmbeddersWithContext holds details about calls to the UpdateEmbeddersWithContext method. - UpdateEmbeddersWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request map[string]meilisearch.Embedder - } - // UpdateFacetSearch holds details about calls to the UpdateFacetSearch method. - UpdateFacetSearch []struct { - // Request is the request argument value. - Request bool - } - // UpdateFacetSearchWithContext holds details about calls to the UpdateFacetSearchWithContext method. - UpdateFacetSearchWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request bool - } - // UpdateFaceting holds details about calls to the UpdateFaceting method. - UpdateFaceting []struct { - // Request is the request argument value. - Request *meilisearch.Faceting - } - // UpdateFacetingWithContext holds details about calls to the UpdateFacetingWithContext method. - UpdateFacetingWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request *meilisearch.Faceting - } - // UpdateFilterableAttributes holds details about calls to the UpdateFilterableAttributes method. - UpdateFilterableAttributes []struct { - // Request is the request argument value. - Request *[]interface{} - } - // UpdateFilterableAttributesWithContext holds details about calls to the UpdateFilterableAttributesWithContext method. - UpdateFilterableAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request *[]interface{} - } - // UpdateIndex holds details about calls to the UpdateIndex method. - UpdateIndex []struct { - // Params is the params argument value. - Params *meilisearch.UpdateIndexRequestParams - } - // UpdateIndexWithContext holds details about calls to the UpdateIndexWithContext method. - UpdateIndexWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Params is the params argument value. - Params *meilisearch.UpdateIndexRequestParams - } - // UpdateLocalizedAttributes holds details about calls to the UpdateLocalizedAttributes method. - UpdateLocalizedAttributes []struct { - // Request is the request argument value. - Request []*meilisearch.LocalizedAttributes - } - // UpdateLocalizedAttributesWithContext holds details about calls to the UpdateLocalizedAttributesWithContext method. - UpdateLocalizedAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request []*meilisearch.LocalizedAttributes - } - // UpdateNonSeparatorTokens holds details about calls to the UpdateNonSeparatorTokens method. - UpdateNonSeparatorTokens []struct { - // Tokens is the tokens argument value. - Tokens []string - } - // UpdateNonSeparatorTokensWithContext holds details about calls to the UpdateNonSeparatorTokensWithContext method. - UpdateNonSeparatorTokensWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Tokens is the tokens argument value. - Tokens []string - } - // UpdatePagination holds details about calls to the UpdatePagination method. - UpdatePagination []struct { - // Request is the request argument value. - Request *meilisearch.Pagination - } - // UpdatePaginationWithContext holds details about calls to the UpdatePaginationWithContext method. - UpdatePaginationWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request *meilisearch.Pagination - } - // UpdatePrefixSearch holds details about calls to the UpdatePrefixSearch method. - UpdatePrefixSearch []struct { - // Request is the request argument value. - Request string - } - // UpdatePrefixSearchWithContext holds details about calls to the UpdatePrefixSearchWithContext method. - UpdatePrefixSearchWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request string - } - // UpdateProximityPrecision holds details about calls to the UpdateProximityPrecision method. - UpdateProximityPrecision []struct { - // ProximityType is the proximityType argument value. - ProximityType meilisearch.ProximityPrecisionType - } - // UpdateProximityPrecisionWithContext holds details about calls to the UpdateProximityPrecisionWithContext method. - UpdateProximityPrecisionWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // ProximityType is the proximityType argument value. - ProximityType meilisearch.ProximityPrecisionType - } - // UpdateRankingRules holds details about calls to the UpdateRankingRules method. - UpdateRankingRules []struct { - // Request is the request argument value. - Request *[]string - } - // UpdateRankingRulesWithContext holds details about calls to the UpdateRankingRulesWithContext method. - UpdateRankingRulesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request *[]string - } - // UpdateSearchCutoffMs holds details about calls to the UpdateSearchCutoffMs method. - UpdateSearchCutoffMs []struct { - // Request is the request argument value. - Request int64 - } - // UpdateSearchCutoffMsWithContext holds details about calls to the UpdateSearchCutoffMsWithContext method. - UpdateSearchCutoffMsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request int64 - } - // UpdateSearchableAttributes holds details about calls to the UpdateSearchableAttributes method. - UpdateSearchableAttributes []struct { - // Request is the request argument value. - Request *[]string - } - // UpdateSearchableAttributesWithContext holds details about calls to the UpdateSearchableAttributesWithContext method. - UpdateSearchableAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request *[]string - } - // UpdateSeparatorTokens holds details about calls to the UpdateSeparatorTokens method. - UpdateSeparatorTokens []struct { - // Tokens is the tokens argument value. - Tokens []string - } - // UpdateSeparatorTokensWithContext holds details about calls to the UpdateSeparatorTokensWithContext method. - UpdateSeparatorTokensWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Tokens is the tokens argument value. - Tokens []string - } - // UpdateSettings holds details about calls to the UpdateSettings method. - UpdateSettings []struct { - // Request is the request argument value. - Request *meilisearch.Settings - } - // UpdateSettingsWithContext holds details about calls to the UpdateSettingsWithContext method. - UpdateSettingsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request *meilisearch.Settings - } - // UpdateSortableAttributes holds details about calls to the UpdateSortableAttributes method. - UpdateSortableAttributes []struct { - // Request is the request argument value. - Request *[]string - } - // UpdateSortableAttributesWithContext holds details about calls to the UpdateSortableAttributesWithContext method. - UpdateSortableAttributesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request *[]string - } - // UpdateStopWords holds details about calls to the UpdateStopWords method. - UpdateStopWords []struct { - // Request is the request argument value. - Request *[]string - } - // UpdateStopWordsWithContext holds details about calls to the UpdateStopWordsWithContext method. - UpdateStopWordsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request *[]string - } - // UpdateSynonyms holds details about calls to the UpdateSynonyms method. - UpdateSynonyms []struct { - // Request is the request argument value. - Request *map[string][]string - } - // UpdateSynonymsWithContext holds details about calls to the UpdateSynonymsWithContext method. - UpdateSynonymsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request *map[string][]string - } - // UpdateTypoTolerance holds details about calls to the UpdateTypoTolerance method. - UpdateTypoTolerance []struct { - // Request is the request argument value. - Request *meilisearch.TypoTolerance - } - // UpdateTypoToleranceWithContext holds details about calls to the UpdateTypoToleranceWithContext method. - UpdateTypoToleranceWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request *meilisearch.TypoTolerance - } - // WaitForTask holds details about calls to the WaitForTask method. - WaitForTask []struct { - // TaskUID is the taskUID argument value. - TaskUID int64 - // Interval is the interval argument value. - Interval time.Duration - } - // WaitForTaskWithContext holds details about calls to the WaitForTaskWithContext method. - WaitForTaskWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // TaskUID is the taskUID argument value. - TaskUID int64 - // Interval is the interval argument value. - Interval time.Duration - } - } - lockAddDocuments sync.RWMutex - lockAddDocumentsCsv sync.RWMutex - lockAddDocumentsCsvFromReader sync.RWMutex - lockAddDocumentsCsvFromReaderInBatches sync.RWMutex - lockAddDocumentsCsvFromReaderInBatchesWithContext sync.RWMutex - lockAddDocumentsCsvFromReaderWithContext sync.RWMutex - lockAddDocumentsCsvInBatches sync.RWMutex - lockAddDocumentsCsvInBatchesWithContext sync.RWMutex - lockAddDocumentsCsvWithContext sync.RWMutex - lockAddDocumentsInBatches sync.RWMutex - lockAddDocumentsInBatchesWithContext sync.RWMutex - lockAddDocumentsNdjson sync.RWMutex - lockAddDocumentsNdjsonFromReader sync.RWMutex - lockAddDocumentsNdjsonFromReaderInBatches sync.RWMutex - lockAddDocumentsNdjsonFromReaderInBatchesWithContext sync.RWMutex - lockAddDocumentsNdjsonFromReaderWithContext sync.RWMutex - lockAddDocumentsNdjsonInBatches sync.RWMutex - lockAddDocumentsNdjsonInBatchesWithContext sync.RWMutex - lockAddDocumentsNdjsonWithContext sync.RWMutex - lockAddDocumentsWithContext sync.RWMutex - lockCompact sync.RWMutex - lockCompactWithContext sync.RWMutex - lockDelete sync.RWMutex - lockDeleteAllDocuments sync.RWMutex - lockDeleteAllDocumentsWithContext sync.RWMutex - lockDeleteDocument sync.RWMutex - lockDeleteDocumentWithContext sync.RWMutex - lockDeleteDocuments sync.RWMutex - lockDeleteDocumentsByFilter sync.RWMutex - lockDeleteDocumentsByFilterWithContext sync.RWMutex - lockDeleteDocumentsWithContext sync.RWMutex - lockDeleteWithContext sync.RWMutex - lockFacetSearch sync.RWMutex - lockFacetSearchWithContext sync.RWMutex - lockFetchInfo sync.RWMutex - lockFetchInfoWithContext sync.RWMutex - lockFetchPrimaryKey sync.RWMutex - lockFetchPrimaryKeyWithContext sync.RWMutex - lockGetDictionary sync.RWMutex - lockGetDictionaryWithContext sync.RWMutex - lockGetDisplayedAttributes sync.RWMutex - lockGetDisplayedAttributesWithContext sync.RWMutex - lockGetDistinctAttribute sync.RWMutex - lockGetDistinctAttributeWithContext sync.RWMutex - lockGetDocument sync.RWMutex - lockGetDocumentManager sync.RWMutex - lockGetDocumentReader sync.RWMutex - lockGetDocumentWithContext sync.RWMutex - lockGetDocuments sync.RWMutex - lockGetDocumentsWithContext sync.RWMutex - lockGetEmbedders sync.RWMutex - lockGetEmbeddersWithContext sync.RWMutex - lockGetFacetSearch sync.RWMutex - lockGetFacetSearchWithContext sync.RWMutex - lockGetFaceting sync.RWMutex - lockGetFacetingWithContext sync.RWMutex - lockGetFilterableAttributes sync.RWMutex - lockGetFilterableAttributesWithContext sync.RWMutex - lockGetIndexReader sync.RWMutex - lockGetLocalizedAttributes sync.RWMutex - lockGetLocalizedAttributesWithContext sync.RWMutex - lockGetNonSeparatorTokens sync.RWMutex - lockGetNonSeparatorTokensWithContext sync.RWMutex - lockGetPagination sync.RWMutex - lockGetPaginationWithContext sync.RWMutex - lockGetPrefixSearch sync.RWMutex - lockGetPrefixSearchWithContext sync.RWMutex - lockGetProximityPrecision sync.RWMutex - lockGetProximityPrecisionWithContext sync.RWMutex - lockGetRankingRules sync.RWMutex - lockGetRankingRulesWithContext sync.RWMutex - lockGetSearch sync.RWMutex - lockGetSearchCutoffMs sync.RWMutex - lockGetSearchCutoffMsWithContext sync.RWMutex - lockGetSearchableAttributes sync.RWMutex - lockGetSearchableAttributesWithContext sync.RWMutex - lockGetSeparatorTokens sync.RWMutex - lockGetSeparatorTokensWithContext sync.RWMutex - lockGetSettings sync.RWMutex - lockGetSettingsManager sync.RWMutex - lockGetSettingsReader sync.RWMutex - lockGetSettingsWithContext sync.RWMutex - lockGetSortableAttributes sync.RWMutex - lockGetSortableAttributesWithContext sync.RWMutex - lockGetStats sync.RWMutex - lockGetStatsWithContext sync.RWMutex - lockGetStopWords sync.RWMutex - lockGetStopWordsWithContext sync.RWMutex - lockGetSynonyms sync.RWMutex - lockGetSynonymsWithContext sync.RWMutex - lockGetTask sync.RWMutex - lockGetTaskReader sync.RWMutex - lockGetTaskWithContext sync.RWMutex - lockGetTasks sync.RWMutex - lockGetTasksWithContext sync.RWMutex - lockGetTypoTolerance sync.RWMutex - lockGetTypoToleranceWithContext sync.RWMutex - lockResetDictionary sync.RWMutex - lockResetDictionaryWithContext sync.RWMutex - lockResetDisplayedAttributes sync.RWMutex - lockResetDisplayedAttributesWithContext sync.RWMutex - lockResetDistinctAttribute sync.RWMutex - lockResetDistinctAttributeWithContext sync.RWMutex - lockResetEmbedders sync.RWMutex - lockResetEmbeddersWithContext sync.RWMutex - lockResetFacetSearch sync.RWMutex - lockResetFacetSearchWithContext sync.RWMutex - lockResetFaceting sync.RWMutex - lockResetFacetingWithContext sync.RWMutex - lockResetFilterableAttributes sync.RWMutex - lockResetFilterableAttributesWithContext sync.RWMutex - lockResetLocalizedAttributes sync.RWMutex - lockResetLocalizedAttributesWithContext sync.RWMutex - lockResetNonSeparatorTokens sync.RWMutex - lockResetNonSeparatorTokensWithContext sync.RWMutex - lockResetPagination sync.RWMutex - lockResetPaginationWithContext sync.RWMutex - lockResetPrefixSearch sync.RWMutex - lockResetPrefixSearchWithContext sync.RWMutex - lockResetProximityPrecision sync.RWMutex - lockResetProximityPrecisionWithContext sync.RWMutex - lockResetRankingRules sync.RWMutex - lockResetRankingRulesWithContext sync.RWMutex - lockResetSearchCutoffMs sync.RWMutex - lockResetSearchCutoffMsWithContext sync.RWMutex - lockResetSearchableAttributes sync.RWMutex - lockResetSearchableAttributesWithContext sync.RWMutex - lockResetSeparatorTokens sync.RWMutex - lockResetSeparatorTokensWithContext sync.RWMutex - lockResetSettings sync.RWMutex - lockResetSettingsWithContext sync.RWMutex - lockResetSortableAttributes sync.RWMutex - lockResetSortableAttributesWithContext sync.RWMutex - lockResetStopWords sync.RWMutex - lockResetStopWordsWithContext sync.RWMutex - lockResetSynonyms sync.RWMutex - lockResetSynonymsWithContext sync.RWMutex - lockResetTypoTolerance sync.RWMutex - lockResetTypoToleranceWithContext sync.RWMutex - lockSearch sync.RWMutex - lockSearchRaw sync.RWMutex - lockSearchRawWithContext sync.RWMutex - lockSearchSimilarDocuments sync.RWMutex - lockSearchSimilarDocumentsWithContext sync.RWMutex - lockSearchWithContext sync.RWMutex - lockUpdateDictionary sync.RWMutex - lockUpdateDictionaryWithContext sync.RWMutex - lockUpdateDisplayedAttributes sync.RWMutex - lockUpdateDisplayedAttributesWithContext sync.RWMutex - lockUpdateDistinctAttribute sync.RWMutex - lockUpdateDistinctAttributeWithContext sync.RWMutex - lockUpdateDocuments sync.RWMutex - lockUpdateDocumentsByFunction sync.RWMutex - lockUpdateDocumentsByFunctionWithContext sync.RWMutex - lockUpdateDocumentsCsv sync.RWMutex - lockUpdateDocumentsCsvInBatches sync.RWMutex - lockUpdateDocumentsCsvInBatchesWithContext sync.RWMutex - lockUpdateDocumentsCsvWithContext sync.RWMutex - lockUpdateDocumentsInBatches sync.RWMutex - lockUpdateDocumentsInBatchesWithContext sync.RWMutex - lockUpdateDocumentsNdjson sync.RWMutex - lockUpdateDocumentsNdjsonInBatches sync.RWMutex - lockUpdateDocumentsNdjsonInBatchesWithContext sync.RWMutex - lockUpdateDocumentsNdjsonWithContext sync.RWMutex - lockUpdateDocumentsWithContext sync.RWMutex - lockUpdateEmbedders sync.RWMutex - lockUpdateEmbeddersWithContext sync.RWMutex - lockUpdateFacetSearch sync.RWMutex - lockUpdateFacetSearchWithContext sync.RWMutex - lockUpdateFaceting sync.RWMutex - lockUpdateFacetingWithContext sync.RWMutex - lockUpdateFilterableAttributes sync.RWMutex - lockUpdateFilterableAttributesWithContext sync.RWMutex - lockUpdateIndex sync.RWMutex - lockUpdateIndexWithContext sync.RWMutex - lockUpdateLocalizedAttributes sync.RWMutex - lockUpdateLocalizedAttributesWithContext sync.RWMutex - lockUpdateNonSeparatorTokens sync.RWMutex - lockUpdateNonSeparatorTokensWithContext sync.RWMutex - lockUpdatePagination sync.RWMutex - lockUpdatePaginationWithContext sync.RWMutex - lockUpdatePrefixSearch sync.RWMutex - lockUpdatePrefixSearchWithContext sync.RWMutex - lockUpdateProximityPrecision sync.RWMutex - lockUpdateProximityPrecisionWithContext sync.RWMutex - lockUpdateRankingRules sync.RWMutex - lockUpdateRankingRulesWithContext sync.RWMutex - lockUpdateSearchCutoffMs sync.RWMutex - lockUpdateSearchCutoffMsWithContext sync.RWMutex - lockUpdateSearchableAttributes sync.RWMutex - lockUpdateSearchableAttributesWithContext sync.RWMutex - lockUpdateSeparatorTokens sync.RWMutex - lockUpdateSeparatorTokensWithContext sync.RWMutex - lockUpdateSettings sync.RWMutex - lockUpdateSettingsWithContext sync.RWMutex - lockUpdateSortableAttributes sync.RWMutex - lockUpdateSortableAttributesWithContext sync.RWMutex - lockUpdateStopWords sync.RWMutex - lockUpdateStopWordsWithContext sync.RWMutex - lockUpdateSynonyms sync.RWMutex - lockUpdateSynonymsWithContext sync.RWMutex - lockUpdateTypoTolerance sync.RWMutex - lockUpdateTypoToleranceWithContext sync.RWMutex - lockWaitForTask sync.RWMutex - lockWaitForTaskWithContext sync.RWMutex -} - -// AddDocuments calls AddDocumentsFunc. -func (mock *MeiliIndexManager) AddDocuments(documentsPtr interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - DocumentsPtr interface{} - Opts *meilisearch.DocumentOptions - }{ - DocumentsPtr: documentsPtr, - Opts: opts, - } - mock.lockAddDocuments.Lock() - mock.calls.AddDocuments = append(mock.calls.AddDocuments, callInfo) - mock.lockAddDocuments.Unlock() - if mock.AddDocumentsFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.AddDocumentsFunc(documentsPtr, opts) -} - -// AddDocumentsCalls gets all the calls that were made to AddDocuments. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsCalls()) -func (mock *MeiliIndexManager) AddDocumentsCalls() []struct { - DocumentsPtr interface{} - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - DocumentsPtr interface{} - Opts *meilisearch.DocumentOptions - } - mock.lockAddDocuments.RLock() - calls = mock.calls.AddDocuments - mock.lockAddDocuments.RUnlock() - return calls -} - -// AddDocumentsCsv calls AddDocumentsCsvFunc. -func (mock *MeiliIndexManager) AddDocumentsCsv(documents []byte, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Documents []byte - Options *meilisearch.CsvDocumentsQuery - }{ - Documents: documents, - Options: options, - } - mock.lockAddDocumentsCsv.Lock() - mock.calls.AddDocumentsCsv = append(mock.calls.AddDocumentsCsv, callInfo) - mock.lockAddDocumentsCsv.Unlock() - if mock.AddDocumentsCsvFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.AddDocumentsCsvFunc(documents, options) -} - -// AddDocumentsCsvCalls gets all the calls that were made to AddDocumentsCsv. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsCsvCalls()) -func (mock *MeiliIndexManager) AddDocumentsCsvCalls() []struct { - Documents []byte - Options *meilisearch.CsvDocumentsQuery -} { - var calls []struct { - Documents []byte - Options *meilisearch.CsvDocumentsQuery - } - mock.lockAddDocumentsCsv.RLock() - calls = mock.calls.AddDocumentsCsv - mock.lockAddDocumentsCsv.RUnlock() - return calls -} - -// AddDocumentsCsvFromReader calls AddDocumentsCsvFromReaderFunc. -func (mock *MeiliIndexManager) AddDocumentsCsvFromReader(documents io.Reader, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Documents io.Reader - Options *meilisearch.CsvDocumentsQuery - }{ - Documents: documents, - Options: options, - } - mock.lockAddDocumentsCsvFromReader.Lock() - mock.calls.AddDocumentsCsvFromReader = append(mock.calls.AddDocumentsCsvFromReader, callInfo) - mock.lockAddDocumentsCsvFromReader.Unlock() - if mock.AddDocumentsCsvFromReaderFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.AddDocumentsCsvFromReaderFunc(documents, options) -} - -// AddDocumentsCsvFromReaderCalls gets all the calls that were made to AddDocumentsCsvFromReader. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsCsvFromReaderCalls()) -func (mock *MeiliIndexManager) AddDocumentsCsvFromReaderCalls() []struct { - Documents io.Reader - Options *meilisearch.CsvDocumentsQuery -} { - var calls []struct { - Documents io.Reader - Options *meilisearch.CsvDocumentsQuery - } - mock.lockAddDocumentsCsvFromReader.RLock() - calls = mock.calls.AddDocumentsCsvFromReader - mock.lockAddDocumentsCsvFromReader.RUnlock() - return calls -} - -// AddDocumentsCsvFromReaderInBatches calls AddDocumentsCsvFromReaderInBatchesFunc. -func (mock *MeiliIndexManager) AddDocumentsCsvFromReaderInBatches(documents io.Reader, batchSize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - Documents io.Reader - BatchSize int - Options *meilisearch.CsvDocumentsQuery - }{ - Documents: documents, - BatchSize: batchSize, - Options: options, - } - mock.lockAddDocumentsCsvFromReaderInBatches.Lock() - mock.calls.AddDocumentsCsvFromReaderInBatches = append(mock.calls.AddDocumentsCsvFromReaderInBatches, callInfo) - mock.lockAddDocumentsCsvFromReaderInBatches.Unlock() - if mock.AddDocumentsCsvFromReaderInBatchesFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.AddDocumentsCsvFromReaderInBatchesFunc(documents, batchSize, options) -} - -// AddDocumentsCsvFromReaderInBatchesCalls gets all the calls that were made to AddDocumentsCsvFromReaderInBatches. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsCsvFromReaderInBatchesCalls()) -func (mock *MeiliIndexManager) AddDocumentsCsvFromReaderInBatchesCalls() []struct { - Documents io.Reader - BatchSize int - Options *meilisearch.CsvDocumentsQuery -} { - var calls []struct { - Documents io.Reader - BatchSize int - Options *meilisearch.CsvDocumentsQuery - } - mock.lockAddDocumentsCsvFromReaderInBatches.RLock() - calls = mock.calls.AddDocumentsCsvFromReaderInBatches - mock.lockAddDocumentsCsvFromReaderInBatches.RUnlock() - return calls -} - -// AddDocumentsCsvFromReaderInBatchesWithContext calls AddDocumentsCsvFromReaderInBatchesWithContextFunc. -func (mock *MeiliIndexManager) AddDocumentsCsvFromReaderInBatchesWithContext(ctx context.Context, documents io.Reader, batchSize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Documents io.Reader - BatchSize int - Options *meilisearch.CsvDocumentsQuery - }{ - Ctx: ctx, - Documents: documents, - BatchSize: batchSize, - Options: options, - } - mock.lockAddDocumentsCsvFromReaderInBatchesWithContext.Lock() - mock.calls.AddDocumentsCsvFromReaderInBatchesWithContext = append(mock.calls.AddDocumentsCsvFromReaderInBatchesWithContext, callInfo) - mock.lockAddDocumentsCsvFromReaderInBatchesWithContext.Unlock() - if mock.AddDocumentsCsvFromReaderInBatchesWithContextFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.AddDocumentsCsvFromReaderInBatchesWithContextFunc(ctx, documents, batchSize, options) -} - -// AddDocumentsCsvFromReaderInBatchesWithContextCalls gets all the calls that were made to AddDocumentsCsvFromReaderInBatchesWithContext. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsCsvFromReaderInBatchesWithContextCalls()) -func (mock *MeiliIndexManager) AddDocumentsCsvFromReaderInBatchesWithContextCalls() []struct { - Ctx context.Context - Documents io.Reader - BatchSize int - Options *meilisearch.CsvDocumentsQuery -} { - var calls []struct { - Ctx context.Context - Documents io.Reader - BatchSize int - Options *meilisearch.CsvDocumentsQuery - } - mock.lockAddDocumentsCsvFromReaderInBatchesWithContext.RLock() - calls = mock.calls.AddDocumentsCsvFromReaderInBatchesWithContext - mock.lockAddDocumentsCsvFromReaderInBatchesWithContext.RUnlock() - return calls -} - -// AddDocumentsCsvFromReaderWithContext calls AddDocumentsCsvFromReaderWithContextFunc. -func (mock *MeiliIndexManager) AddDocumentsCsvFromReaderWithContext(ctx context.Context, documents io.Reader, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Documents io.Reader - Options *meilisearch.CsvDocumentsQuery - }{ - Ctx: ctx, - Documents: documents, - Options: options, - } - mock.lockAddDocumentsCsvFromReaderWithContext.Lock() - mock.calls.AddDocumentsCsvFromReaderWithContext = append(mock.calls.AddDocumentsCsvFromReaderWithContext, callInfo) - mock.lockAddDocumentsCsvFromReaderWithContext.Unlock() - if mock.AddDocumentsCsvFromReaderWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.AddDocumentsCsvFromReaderWithContextFunc(ctx, documents, options) -} - -// AddDocumentsCsvFromReaderWithContextCalls gets all the calls that were made to AddDocumentsCsvFromReaderWithContext. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsCsvFromReaderWithContextCalls()) -func (mock *MeiliIndexManager) AddDocumentsCsvFromReaderWithContextCalls() []struct { - Ctx context.Context - Documents io.Reader - Options *meilisearch.CsvDocumentsQuery -} { - var calls []struct { - Ctx context.Context - Documents io.Reader - Options *meilisearch.CsvDocumentsQuery - } - mock.lockAddDocumentsCsvFromReaderWithContext.RLock() - calls = mock.calls.AddDocumentsCsvFromReaderWithContext - mock.lockAddDocumentsCsvFromReaderWithContext.RUnlock() - return calls -} - -// AddDocumentsCsvInBatches calls AddDocumentsCsvInBatchesFunc. -func (mock *MeiliIndexManager) AddDocumentsCsvInBatches(documents []byte, batchSize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - Documents []byte - BatchSize int - Options *meilisearch.CsvDocumentsQuery - }{ - Documents: documents, - BatchSize: batchSize, - Options: options, - } - mock.lockAddDocumentsCsvInBatches.Lock() - mock.calls.AddDocumentsCsvInBatches = append(mock.calls.AddDocumentsCsvInBatches, callInfo) - mock.lockAddDocumentsCsvInBatches.Unlock() - if mock.AddDocumentsCsvInBatchesFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.AddDocumentsCsvInBatchesFunc(documents, batchSize, options) -} - -// AddDocumentsCsvInBatchesCalls gets all the calls that were made to AddDocumentsCsvInBatches. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsCsvInBatchesCalls()) -func (mock *MeiliIndexManager) AddDocumentsCsvInBatchesCalls() []struct { - Documents []byte - BatchSize int - Options *meilisearch.CsvDocumentsQuery -} { - var calls []struct { - Documents []byte - BatchSize int - Options *meilisearch.CsvDocumentsQuery - } - mock.lockAddDocumentsCsvInBatches.RLock() - calls = mock.calls.AddDocumentsCsvInBatches - mock.lockAddDocumentsCsvInBatches.RUnlock() - return calls -} - -// AddDocumentsCsvInBatchesWithContext calls AddDocumentsCsvInBatchesWithContextFunc. -func (mock *MeiliIndexManager) AddDocumentsCsvInBatchesWithContext(ctx context.Context, documents []byte, batchSize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Documents []byte - BatchSize int - Options *meilisearch.CsvDocumentsQuery - }{ - Ctx: ctx, - Documents: documents, - BatchSize: batchSize, - Options: options, - } - mock.lockAddDocumentsCsvInBatchesWithContext.Lock() - mock.calls.AddDocumentsCsvInBatchesWithContext = append(mock.calls.AddDocumentsCsvInBatchesWithContext, callInfo) - mock.lockAddDocumentsCsvInBatchesWithContext.Unlock() - if mock.AddDocumentsCsvInBatchesWithContextFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.AddDocumentsCsvInBatchesWithContextFunc(ctx, documents, batchSize, options) -} - -// AddDocumentsCsvInBatchesWithContextCalls gets all the calls that were made to AddDocumentsCsvInBatchesWithContext. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsCsvInBatchesWithContextCalls()) -func (mock *MeiliIndexManager) AddDocumentsCsvInBatchesWithContextCalls() []struct { - Ctx context.Context - Documents []byte - BatchSize int - Options *meilisearch.CsvDocumentsQuery -} { - var calls []struct { - Ctx context.Context - Documents []byte - BatchSize int - Options *meilisearch.CsvDocumentsQuery - } - mock.lockAddDocumentsCsvInBatchesWithContext.RLock() - calls = mock.calls.AddDocumentsCsvInBatchesWithContext - mock.lockAddDocumentsCsvInBatchesWithContext.RUnlock() - return calls -} - -// AddDocumentsCsvWithContext calls AddDocumentsCsvWithContextFunc. -func (mock *MeiliIndexManager) AddDocumentsCsvWithContext(ctx context.Context, documents []byte, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Documents []byte - Options *meilisearch.CsvDocumentsQuery - }{ - Ctx: ctx, - Documents: documents, - Options: options, - } - mock.lockAddDocumentsCsvWithContext.Lock() - mock.calls.AddDocumentsCsvWithContext = append(mock.calls.AddDocumentsCsvWithContext, callInfo) - mock.lockAddDocumentsCsvWithContext.Unlock() - if mock.AddDocumentsCsvWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.AddDocumentsCsvWithContextFunc(ctx, documents, options) -} - -// AddDocumentsCsvWithContextCalls gets all the calls that were made to AddDocumentsCsvWithContext. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsCsvWithContextCalls()) -func (mock *MeiliIndexManager) AddDocumentsCsvWithContextCalls() []struct { - Ctx context.Context - Documents []byte - Options *meilisearch.CsvDocumentsQuery -} { - var calls []struct { - Ctx context.Context - Documents []byte - Options *meilisearch.CsvDocumentsQuery - } - mock.lockAddDocumentsCsvWithContext.RLock() - calls = mock.calls.AddDocumentsCsvWithContext - mock.lockAddDocumentsCsvWithContext.RUnlock() - return calls -} - -// AddDocumentsInBatches calls AddDocumentsInBatchesFunc. -func (mock *MeiliIndexManager) AddDocumentsInBatches(documentsPtr interface{}, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - DocumentsPtr interface{} - BatchSize int - Opts *meilisearch.DocumentOptions - }{ - DocumentsPtr: documentsPtr, - BatchSize: batchSize, - Opts: opts, - } - mock.lockAddDocumentsInBatches.Lock() - mock.calls.AddDocumentsInBatches = append(mock.calls.AddDocumentsInBatches, callInfo) - mock.lockAddDocumentsInBatches.Unlock() - if mock.AddDocumentsInBatchesFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.AddDocumentsInBatchesFunc(documentsPtr, batchSize, opts) -} - -// AddDocumentsInBatchesCalls gets all the calls that were made to AddDocumentsInBatches. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsInBatchesCalls()) -func (mock *MeiliIndexManager) AddDocumentsInBatchesCalls() []struct { - DocumentsPtr interface{} - BatchSize int - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - DocumentsPtr interface{} - BatchSize int - Opts *meilisearch.DocumentOptions - } - mock.lockAddDocumentsInBatches.RLock() - calls = mock.calls.AddDocumentsInBatches - mock.lockAddDocumentsInBatches.RUnlock() - return calls -} - -// AddDocumentsInBatchesWithContext calls AddDocumentsInBatchesWithContextFunc. -func (mock *MeiliIndexManager) AddDocumentsInBatchesWithContext(ctx context.Context, documentsPtr interface{}, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - DocumentsPtr interface{} - BatchSize int - Opts *meilisearch.DocumentOptions - }{ - Ctx: ctx, - DocumentsPtr: documentsPtr, - BatchSize: batchSize, - Opts: opts, - } - mock.lockAddDocumentsInBatchesWithContext.Lock() - mock.calls.AddDocumentsInBatchesWithContext = append(mock.calls.AddDocumentsInBatchesWithContext, callInfo) - mock.lockAddDocumentsInBatchesWithContext.Unlock() - if mock.AddDocumentsInBatchesWithContextFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.AddDocumentsInBatchesWithContextFunc(ctx, documentsPtr, batchSize, opts) -} - -// AddDocumentsInBatchesWithContextCalls gets all the calls that were made to AddDocumentsInBatchesWithContext. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsInBatchesWithContextCalls()) -func (mock *MeiliIndexManager) AddDocumentsInBatchesWithContextCalls() []struct { - Ctx context.Context - DocumentsPtr interface{} - BatchSize int - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Ctx context.Context - DocumentsPtr interface{} - BatchSize int - Opts *meilisearch.DocumentOptions - } - mock.lockAddDocumentsInBatchesWithContext.RLock() - calls = mock.calls.AddDocumentsInBatchesWithContext - mock.lockAddDocumentsInBatchesWithContext.RUnlock() - return calls -} - -// AddDocumentsNdjson calls AddDocumentsNdjsonFunc. -func (mock *MeiliIndexManager) AddDocumentsNdjson(documents []byte, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Documents []byte - Opts *meilisearch.DocumentOptions - }{ - Documents: documents, - Opts: opts, - } - mock.lockAddDocumentsNdjson.Lock() - mock.calls.AddDocumentsNdjson = append(mock.calls.AddDocumentsNdjson, callInfo) - mock.lockAddDocumentsNdjson.Unlock() - if mock.AddDocumentsNdjsonFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.AddDocumentsNdjsonFunc(documents, opts) -} - -// AddDocumentsNdjsonCalls gets all the calls that were made to AddDocumentsNdjson. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsNdjsonCalls()) -func (mock *MeiliIndexManager) AddDocumentsNdjsonCalls() []struct { - Documents []byte - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Documents []byte - Opts *meilisearch.DocumentOptions - } - mock.lockAddDocumentsNdjson.RLock() - calls = mock.calls.AddDocumentsNdjson - mock.lockAddDocumentsNdjson.RUnlock() - return calls -} - -// AddDocumentsNdjsonFromReader calls AddDocumentsNdjsonFromReaderFunc. -func (mock *MeiliIndexManager) AddDocumentsNdjsonFromReader(documents io.Reader, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Documents io.Reader - Opts *meilisearch.DocumentOptions - }{ - Documents: documents, - Opts: opts, - } - mock.lockAddDocumentsNdjsonFromReader.Lock() - mock.calls.AddDocumentsNdjsonFromReader = append(mock.calls.AddDocumentsNdjsonFromReader, callInfo) - mock.lockAddDocumentsNdjsonFromReader.Unlock() - if mock.AddDocumentsNdjsonFromReaderFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.AddDocumentsNdjsonFromReaderFunc(documents, opts) -} - -// AddDocumentsNdjsonFromReaderCalls gets all the calls that were made to AddDocumentsNdjsonFromReader. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsNdjsonFromReaderCalls()) -func (mock *MeiliIndexManager) AddDocumentsNdjsonFromReaderCalls() []struct { - Documents io.Reader - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Documents io.Reader - Opts *meilisearch.DocumentOptions - } - mock.lockAddDocumentsNdjsonFromReader.RLock() - calls = mock.calls.AddDocumentsNdjsonFromReader - mock.lockAddDocumentsNdjsonFromReader.RUnlock() - return calls -} - -// AddDocumentsNdjsonFromReaderInBatches calls AddDocumentsNdjsonFromReaderInBatchesFunc. -func (mock *MeiliIndexManager) AddDocumentsNdjsonFromReaderInBatches(documents io.Reader, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - Documents io.Reader - BatchSize int - Opts *meilisearch.DocumentOptions - }{ - Documents: documents, - BatchSize: batchSize, - Opts: opts, - } - mock.lockAddDocumentsNdjsonFromReaderInBatches.Lock() - mock.calls.AddDocumentsNdjsonFromReaderInBatches = append(mock.calls.AddDocumentsNdjsonFromReaderInBatches, callInfo) - mock.lockAddDocumentsNdjsonFromReaderInBatches.Unlock() - if mock.AddDocumentsNdjsonFromReaderInBatchesFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.AddDocumentsNdjsonFromReaderInBatchesFunc(documents, batchSize, opts) -} - -// AddDocumentsNdjsonFromReaderInBatchesCalls gets all the calls that were made to AddDocumentsNdjsonFromReaderInBatches. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsNdjsonFromReaderInBatchesCalls()) -func (mock *MeiliIndexManager) AddDocumentsNdjsonFromReaderInBatchesCalls() []struct { - Documents io.Reader - BatchSize int - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Documents io.Reader - BatchSize int - Opts *meilisearch.DocumentOptions - } - mock.lockAddDocumentsNdjsonFromReaderInBatches.RLock() - calls = mock.calls.AddDocumentsNdjsonFromReaderInBatches - mock.lockAddDocumentsNdjsonFromReaderInBatches.RUnlock() - return calls -} - -// AddDocumentsNdjsonFromReaderInBatchesWithContext calls AddDocumentsNdjsonFromReaderInBatchesWithContextFunc. -func (mock *MeiliIndexManager) AddDocumentsNdjsonFromReaderInBatchesWithContext(ctx context.Context, documents io.Reader, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Documents io.Reader - BatchSize int - Opts *meilisearch.DocumentOptions - }{ - Ctx: ctx, - Documents: documents, - BatchSize: batchSize, - Opts: opts, - } - mock.lockAddDocumentsNdjsonFromReaderInBatchesWithContext.Lock() - mock.calls.AddDocumentsNdjsonFromReaderInBatchesWithContext = append(mock.calls.AddDocumentsNdjsonFromReaderInBatchesWithContext, callInfo) - mock.lockAddDocumentsNdjsonFromReaderInBatchesWithContext.Unlock() - if mock.AddDocumentsNdjsonFromReaderInBatchesWithContextFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.AddDocumentsNdjsonFromReaderInBatchesWithContextFunc(ctx, documents, batchSize, opts) -} - -// AddDocumentsNdjsonFromReaderInBatchesWithContextCalls gets all the calls that were made to AddDocumentsNdjsonFromReaderInBatchesWithContext. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsNdjsonFromReaderInBatchesWithContextCalls()) -func (mock *MeiliIndexManager) AddDocumentsNdjsonFromReaderInBatchesWithContextCalls() []struct { - Ctx context.Context - Documents io.Reader - BatchSize int - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Ctx context.Context - Documents io.Reader - BatchSize int - Opts *meilisearch.DocumentOptions - } - mock.lockAddDocumentsNdjsonFromReaderInBatchesWithContext.RLock() - calls = mock.calls.AddDocumentsNdjsonFromReaderInBatchesWithContext - mock.lockAddDocumentsNdjsonFromReaderInBatchesWithContext.RUnlock() - return calls -} - -// AddDocumentsNdjsonFromReaderWithContext calls AddDocumentsNdjsonFromReaderWithContextFunc. -func (mock *MeiliIndexManager) AddDocumentsNdjsonFromReaderWithContext(ctx context.Context, documents io.Reader, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Documents io.Reader - Opts *meilisearch.DocumentOptions - }{ - Ctx: ctx, - Documents: documents, - Opts: opts, - } - mock.lockAddDocumentsNdjsonFromReaderWithContext.Lock() - mock.calls.AddDocumentsNdjsonFromReaderWithContext = append(mock.calls.AddDocumentsNdjsonFromReaderWithContext, callInfo) - mock.lockAddDocumentsNdjsonFromReaderWithContext.Unlock() - if mock.AddDocumentsNdjsonFromReaderWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.AddDocumentsNdjsonFromReaderWithContextFunc(ctx, documents, opts) -} - -// AddDocumentsNdjsonFromReaderWithContextCalls gets all the calls that were made to AddDocumentsNdjsonFromReaderWithContext. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsNdjsonFromReaderWithContextCalls()) -func (mock *MeiliIndexManager) AddDocumentsNdjsonFromReaderWithContextCalls() []struct { - Ctx context.Context - Documents io.Reader - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Ctx context.Context - Documents io.Reader - Opts *meilisearch.DocumentOptions - } - mock.lockAddDocumentsNdjsonFromReaderWithContext.RLock() - calls = mock.calls.AddDocumentsNdjsonFromReaderWithContext - mock.lockAddDocumentsNdjsonFromReaderWithContext.RUnlock() - return calls -} - -// AddDocumentsNdjsonInBatches calls AddDocumentsNdjsonInBatchesFunc. -func (mock *MeiliIndexManager) AddDocumentsNdjsonInBatches(documents []byte, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - Documents []byte - BatchSize int - Opts *meilisearch.DocumentOptions - }{ - Documents: documents, - BatchSize: batchSize, - Opts: opts, - } - mock.lockAddDocumentsNdjsonInBatches.Lock() - mock.calls.AddDocumentsNdjsonInBatches = append(mock.calls.AddDocumentsNdjsonInBatches, callInfo) - mock.lockAddDocumentsNdjsonInBatches.Unlock() - if mock.AddDocumentsNdjsonInBatchesFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.AddDocumentsNdjsonInBatchesFunc(documents, batchSize, opts) -} - -// AddDocumentsNdjsonInBatchesCalls gets all the calls that were made to AddDocumentsNdjsonInBatches. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsNdjsonInBatchesCalls()) -func (mock *MeiliIndexManager) AddDocumentsNdjsonInBatchesCalls() []struct { - Documents []byte - BatchSize int - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Documents []byte - BatchSize int - Opts *meilisearch.DocumentOptions - } - mock.lockAddDocumentsNdjsonInBatches.RLock() - calls = mock.calls.AddDocumentsNdjsonInBatches - mock.lockAddDocumentsNdjsonInBatches.RUnlock() - return calls -} - -// AddDocumentsNdjsonInBatchesWithContext calls AddDocumentsNdjsonInBatchesWithContextFunc. -func (mock *MeiliIndexManager) AddDocumentsNdjsonInBatchesWithContext(ctx context.Context, documents []byte, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Documents []byte - BatchSize int - Opts *meilisearch.DocumentOptions - }{ - Ctx: ctx, - Documents: documents, - BatchSize: batchSize, - Opts: opts, - } - mock.lockAddDocumentsNdjsonInBatchesWithContext.Lock() - mock.calls.AddDocumentsNdjsonInBatchesWithContext = append(mock.calls.AddDocumentsNdjsonInBatchesWithContext, callInfo) - mock.lockAddDocumentsNdjsonInBatchesWithContext.Unlock() - if mock.AddDocumentsNdjsonInBatchesWithContextFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.AddDocumentsNdjsonInBatchesWithContextFunc(ctx, documents, batchSize, opts) -} - -// AddDocumentsNdjsonInBatchesWithContextCalls gets all the calls that were made to AddDocumentsNdjsonInBatchesWithContext. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsNdjsonInBatchesWithContextCalls()) -func (mock *MeiliIndexManager) AddDocumentsNdjsonInBatchesWithContextCalls() []struct { - Ctx context.Context - Documents []byte - BatchSize int - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Ctx context.Context - Documents []byte - BatchSize int - Opts *meilisearch.DocumentOptions - } - mock.lockAddDocumentsNdjsonInBatchesWithContext.RLock() - calls = mock.calls.AddDocumentsNdjsonInBatchesWithContext - mock.lockAddDocumentsNdjsonInBatchesWithContext.RUnlock() - return calls -} - -// AddDocumentsNdjsonWithContext calls AddDocumentsNdjsonWithContextFunc. -func (mock *MeiliIndexManager) AddDocumentsNdjsonWithContext(ctx context.Context, documents []byte, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Documents []byte - Opts *meilisearch.DocumentOptions - }{ - Ctx: ctx, - Documents: documents, - Opts: opts, - } - mock.lockAddDocumentsNdjsonWithContext.Lock() - mock.calls.AddDocumentsNdjsonWithContext = append(mock.calls.AddDocumentsNdjsonWithContext, callInfo) - mock.lockAddDocumentsNdjsonWithContext.Unlock() - if mock.AddDocumentsNdjsonWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.AddDocumentsNdjsonWithContextFunc(ctx, documents, opts) -} - -// AddDocumentsNdjsonWithContextCalls gets all the calls that were made to AddDocumentsNdjsonWithContext. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsNdjsonWithContextCalls()) -func (mock *MeiliIndexManager) AddDocumentsNdjsonWithContextCalls() []struct { - Ctx context.Context - Documents []byte - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Ctx context.Context - Documents []byte - Opts *meilisearch.DocumentOptions - } - mock.lockAddDocumentsNdjsonWithContext.RLock() - calls = mock.calls.AddDocumentsNdjsonWithContext - mock.lockAddDocumentsNdjsonWithContext.RUnlock() - return calls -} - -// AddDocumentsWithContext calls AddDocumentsWithContextFunc. -func (mock *MeiliIndexManager) AddDocumentsWithContext(ctx context.Context, documentsPtr interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - DocumentsPtr interface{} - Opts *meilisearch.DocumentOptions - }{ - Ctx: ctx, - DocumentsPtr: documentsPtr, - Opts: opts, - } - mock.lockAddDocumentsWithContext.Lock() - mock.calls.AddDocumentsWithContext = append(mock.calls.AddDocumentsWithContext, callInfo) - mock.lockAddDocumentsWithContext.Unlock() - if mock.AddDocumentsWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.AddDocumentsWithContextFunc(ctx, documentsPtr, opts) -} - -// AddDocumentsWithContextCalls gets all the calls that were made to AddDocumentsWithContext. -// Check the length with: -// -// len(mockedIndexManager.AddDocumentsWithContextCalls()) -func (mock *MeiliIndexManager) AddDocumentsWithContextCalls() []struct { - Ctx context.Context - DocumentsPtr interface{} - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Ctx context.Context - DocumentsPtr interface{} - Opts *meilisearch.DocumentOptions - } - mock.lockAddDocumentsWithContext.RLock() - calls = mock.calls.AddDocumentsWithContext - mock.lockAddDocumentsWithContext.RUnlock() - return calls -} - -// Compact calls CompactFunc. -func (mock *MeiliIndexManager) Compact() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockCompact.Lock() - mock.calls.Compact = append(mock.calls.Compact, callInfo) - mock.lockCompact.Unlock() - if mock.CompactFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.CompactFunc() -} - -// CompactCalls gets all the calls that were made to Compact. -// Check the length with: -// -// len(mockedIndexManager.CompactCalls()) -func (mock *MeiliIndexManager) CompactCalls() []struct { -} { - var calls []struct { - } - mock.lockCompact.RLock() - calls = mock.calls.Compact - mock.lockCompact.RUnlock() - return calls -} - -// CompactWithContext calls CompactWithContextFunc. -func (mock *MeiliIndexManager) CompactWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockCompactWithContext.Lock() - mock.calls.CompactWithContext = append(mock.calls.CompactWithContext, callInfo) - mock.lockCompactWithContext.Unlock() - if mock.CompactWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.CompactWithContextFunc(ctx) -} - -// CompactWithContextCalls gets all the calls that were made to CompactWithContext. -// Check the length with: -// -// len(mockedIndexManager.CompactWithContextCalls()) -func (mock *MeiliIndexManager) CompactWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockCompactWithContext.RLock() - calls = mock.calls.CompactWithContext - mock.lockCompactWithContext.RUnlock() - return calls -} - -// Delete calls DeleteFunc. -func (mock *MeiliIndexManager) Delete(uid string) (bool, error) { - callInfo := struct { - UID string - }{ - UID: uid, - } - mock.lockDelete.Lock() - mock.calls.Delete = append(mock.calls.Delete, callInfo) - mock.lockDelete.Unlock() - if mock.DeleteFunc == nil { - var ( - bOut bool - errOut error - ) - return bOut, errOut - } - return mock.DeleteFunc(uid) -} - -// DeleteCalls gets all the calls that were made to Delete. -// Check the length with: -// -// len(mockedIndexManager.DeleteCalls()) -func (mock *MeiliIndexManager) DeleteCalls() []struct { - UID string -} { - var calls []struct { - UID string - } - mock.lockDelete.RLock() - calls = mock.calls.Delete - mock.lockDelete.RUnlock() - return calls -} - -// DeleteAllDocuments calls DeleteAllDocumentsFunc. -func (mock *MeiliIndexManager) DeleteAllDocuments(opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Opts *meilisearch.DocumentOptions - }{ - Opts: opts, - } - mock.lockDeleteAllDocuments.Lock() - mock.calls.DeleteAllDocuments = append(mock.calls.DeleteAllDocuments, callInfo) - mock.lockDeleteAllDocuments.Unlock() - if mock.DeleteAllDocumentsFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.DeleteAllDocumentsFunc(opts) -} - -// DeleteAllDocumentsCalls gets all the calls that were made to DeleteAllDocuments. -// Check the length with: -// -// len(mockedIndexManager.DeleteAllDocumentsCalls()) -func (mock *MeiliIndexManager) DeleteAllDocumentsCalls() []struct { - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Opts *meilisearch.DocumentOptions - } - mock.lockDeleteAllDocuments.RLock() - calls = mock.calls.DeleteAllDocuments - mock.lockDeleteAllDocuments.RUnlock() - return calls -} - -// DeleteAllDocumentsWithContext calls DeleteAllDocumentsWithContextFunc. -func (mock *MeiliIndexManager) DeleteAllDocumentsWithContext(ctx context.Context, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Opts *meilisearch.DocumentOptions - }{ - Ctx: ctx, - Opts: opts, - } - mock.lockDeleteAllDocumentsWithContext.Lock() - mock.calls.DeleteAllDocumentsWithContext = append(mock.calls.DeleteAllDocumentsWithContext, callInfo) - mock.lockDeleteAllDocumentsWithContext.Unlock() - if mock.DeleteAllDocumentsWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.DeleteAllDocumentsWithContextFunc(ctx, opts) -} - -// DeleteAllDocumentsWithContextCalls gets all the calls that were made to DeleteAllDocumentsWithContext. -// Check the length with: -// -// len(mockedIndexManager.DeleteAllDocumentsWithContextCalls()) -func (mock *MeiliIndexManager) DeleteAllDocumentsWithContextCalls() []struct { - Ctx context.Context - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Ctx context.Context - Opts *meilisearch.DocumentOptions - } - mock.lockDeleteAllDocumentsWithContext.RLock() - calls = mock.calls.DeleteAllDocumentsWithContext - mock.lockDeleteAllDocumentsWithContext.RUnlock() - return calls -} - -// DeleteDocument calls DeleteDocumentFunc. -func (mock *MeiliIndexManager) DeleteDocument(identifier string, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Identifier string - Opts *meilisearch.DocumentOptions - }{ - Identifier: identifier, - Opts: opts, - } - mock.lockDeleteDocument.Lock() - mock.calls.DeleteDocument = append(mock.calls.DeleteDocument, callInfo) - mock.lockDeleteDocument.Unlock() - if mock.DeleteDocumentFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.DeleteDocumentFunc(identifier, opts) -} - -// DeleteDocumentCalls gets all the calls that were made to DeleteDocument. -// Check the length with: -// -// len(mockedIndexManager.DeleteDocumentCalls()) -func (mock *MeiliIndexManager) DeleteDocumentCalls() []struct { - Identifier string - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Identifier string - Opts *meilisearch.DocumentOptions - } - mock.lockDeleteDocument.RLock() - calls = mock.calls.DeleteDocument - mock.lockDeleteDocument.RUnlock() - return calls -} - -// DeleteDocumentWithContext calls DeleteDocumentWithContextFunc. -func (mock *MeiliIndexManager) DeleteDocumentWithContext(ctx context.Context, identifier string, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Identifier string - Opts *meilisearch.DocumentOptions - }{ - Ctx: ctx, - Identifier: identifier, - Opts: opts, - } - mock.lockDeleteDocumentWithContext.Lock() - mock.calls.DeleteDocumentWithContext = append(mock.calls.DeleteDocumentWithContext, callInfo) - mock.lockDeleteDocumentWithContext.Unlock() - if mock.DeleteDocumentWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.DeleteDocumentWithContextFunc(ctx, identifier, opts) -} - -// DeleteDocumentWithContextCalls gets all the calls that were made to DeleteDocumentWithContext. -// Check the length with: -// -// len(mockedIndexManager.DeleteDocumentWithContextCalls()) -func (mock *MeiliIndexManager) DeleteDocumentWithContextCalls() []struct { - Ctx context.Context - Identifier string - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Ctx context.Context - Identifier string - Opts *meilisearch.DocumentOptions - } - mock.lockDeleteDocumentWithContext.RLock() - calls = mock.calls.DeleteDocumentWithContext - mock.lockDeleteDocumentWithContext.RUnlock() - return calls -} - -// DeleteDocuments calls DeleteDocumentsFunc. -func (mock *MeiliIndexManager) DeleteDocuments(identifiers []string, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Identifiers []string - Opts *meilisearch.DocumentOptions - }{ - Identifiers: identifiers, - Opts: opts, - } - mock.lockDeleteDocuments.Lock() - mock.calls.DeleteDocuments = append(mock.calls.DeleteDocuments, callInfo) - mock.lockDeleteDocuments.Unlock() - if mock.DeleteDocumentsFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.DeleteDocumentsFunc(identifiers, opts) -} - -// DeleteDocumentsCalls gets all the calls that were made to DeleteDocuments. -// Check the length with: -// -// len(mockedIndexManager.DeleteDocumentsCalls()) -func (mock *MeiliIndexManager) DeleteDocumentsCalls() []struct { - Identifiers []string - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Identifiers []string - Opts *meilisearch.DocumentOptions - } - mock.lockDeleteDocuments.RLock() - calls = mock.calls.DeleteDocuments - mock.lockDeleteDocuments.RUnlock() - return calls -} - -// DeleteDocumentsByFilter calls DeleteDocumentsByFilterFunc. -func (mock *MeiliIndexManager) DeleteDocumentsByFilter(filter interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Filter interface{} - Opts *meilisearch.DocumentOptions - }{ - Filter: filter, - Opts: opts, - } - mock.lockDeleteDocumentsByFilter.Lock() - mock.calls.DeleteDocumentsByFilter = append(mock.calls.DeleteDocumentsByFilter, callInfo) - mock.lockDeleteDocumentsByFilter.Unlock() - if mock.DeleteDocumentsByFilterFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.DeleteDocumentsByFilterFunc(filter, opts) -} - -// DeleteDocumentsByFilterCalls gets all the calls that were made to DeleteDocumentsByFilter. -// Check the length with: -// -// len(mockedIndexManager.DeleteDocumentsByFilterCalls()) -func (mock *MeiliIndexManager) DeleteDocumentsByFilterCalls() []struct { - Filter interface{} - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Filter interface{} - Opts *meilisearch.DocumentOptions - } - mock.lockDeleteDocumentsByFilter.RLock() - calls = mock.calls.DeleteDocumentsByFilter - mock.lockDeleteDocumentsByFilter.RUnlock() - return calls -} - -// DeleteDocumentsByFilterWithContext calls DeleteDocumentsByFilterWithContextFunc. -func (mock *MeiliIndexManager) DeleteDocumentsByFilterWithContext(ctx context.Context, filter interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Filter interface{} - Opts *meilisearch.DocumentOptions - }{ - Ctx: ctx, - Filter: filter, - Opts: opts, - } - mock.lockDeleteDocumentsByFilterWithContext.Lock() - mock.calls.DeleteDocumentsByFilterWithContext = append(mock.calls.DeleteDocumentsByFilterWithContext, callInfo) - mock.lockDeleteDocumentsByFilterWithContext.Unlock() - if mock.DeleteDocumentsByFilterWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.DeleteDocumentsByFilterWithContextFunc(ctx, filter, opts) -} - -// DeleteDocumentsByFilterWithContextCalls gets all the calls that were made to DeleteDocumentsByFilterWithContext. -// Check the length with: -// -// len(mockedIndexManager.DeleteDocumentsByFilterWithContextCalls()) -func (mock *MeiliIndexManager) DeleteDocumentsByFilterWithContextCalls() []struct { - Ctx context.Context - Filter interface{} - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Ctx context.Context - Filter interface{} - Opts *meilisearch.DocumentOptions - } - mock.lockDeleteDocumentsByFilterWithContext.RLock() - calls = mock.calls.DeleteDocumentsByFilterWithContext - mock.lockDeleteDocumentsByFilterWithContext.RUnlock() - return calls -} - -// DeleteDocumentsWithContext calls DeleteDocumentsWithContextFunc. -func (mock *MeiliIndexManager) DeleteDocumentsWithContext(ctx context.Context, identifiers []string, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Identifiers []string - Opts *meilisearch.DocumentOptions - }{ - Ctx: ctx, - Identifiers: identifiers, - Opts: opts, - } - mock.lockDeleteDocumentsWithContext.Lock() - mock.calls.DeleteDocumentsWithContext = append(mock.calls.DeleteDocumentsWithContext, callInfo) - mock.lockDeleteDocumentsWithContext.Unlock() - if mock.DeleteDocumentsWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.DeleteDocumentsWithContextFunc(ctx, identifiers, opts) -} - -// DeleteDocumentsWithContextCalls gets all the calls that were made to DeleteDocumentsWithContext. -// Check the length with: -// -// len(mockedIndexManager.DeleteDocumentsWithContextCalls()) -func (mock *MeiliIndexManager) DeleteDocumentsWithContextCalls() []struct { - Ctx context.Context - Identifiers []string - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Ctx context.Context - Identifiers []string - Opts *meilisearch.DocumentOptions - } - mock.lockDeleteDocumentsWithContext.RLock() - calls = mock.calls.DeleteDocumentsWithContext - mock.lockDeleteDocumentsWithContext.RUnlock() - return calls -} - -// DeleteWithContext calls DeleteWithContextFunc. -func (mock *MeiliIndexManager) DeleteWithContext(ctx context.Context, uid string) (bool, error) { - callInfo := struct { - Ctx context.Context - UID string - }{ - Ctx: ctx, - UID: uid, - } - mock.lockDeleteWithContext.Lock() - mock.calls.DeleteWithContext = append(mock.calls.DeleteWithContext, callInfo) - mock.lockDeleteWithContext.Unlock() - if mock.DeleteWithContextFunc == nil { - var ( - bOut bool - errOut error - ) - return bOut, errOut - } - return mock.DeleteWithContextFunc(ctx, uid) -} - -// DeleteWithContextCalls gets all the calls that were made to DeleteWithContext. -// Check the length with: -// -// len(mockedIndexManager.DeleteWithContextCalls()) -func (mock *MeiliIndexManager) DeleteWithContextCalls() []struct { - Ctx context.Context - UID string -} { - var calls []struct { - Ctx context.Context - UID string - } - mock.lockDeleteWithContext.RLock() - calls = mock.calls.DeleteWithContext - mock.lockDeleteWithContext.RUnlock() - return calls -} - -// FacetSearch calls FacetSearchFunc. -func (mock *MeiliIndexManager) FacetSearch(request *meilisearch.FacetSearchRequest) (*json.RawMessage, error) { - callInfo := struct { - Request *meilisearch.FacetSearchRequest - }{ - Request: request, - } - mock.lockFacetSearch.Lock() - mock.calls.FacetSearch = append(mock.calls.FacetSearch, callInfo) - mock.lockFacetSearch.Unlock() - if mock.FacetSearchFunc == nil { - var ( - rawMessageOut *json.RawMessage - errOut error - ) - return rawMessageOut, errOut - } - return mock.FacetSearchFunc(request) -} - -// FacetSearchCalls gets all the calls that were made to FacetSearch. -// Check the length with: -// -// len(mockedIndexManager.FacetSearchCalls()) -func (mock *MeiliIndexManager) FacetSearchCalls() []struct { - Request *meilisearch.FacetSearchRequest -} { - var calls []struct { - Request *meilisearch.FacetSearchRequest - } - mock.lockFacetSearch.RLock() - calls = mock.calls.FacetSearch - mock.lockFacetSearch.RUnlock() - return calls -} - -// FacetSearchWithContext calls FacetSearchWithContextFunc. -func (mock *MeiliIndexManager) FacetSearchWithContext(ctx context.Context, request *meilisearch.FacetSearchRequest) (*json.RawMessage, error) { - callInfo := struct { - Ctx context.Context - Request *meilisearch.FacetSearchRequest - }{ - Ctx: ctx, - Request: request, - } - mock.lockFacetSearchWithContext.Lock() - mock.calls.FacetSearchWithContext = append(mock.calls.FacetSearchWithContext, callInfo) - mock.lockFacetSearchWithContext.Unlock() - if mock.FacetSearchWithContextFunc == nil { - var ( - rawMessageOut *json.RawMessage - errOut error - ) - return rawMessageOut, errOut - } - return mock.FacetSearchWithContextFunc(ctx, request) -} - -// FacetSearchWithContextCalls gets all the calls that were made to FacetSearchWithContext. -// Check the length with: -// -// len(mockedIndexManager.FacetSearchWithContextCalls()) -func (mock *MeiliIndexManager) FacetSearchWithContextCalls() []struct { - Ctx context.Context - Request *meilisearch.FacetSearchRequest -} { - var calls []struct { - Ctx context.Context - Request *meilisearch.FacetSearchRequest - } - mock.lockFacetSearchWithContext.RLock() - calls = mock.calls.FacetSearchWithContext - mock.lockFacetSearchWithContext.RUnlock() - return calls -} - -// FetchInfo calls FetchInfoFunc. -func (mock *MeiliIndexManager) FetchInfo() (*meilisearch.IndexResult, error) { - callInfo := struct { - }{} - mock.lockFetchInfo.Lock() - mock.calls.FetchInfo = append(mock.calls.FetchInfo, callInfo) - mock.lockFetchInfo.Unlock() - if mock.FetchInfoFunc == nil { - var ( - indexResultOut *meilisearch.IndexResult - errOut error - ) - return indexResultOut, errOut - } - return mock.FetchInfoFunc() -} - -// FetchInfoCalls gets all the calls that were made to FetchInfo. -// Check the length with: -// -// len(mockedIndexManager.FetchInfoCalls()) -func (mock *MeiliIndexManager) FetchInfoCalls() []struct { -} { - var calls []struct { - } - mock.lockFetchInfo.RLock() - calls = mock.calls.FetchInfo - mock.lockFetchInfo.RUnlock() - return calls -} - -// FetchInfoWithContext calls FetchInfoWithContextFunc. -func (mock *MeiliIndexManager) FetchInfoWithContext(ctx context.Context) (*meilisearch.IndexResult, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockFetchInfoWithContext.Lock() - mock.calls.FetchInfoWithContext = append(mock.calls.FetchInfoWithContext, callInfo) - mock.lockFetchInfoWithContext.Unlock() - if mock.FetchInfoWithContextFunc == nil { - var ( - indexResultOut *meilisearch.IndexResult - errOut error - ) - return indexResultOut, errOut - } - return mock.FetchInfoWithContextFunc(ctx) -} - -// FetchInfoWithContextCalls gets all the calls that were made to FetchInfoWithContext. -// Check the length with: -// -// len(mockedIndexManager.FetchInfoWithContextCalls()) -func (mock *MeiliIndexManager) FetchInfoWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockFetchInfoWithContext.RLock() - calls = mock.calls.FetchInfoWithContext - mock.lockFetchInfoWithContext.RUnlock() - return calls -} - -// FetchPrimaryKey calls FetchPrimaryKeyFunc. -func (mock *MeiliIndexManager) FetchPrimaryKey() (*string, error) { - callInfo := struct { - }{} - mock.lockFetchPrimaryKey.Lock() - mock.calls.FetchPrimaryKey = append(mock.calls.FetchPrimaryKey, callInfo) - mock.lockFetchPrimaryKey.Unlock() - if mock.FetchPrimaryKeyFunc == nil { - var ( - sOut *string - errOut error - ) - return sOut, errOut - } - return mock.FetchPrimaryKeyFunc() -} - -// FetchPrimaryKeyCalls gets all the calls that were made to FetchPrimaryKey. -// Check the length with: -// -// len(mockedIndexManager.FetchPrimaryKeyCalls()) -func (mock *MeiliIndexManager) FetchPrimaryKeyCalls() []struct { -} { - var calls []struct { - } - mock.lockFetchPrimaryKey.RLock() - calls = mock.calls.FetchPrimaryKey - mock.lockFetchPrimaryKey.RUnlock() - return calls -} - -// FetchPrimaryKeyWithContext calls FetchPrimaryKeyWithContextFunc. -func (mock *MeiliIndexManager) FetchPrimaryKeyWithContext(ctx context.Context) (*string, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockFetchPrimaryKeyWithContext.Lock() - mock.calls.FetchPrimaryKeyWithContext = append(mock.calls.FetchPrimaryKeyWithContext, callInfo) - mock.lockFetchPrimaryKeyWithContext.Unlock() - if mock.FetchPrimaryKeyWithContextFunc == nil { - var ( - sOut *string - errOut error - ) - return sOut, errOut - } - return mock.FetchPrimaryKeyWithContextFunc(ctx) -} - -// FetchPrimaryKeyWithContextCalls gets all the calls that were made to FetchPrimaryKeyWithContext. -// Check the length with: -// -// len(mockedIndexManager.FetchPrimaryKeyWithContextCalls()) -func (mock *MeiliIndexManager) FetchPrimaryKeyWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockFetchPrimaryKeyWithContext.RLock() - calls = mock.calls.FetchPrimaryKeyWithContext - mock.lockFetchPrimaryKeyWithContext.RUnlock() - return calls -} - -// GetDictionary calls GetDictionaryFunc. -func (mock *MeiliIndexManager) GetDictionary() ([]string, error) { - callInfo := struct { - }{} - mock.lockGetDictionary.Lock() - mock.calls.GetDictionary = append(mock.calls.GetDictionary, callInfo) - mock.lockGetDictionary.Unlock() - if mock.GetDictionaryFunc == nil { - var ( - stringsOut []string - errOut error - ) - return stringsOut, errOut - } - return mock.GetDictionaryFunc() -} - -// GetDictionaryCalls gets all the calls that were made to GetDictionary. -// Check the length with: -// -// len(mockedIndexManager.GetDictionaryCalls()) -func (mock *MeiliIndexManager) GetDictionaryCalls() []struct { -} { - var calls []struct { - } - mock.lockGetDictionary.RLock() - calls = mock.calls.GetDictionary - mock.lockGetDictionary.RUnlock() - return calls -} - -// GetDictionaryWithContext calls GetDictionaryWithContextFunc. -func (mock *MeiliIndexManager) GetDictionaryWithContext(ctx context.Context) ([]string, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetDictionaryWithContext.Lock() - mock.calls.GetDictionaryWithContext = append(mock.calls.GetDictionaryWithContext, callInfo) - mock.lockGetDictionaryWithContext.Unlock() - if mock.GetDictionaryWithContextFunc == nil { - var ( - stringsOut []string - errOut error - ) - return stringsOut, errOut - } - return mock.GetDictionaryWithContextFunc(ctx) -} - -// GetDictionaryWithContextCalls gets all the calls that were made to GetDictionaryWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetDictionaryWithContextCalls()) -func (mock *MeiliIndexManager) GetDictionaryWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetDictionaryWithContext.RLock() - calls = mock.calls.GetDictionaryWithContext - mock.lockGetDictionaryWithContext.RUnlock() - return calls -} - -// GetDisplayedAttributes calls GetDisplayedAttributesFunc. -func (mock *MeiliIndexManager) GetDisplayedAttributes() (*[]string, error) { - callInfo := struct { - }{} - mock.lockGetDisplayedAttributes.Lock() - mock.calls.GetDisplayedAttributes = append(mock.calls.GetDisplayedAttributes, callInfo) - mock.lockGetDisplayedAttributes.Unlock() - if mock.GetDisplayedAttributesFunc == nil { - var ( - stringsOut *[]string - errOut error - ) - return stringsOut, errOut - } - return mock.GetDisplayedAttributesFunc() -} - -// GetDisplayedAttributesCalls gets all the calls that were made to GetDisplayedAttributes. -// Check the length with: -// -// len(mockedIndexManager.GetDisplayedAttributesCalls()) -func (mock *MeiliIndexManager) GetDisplayedAttributesCalls() []struct { -} { - var calls []struct { - } - mock.lockGetDisplayedAttributes.RLock() - calls = mock.calls.GetDisplayedAttributes - mock.lockGetDisplayedAttributes.RUnlock() - return calls -} - -// GetDisplayedAttributesWithContext calls GetDisplayedAttributesWithContextFunc. -func (mock *MeiliIndexManager) GetDisplayedAttributesWithContext(ctx context.Context) (*[]string, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetDisplayedAttributesWithContext.Lock() - mock.calls.GetDisplayedAttributesWithContext = append(mock.calls.GetDisplayedAttributesWithContext, callInfo) - mock.lockGetDisplayedAttributesWithContext.Unlock() - if mock.GetDisplayedAttributesWithContextFunc == nil { - var ( - stringsOut *[]string - errOut error - ) - return stringsOut, errOut - } - return mock.GetDisplayedAttributesWithContextFunc(ctx) -} - -// GetDisplayedAttributesWithContextCalls gets all the calls that were made to GetDisplayedAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetDisplayedAttributesWithContextCalls()) -func (mock *MeiliIndexManager) GetDisplayedAttributesWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetDisplayedAttributesWithContext.RLock() - calls = mock.calls.GetDisplayedAttributesWithContext - mock.lockGetDisplayedAttributesWithContext.RUnlock() - return calls -} - -// GetDistinctAttribute calls GetDistinctAttributeFunc. -func (mock *MeiliIndexManager) GetDistinctAttribute() (*string, error) { - callInfo := struct { - }{} - mock.lockGetDistinctAttribute.Lock() - mock.calls.GetDistinctAttribute = append(mock.calls.GetDistinctAttribute, callInfo) - mock.lockGetDistinctAttribute.Unlock() - if mock.GetDistinctAttributeFunc == nil { - var ( - sOut *string - errOut error - ) - return sOut, errOut - } - return mock.GetDistinctAttributeFunc() -} - -// GetDistinctAttributeCalls gets all the calls that were made to GetDistinctAttribute. -// Check the length with: -// -// len(mockedIndexManager.GetDistinctAttributeCalls()) -func (mock *MeiliIndexManager) GetDistinctAttributeCalls() []struct { -} { - var calls []struct { - } - mock.lockGetDistinctAttribute.RLock() - calls = mock.calls.GetDistinctAttribute - mock.lockGetDistinctAttribute.RUnlock() - return calls -} - -// GetDistinctAttributeWithContext calls GetDistinctAttributeWithContextFunc. -func (mock *MeiliIndexManager) GetDistinctAttributeWithContext(ctx context.Context) (*string, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetDistinctAttributeWithContext.Lock() - mock.calls.GetDistinctAttributeWithContext = append(mock.calls.GetDistinctAttributeWithContext, callInfo) - mock.lockGetDistinctAttributeWithContext.Unlock() - if mock.GetDistinctAttributeWithContextFunc == nil { - var ( - sOut *string - errOut error - ) - return sOut, errOut - } - return mock.GetDistinctAttributeWithContextFunc(ctx) -} - -// GetDistinctAttributeWithContextCalls gets all the calls that were made to GetDistinctAttributeWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetDistinctAttributeWithContextCalls()) -func (mock *MeiliIndexManager) GetDistinctAttributeWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetDistinctAttributeWithContext.RLock() - calls = mock.calls.GetDistinctAttributeWithContext - mock.lockGetDistinctAttributeWithContext.RUnlock() - return calls -} - -// GetDocument calls GetDocumentFunc. -func (mock *MeiliIndexManager) GetDocument(identifier string, request *meilisearch.DocumentQuery, documentPtr interface{}) error { - callInfo := struct { - Identifier string - Request *meilisearch.DocumentQuery - DocumentPtr interface{} - }{ - Identifier: identifier, - Request: request, - DocumentPtr: documentPtr, - } - mock.lockGetDocument.Lock() - mock.calls.GetDocument = append(mock.calls.GetDocument, callInfo) - mock.lockGetDocument.Unlock() - if mock.GetDocumentFunc == nil { - var ( - errOut error - ) - return errOut - } - return mock.GetDocumentFunc(identifier, request, documentPtr) -} - -// GetDocumentCalls gets all the calls that were made to GetDocument. -// Check the length with: -// -// len(mockedIndexManager.GetDocumentCalls()) -func (mock *MeiliIndexManager) GetDocumentCalls() []struct { - Identifier string - Request *meilisearch.DocumentQuery - DocumentPtr interface{} -} { - var calls []struct { - Identifier string - Request *meilisearch.DocumentQuery - DocumentPtr interface{} - } - mock.lockGetDocument.RLock() - calls = mock.calls.GetDocument - mock.lockGetDocument.RUnlock() - return calls -} - -// GetDocumentManager calls GetDocumentManagerFunc. -func (mock *MeiliIndexManager) GetDocumentManager() meilisearch.DocumentManager { - callInfo := struct { - }{} - mock.lockGetDocumentManager.Lock() - mock.calls.GetDocumentManager = append(mock.calls.GetDocumentManager, callInfo) - mock.lockGetDocumentManager.Unlock() - if mock.GetDocumentManagerFunc == nil { - var ( - documentManagerOut meilisearch.DocumentManager - ) - return documentManagerOut - } - return mock.GetDocumentManagerFunc() -} - -// GetDocumentManagerCalls gets all the calls that were made to GetDocumentManager. -// Check the length with: -// -// len(mockedIndexManager.GetDocumentManagerCalls()) -func (mock *MeiliIndexManager) GetDocumentManagerCalls() []struct { -} { - var calls []struct { - } - mock.lockGetDocumentManager.RLock() - calls = mock.calls.GetDocumentManager - mock.lockGetDocumentManager.RUnlock() - return calls -} - -// GetDocumentReader calls GetDocumentReaderFunc. -func (mock *MeiliIndexManager) GetDocumentReader() meilisearch.DocumentReader { - callInfo := struct { - }{} - mock.lockGetDocumentReader.Lock() - mock.calls.GetDocumentReader = append(mock.calls.GetDocumentReader, callInfo) - mock.lockGetDocumentReader.Unlock() - if mock.GetDocumentReaderFunc == nil { - var ( - documentReaderOut meilisearch.DocumentReader - ) - return documentReaderOut - } - return mock.GetDocumentReaderFunc() -} - -// GetDocumentReaderCalls gets all the calls that were made to GetDocumentReader. -// Check the length with: -// -// len(mockedIndexManager.GetDocumentReaderCalls()) -func (mock *MeiliIndexManager) GetDocumentReaderCalls() []struct { -} { - var calls []struct { - } - mock.lockGetDocumentReader.RLock() - calls = mock.calls.GetDocumentReader - mock.lockGetDocumentReader.RUnlock() - return calls -} - -// GetDocumentWithContext calls GetDocumentWithContextFunc. -func (mock *MeiliIndexManager) GetDocumentWithContext(ctx context.Context, identifier string, request *meilisearch.DocumentQuery, documentPtr interface{}) error { - callInfo := struct { - Ctx context.Context - Identifier string - Request *meilisearch.DocumentQuery - DocumentPtr interface{} - }{ - Ctx: ctx, - Identifier: identifier, - Request: request, - DocumentPtr: documentPtr, - } - mock.lockGetDocumentWithContext.Lock() - mock.calls.GetDocumentWithContext = append(mock.calls.GetDocumentWithContext, callInfo) - mock.lockGetDocumentWithContext.Unlock() - if mock.GetDocumentWithContextFunc == nil { - var ( - errOut error - ) - return errOut - } - return mock.GetDocumentWithContextFunc(ctx, identifier, request, documentPtr) -} - -// GetDocumentWithContextCalls gets all the calls that were made to GetDocumentWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetDocumentWithContextCalls()) -func (mock *MeiliIndexManager) GetDocumentWithContextCalls() []struct { - Ctx context.Context - Identifier string - Request *meilisearch.DocumentQuery - DocumentPtr interface{} -} { - var calls []struct { - Ctx context.Context - Identifier string - Request *meilisearch.DocumentQuery - DocumentPtr interface{} - } - mock.lockGetDocumentWithContext.RLock() - calls = mock.calls.GetDocumentWithContext - mock.lockGetDocumentWithContext.RUnlock() - return calls -} - -// GetDocuments calls GetDocumentsFunc. -func (mock *MeiliIndexManager) GetDocuments(param *meilisearch.DocumentsQuery, resp *meilisearch.DocumentsResult) error { - callInfo := struct { - Param *meilisearch.DocumentsQuery - Resp *meilisearch.DocumentsResult - }{ - Param: param, - Resp: resp, - } - mock.lockGetDocuments.Lock() - mock.calls.GetDocuments = append(mock.calls.GetDocuments, callInfo) - mock.lockGetDocuments.Unlock() - if mock.GetDocumentsFunc == nil { - var ( - errOut error - ) - return errOut - } - return mock.GetDocumentsFunc(param, resp) -} - -// GetDocumentsCalls gets all the calls that were made to GetDocuments. -// Check the length with: -// -// len(mockedIndexManager.GetDocumentsCalls()) -func (mock *MeiliIndexManager) GetDocumentsCalls() []struct { - Param *meilisearch.DocumentsQuery - Resp *meilisearch.DocumentsResult -} { - var calls []struct { - Param *meilisearch.DocumentsQuery - Resp *meilisearch.DocumentsResult - } - mock.lockGetDocuments.RLock() - calls = mock.calls.GetDocuments - mock.lockGetDocuments.RUnlock() - return calls -} - -// GetDocumentsWithContext calls GetDocumentsWithContextFunc. -func (mock *MeiliIndexManager) GetDocumentsWithContext(ctx context.Context, param *meilisearch.DocumentsQuery, resp *meilisearch.DocumentsResult) error { - callInfo := struct { - Ctx context.Context - Param *meilisearch.DocumentsQuery - Resp *meilisearch.DocumentsResult - }{ - Ctx: ctx, - Param: param, - Resp: resp, - } - mock.lockGetDocumentsWithContext.Lock() - mock.calls.GetDocumentsWithContext = append(mock.calls.GetDocumentsWithContext, callInfo) - mock.lockGetDocumentsWithContext.Unlock() - if mock.GetDocumentsWithContextFunc == nil { - var ( - errOut error - ) - return errOut - } - return mock.GetDocumentsWithContextFunc(ctx, param, resp) -} - -// GetDocumentsWithContextCalls gets all the calls that were made to GetDocumentsWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetDocumentsWithContextCalls()) -func (mock *MeiliIndexManager) GetDocumentsWithContextCalls() []struct { - Ctx context.Context - Param *meilisearch.DocumentsQuery - Resp *meilisearch.DocumentsResult -} { - var calls []struct { - Ctx context.Context - Param *meilisearch.DocumentsQuery - Resp *meilisearch.DocumentsResult - } - mock.lockGetDocumentsWithContext.RLock() - calls = mock.calls.GetDocumentsWithContext - mock.lockGetDocumentsWithContext.RUnlock() - return calls -} - -// GetEmbedders calls GetEmbeddersFunc. -func (mock *MeiliIndexManager) GetEmbedders() (map[string]meilisearch.Embedder, error) { - callInfo := struct { - }{} - mock.lockGetEmbedders.Lock() - mock.calls.GetEmbedders = append(mock.calls.GetEmbedders, callInfo) - mock.lockGetEmbedders.Unlock() - if mock.GetEmbeddersFunc == nil { - var ( - stringToEmbedderOut map[string]meilisearch.Embedder - errOut error - ) - return stringToEmbedderOut, errOut - } - return mock.GetEmbeddersFunc() -} - -// GetEmbeddersCalls gets all the calls that were made to GetEmbedders. -// Check the length with: -// -// len(mockedIndexManager.GetEmbeddersCalls()) -func (mock *MeiliIndexManager) GetEmbeddersCalls() []struct { -} { - var calls []struct { - } - mock.lockGetEmbedders.RLock() - calls = mock.calls.GetEmbedders - mock.lockGetEmbedders.RUnlock() - return calls -} - -// GetEmbeddersWithContext calls GetEmbeddersWithContextFunc. -func (mock *MeiliIndexManager) GetEmbeddersWithContext(ctx context.Context) (map[string]meilisearch.Embedder, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetEmbeddersWithContext.Lock() - mock.calls.GetEmbeddersWithContext = append(mock.calls.GetEmbeddersWithContext, callInfo) - mock.lockGetEmbeddersWithContext.Unlock() - if mock.GetEmbeddersWithContextFunc == nil { - var ( - stringToEmbedderOut map[string]meilisearch.Embedder - errOut error - ) - return stringToEmbedderOut, errOut - } - return mock.GetEmbeddersWithContextFunc(ctx) -} - -// GetEmbeddersWithContextCalls gets all the calls that were made to GetEmbeddersWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetEmbeddersWithContextCalls()) -func (mock *MeiliIndexManager) GetEmbeddersWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetEmbeddersWithContext.RLock() - calls = mock.calls.GetEmbeddersWithContext - mock.lockGetEmbeddersWithContext.RUnlock() - return calls -} - -// GetFacetSearch calls GetFacetSearchFunc. -func (mock *MeiliIndexManager) GetFacetSearch() (bool, error) { - callInfo := struct { - }{} - mock.lockGetFacetSearch.Lock() - mock.calls.GetFacetSearch = append(mock.calls.GetFacetSearch, callInfo) - mock.lockGetFacetSearch.Unlock() - if mock.GetFacetSearchFunc == nil { - var ( - bOut bool - errOut error - ) - return bOut, errOut - } - return mock.GetFacetSearchFunc() -} - -// GetFacetSearchCalls gets all the calls that were made to GetFacetSearch. -// Check the length with: -// -// len(mockedIndexManager.GetFacetSearchCalls()) -func (mock *MeiliIndexManager) GetFacetSearchCalls() []struct { -} { - var calls []struct { - } - mock.lockGetFacetSearch.RLock() - calls = mock.calls.GetFacetSearch - mock.lockGetFacetSearch.RUnlock() - return calls -} - -// GetFacetSearchWithContext calls GetFacetSearchWithContextFunc. -func (mock *MeiliIndexManager) GetFacetSearchWithContext(ctx context.Context) (bool, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetFacetSearchWithContext.Lock() - mock.calls.GetFacetSearchWithContext = append(mock.calls.GetFacetSearchWithContext, callInfo) - mock.lockGetFacetSearchWithContext.Unlock() - if mock.GetFacetSearchWithContextFunc == nil { - var ( - bOut bool - errOut error - ) - return bOut, errOut - } - return mock.GetFacetSearchWithContextFunc(ctx) -} - -// GetFacetSearchWithContextCalls gets all the calls that were made to GetFacetSearchWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetFacetSearchWithContextCalls()) -func (mock *MeiliIndexManager) GetFacetSearchWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetFacetSearchWithContext.RLock() - calls = mock.calls.GetFacetSearchWithContext - mock.lockGetFacetSearchWithContext.RUnlock() - return calls -} - -// GetFaceting calls GetFacetingFunc. -func (mock *MeiliIndexManager) GetFaceting() (*meilisearch.Faceting, error) { - callInfo := struct { - }{} - mock.lockGetFaceting.Lock() - mock.calls.GetFaceting = append(mock.calls.GetFaceting, callInfo) - mock.lockGetFaceting.Unlock() - if mock.GetFacetingFunc == nil { - var ( - facetingOut *meilisearch.Faceting - errOut error - ) - return facetingOut, errOut - } - return mock.GetFacetingFunc() -} - -// GetFacetingCalls gets all the calls that were made to GetFaceting. -// Check the length with: -// -// len(mockedIndexManager.GetFacetingCalls()) -func (mock *MeiliIndexManager) GetFacetingCalls() []struct { -} { - var calls []struct { - } - mock.lockGetFaceting.RLock() - calls = mock.calls.GetFaceting - mock.lockGetFaceting.RUnlock() - return calls -} - -// GetFacetingWithContext calls GetFacetingWithContextFunc. -func (mock *MeiliIndexManager) GetFacetingWithContext(ctx context.Context) (*meilisearch.Faceting, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetFacetingWithContext.Lock() - mock.calls.GetFacetingWithContext = append(mock.calls.GetFacetingWithContext, callInfo) - mock.lockGetFacetingWithContext.Unlock() - if mock.GetFacetingWithContextFunc == nil { - var ( - facetingOut *meilisearch.Faceting - errOut error - ) - return facetingOut, errOut - } - return mock.GetFacetingWithContextFunc(ctx) -} - -// GetFacetingWithContextCalls gets all the calls that were made to GetFacetingWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetFacetingWithContextCalls()) -func (mock *MeiliIndexManager) GetFacetingWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetFacetingWithContext.RLock() - calls = mock.calls.GetFacetingWithContext - mock.lockGetFacetingWithContext.RUnlock() - return calls -} - -// GetFilterableAttributes calls GetFilterableAttributesFunc. -func (mock *MeiliIndexManager) GetFilterableAttributes() (*[]interface{}, error) { - callInfo := struct { - }{} - mock.lockGetFilterableAttributes.Lock() - mock.calls.GetFilterableAttributes = append(mock.calls.GetFilterableAttributes, callInfo) - mock.lockGetFilterableAttributes.Unlock() - if mock.GetFilterableAttributesFunc == nil { - var ( - ifaceValsOut *[]interface{} - errOut error - ) - return ifaceValsOut, errOut - } - return mock.GetFilterableAttributesFunc() -} - -// GetFilterableAttributesCalls gets all the calls that were made to GetFilterableAttributes. -// Check the length with: -// -// len(mockedIndexManager.GetFilterableAttributesCalls()) -func (mock *MeiliIndexManager) GetFilterableAttributesCalls() []struct { -} { - var calls []struct { - } - mock.lockGetFilterableAttributes.RLock() - calls = mock.calls.GetFilterableAttributes - mock.lockGetFilterableAttributes.RUnlock() - return calls -} - -// GetFilterableAttributesWithContext calls GetFilterableAttributesWithContextFunc. -func (mock *MeiliIndexManager) GetFilterableAttributesWithContext(ctx context.Context) (*[]interface{}, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetFilterableAttributesWithContext.Lock() - mock.calls.GetFilterableAttributesWithContext = append(mock.calls.GetFilterableAttributesWithContext, callInfo) - mock.lockGetFilterableAttributesWithContext.Unlock() - if mock.GetFilterableAttributesWithContextFunc == nil { - var ( - ifaceValsOut *[]interface{} - errOut error - ) - return ifaceValsOut, errOut - } - return mock.GetFilterableAttributesWithContextFunc(ctx) -} - -// GetFilterableAttributesWithContextCalls gets all the calls that were made to GetFilterableAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetFilterableAttributesWithContextCalls()) -func (mock *MeiliIndexManager) GetFilterableAttributesWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetFilterableAttributesWithContext.RLock() - calls = mock.calls.GetFilterableAttributesWithContext - mock.lockGetFilterableAttributesWithContext.RUnlock() - return calls -} - -// GetIndexReader calls GetIndexReaderFunc. -func (mock *MeiliIndexManager) GetIndexReader() meilisearch.IndexReader { - callInfo := struct { - }{} - mock.lockGetIndexReader.Lock() - mock.calls.GetIndexReader = append(mock.calls.GetIndexReader, callInfo) - mock.lockGetIndexReader.Unlock() - if mock.GetIndexReaderFunc == nil { - var ( - indexReaderOut meilisearch.IndexReader - ) - return indexReaderOut - } - return mock.GetIndexReaderFunc() -} - -// GetIndexReaderCalls gets all the calls that were made to GetIndexReader. -// Check the length with: -// -// len(mockedIndexManager.GetIndexReaderCalls()) -func (mock *MeiliIndexManager) GetIndexReaderCalls() []struct { -} { - var calls []struct { - } - mock.lockGetIndexReader.RLock() - calls = mock.calls.GetIndexReader - mock.lockGetIndexReader.RUnlock() - return calls -} - -// GetLocalizedAttributes calls GetLocalizedAttributesFunc. -func (mock *MeiliIndexManager) GetLocalizedAttributes() ([]*meilisearch.LocalizedAttributes, error) { - callInfo := struct { - }{} - mock.lockGetLocalizedAttributes.Lock() - mock.calls.GetLocalizedAttributes = append(mock.calls.GetLocalizedAttributes, callInfo) - mock.lockGetLocalizedAttributes.Unlock() - if mock.GetLocalizedAttributesFunc == nil { - var ( - localizedAttributessOut []*meilisearch.LocalizedAttributes - errOut error - ) - return localizedAttributessOut, errOut - } - return mock.GetLocalizedAttributesFunc() -} - -// GetLocalizedAttributesCalls gets all the calls that were made to GetLocalizedAttributes. -// Check the length with: -// -// len(mockedIndexManager.GetLocalizedAttributesCalls()) -func (mock *MeiliIndexManager) GetLocalizedAttributesCalls() []struct { -} { - var calls []struct { - } - mock.lockGetLocalizedAttributes.RLock() - calls = mock.calls.GetLocalizedAttributes - mock.lockGetLocalizedAttributes.RUnlock() - return calls -} - -// GetLocalizedAttributesWithContext calls GetLocalizedAttributesWithContextFunc. -func (mock *MeiliIndexManager) GetLocalizedAttributesWithContext(ctx context.Context) ([]*meilisearch.LocalizedAttributes, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetLocalizedAttributesWithContext.Lock() - mock.calls.GetLocalizedAttributesWithContext = append(mock.calls.GetLocalizedAttributesWithContext, callInfo) - mock.lockGetLocalizedAttributesWithContext.Unlock() - if mock.GetLocalizedAttributesWithContextFunc == nil { - var ( - localizedAttributessOut []*meilisearch.LocalizedAttributes - errOut error - ) - return localizedAttributessOut, errOut - } - return mock.GetLocalizedAttributesWithContextFunc(ctx) -} - -// GetLocalizedAttributesWithContextCalls gets all the calls that were made to GetLocalizedAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetLocalizedAttributesWithContextCalls()) -func (mock *MeiliIndexManager) GetLocalizedAttributesWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetLocalizedAttributesWithContext.RLock() - calls = mock.calls.GetLocalizedAttributesWithContext - mock.lockGetLocalizedAttributesWithContext.RUnlock() - return calls -} - -// GetNonSeparatorTokens calls GetNonSeparatorTokensFunc. -func (mock *MeiliIndexManager) GetNonSeparatorTokens() ([]string, error) { - callInfo := struct { - }{} - mock.lockGetNonSeparatorTokens.Lock() - mock.calls.GetNonSeparatorTokens = append(mock.calls.GetNonSeparatorTokens, callInfo) - mock.lockGetNonSeparatorTokens.Unlock() - if mock.GetNonSeparatorTokensFunc == nil { - var ( - stringsOut []string - errOut error - ) - return stringsOut, errOut - } - return mock.GetNonSeparatorTokensFunc() -} - -// GetNonSeparatorTokensCalls gets all the calls that were made to GetNonSeparatorTokens. -// Check the length with: -// -// len(mockedIndexManager.GetNonSeparatorTokensCalls()) -func (mock *MeiliIndexManager) GetNonSeparatorTokensCalls() []struct { -} { - var calls []struct { - } - mock.lockGetNonSeparatorTokens.RLock() - calls = mock.calls.GetNonSeparatorTokens - mock.lockGetNonSeparatorTokens.RUnlock() - return calls -} - -// GetNonSeparatorTokensWithContext calls GetNonSeparatorTokensWithContextFunc. -func (mock *MeiliIndexManager) GetNonSeparatorTokensWithContext(ctx context.Context) ([]string, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetNonSeparatorTokensWithContext.Lock() - mock.calls.GetNonSeparatorTokensWithContext = append(mock.calls.GetNonSeparatorTokensWithContext, callInfo) - mock.lockGetNonSeparatorTokensWithContext.Unlock() - if mock.GetNonSeparatorTokensWithContextFunc == nil { - var ( - stringsOut []string - errOut error - ) - return stringsOut, errOut - } - return mock.GetNonSeparatorTokensWithContextFunc(ctx) -} - -// GetNonSeparatorTokensWithContextCalls gets all the calls that were made to GetNonSeparatorTokensWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetNonSeparatorTokensWithContextCalls()) -func (mock *MeiliIndexManager) GetNonSeparatorTokensWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetNonSeparatorTokensWithContext.RLock() - calls = mock.calls.GetNonSeparatorTokensWithContext - mock.lockGetNonSeparatorTokensWithContext.RUnlock() - return calls -} - -// GetPagination calls GetPaginationFunc. -func (mock *MeiliIndexManager) GetPagination() (*meilisearch.Pagination, error) { - callInfo := struct { - }{} - mock.lockGetPagination.Lock() - mock.calls.GetPagination = append(mock.calls.GetPagination, callInfo) - mock.lockGetPagination.Unlock() - if mock.GetPaginationFunc == nil { - var ( - paginationOut *meilisearch.Pagination - errOut error - ) - return paginationOut, errOut - } - return mock.GetPaginationFunc() -} - -// GetPaginationCalls gets all the calls that were made to GetPagination. -// Check the length with: -// -// len(mockedIndexManager.GetPaginationCalls()) -func (mock *MeiliIndexManager) GetPaginationCalls() []struct { -} { - var calls []struct { - } - mock.lockGetPagination.RLock() - calls = mock.calls.GetPagination - mock.lockGetPagination.RUnlock() - return calls -} - -// GetPaginationWithContext calls GetPaginationWithContextFunc. -func (mock *MeiliIndexManager) GetPaginationWithContext(ctx context.Context) (*meilisearch.Pagination, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetPaginationWithContext.Lock() - mock.calls.GetPaginationWithContext = append(mock.calls.GetPaginationWithContext, callInfo) - mock.lockGetPaginationWithContext.Unlock() - if mock.GetPaginationWithContextFunc == nil { - var ( - paginationOut *meilisearch.Pagination - errOut error - ) - return paginationOut, errOut - } - return mock.GetPaginationWithContextFunc(ctx) -} - -// GetPaginationWithContextCalls gets all the calls that were made to GetPaginationWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetPaginationWithContextCalls()) -func (mock *MeiliIndexManager) GetPaginationWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetPaginationWithContext.RLock() - calls = mock.calls.GetPaginationWithContext - mock.lockGetPaginationWithContext.RUnlock() - return calls -} - -// GetPrefixSearch calls GetPrefixSearchFunc. -func (mock *MeiliIndexManager) GetPrefixSearch() (*string, error) { - callInfo := struct { - }{} - mock.lockGetPrefixSearch.Lock() - mock.calls.GetPrefixSearch = append(mock.calls.GetPrefixSearch, callInfo) - mock.lockGetPrefixSearch.Unlock() - if mock.GetPrefixSearchFunc == nil { - var ( - sOut *string - errOut error - ) - return sOut, errOut - } - return mock.GetPrefixSearchFunc() -} - -// GetPrefixSearchCalls gets all the calls that were made to GetPrefixSearch. -// Check the length with: -// -// len(mockedIndexManager.GetPrefixSearchCalls()) -func (mock *MeiliIndexManager) GetPrefixSearchCalls() []struct { -} { - var calls []struct { - } - mock.lockGetPrefixSearch.RLock() - calls = mock.calls.GetPrefixSearch - mock.lockGetPrefixSearch.RUnlock() - return calls -} - -// GetPrefixSearchWithContext calls GetPrefixSearchWithContextFunc. -func (mock *MeiliIndexManager) GetPrefixSearchWithContext(ctx context.Context) (*string, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetPrefixSearchWithContext.Lock() - mock.calls.GetPrefixSearchWithContext = append(mock.calls.GetPrefixSearchWithContext, callInfo) - mock.lockGetPrefixSearchWithContext.Unlock() - if mock.GetPrefixSearchWithContextFunc == nil { - var ( - sOut *string - errOut error - ) - return sOut, errOut - } - return mock.GetPrefixSearchWithContextFunc(ctx) -} - -// GetPrefixSearchWithContextCalls gets all the calls that were made to GetPrefixSearchWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetPrefixSearchWithContextCalls()) -func (mock *MeiliIndexManager) GetPrefixSearchWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetPrefixSearchWithContext.RLock() - calls = mock.calls.GetPrefixSearchWithContext - mock.lockGetPrefixSearchWithContext.RUnlock() - return calls -} - -// GetProximityPrecision calls GetProximityPrecisionFunc. -func (mock *MeiliIndexManager) GetProximityPrecision() (meilisearch.ProximityPrecisionType, error) { - callInfo := struct { - }{} - mock.lockGetProximityPrecision.Lock() - mock.calls.GetProximityPrecision = append(mock.calls.GetProximityPrecision, callInfo) - mock.lockGetProximityPrecision.Unlock() - if mock.GetProximityPrecisionFunc == nil { - var ( - proximityPrecisionTypeOut meilisearch.ProximityPrecisionType - errOut error - ) - return proximityPrecisionTypeOut, errOut - } - return mock.GetProximityPrecisionFunc() -} - -// GetProximityPrecisionCalls gets all the calls that were made to GetProximityPrecision. -// Check the length with: -// -// len(mockedIndexManager.GetProximityPrecisionCalls()) -func (mock *MeiliIndexManager) GetProximityPrecisionCalls() []struct { -} { - var calls []struct { - } - mock.lockGetProximityPrecision.RLock() - calls = mock.calls.GetProximityPrecision - mock.lockGetProximityPrecision.RUnlock() - return calls -} - -// GetProximityPrecisionWithContext calls GetProximityPrecisionWithContextFunc. -func (mock *MeiliIndexManager) GetProximityPrecisionWithContext(ctx context.Context) (meilisearch.ProximityPrecisionType, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetProximityPrecisionWithContext.Lock() - mock.calls.GetProximityPrecisionWithContext = append(mock.calls.GetProximityPrecisionWithContext, callInfo) - mock.lockGetProximityPrecisionWithContext.Unlock() - if mock.GetProximityPrecisionWithContextFunc == nil { - var ( - proximityPrecisionTypeOut meilisearch.ProximityPrecisionType - errOut error - ) - return proximityPrecisionTypeOut, errOut - } - return mock.GetProximityPrecisionWithContextFunc(ctx) -} - -// GetProximityPrecisionWithContextCalls gets all the calls that were made to GetProximityPrecisionWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetProximityPrecisionWithContextCalls()) -func (mock *MeiliIndexManager) GetProximityPrecisionWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetProximityPrecisionWithContext.RLock() - calls = mock.calls.GetProximityPrecisionWithContext - mock.lockGetProximityPrecisionWithContext.RUnlock() - return calls -} - -// GetRankingRules calls GetRankingRulesFunc. -func (mock *MeiliIndexManager) GetRankingRules() (*[]string, error) { - callInfo := struct { - }{} - mock.lockGetRankingRules.Lock() - mock.calls.GetRankingRules = append(mock.calls.GetRankingRules, callInfo) - mock.lockGetRankingRules.Unlock() - if mock.GetRankingRulesFunc == nil { - var ( - stringsOut *[]string - errOut error - ) - return stringsOut, errOut - } - return mock.GetRankingRulesFunc() -} - -// GetRankingRulesCalls gets all the calls that were made to GetRankingRules. -// Check the length with: -// -// len(mockedIndexManager.GetRankingRulesCalls()) -func (mock *MeiliIndexManager) GetRankingRulesCalls() []struct { -} { - var calls []struct { - } - mock.lockGetRankingRules.RLock() - calls = mock.calls.GetRankingRules - mock.lockGetRankingRules.RUnlock() - return calls -} - -// GetRankingRulesWithContext calls GetRankingRulesWithContextFunc. -func (mock *MeiliIndexManager) GetRankingRulesWithContext(ctx context.Context) (*[]string, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetRankingRulesWithContext.Lock() - mock.calls.GetRankingRulesWithContext = append(mock.calls.GetRankingRulesWithContext, callInfo) - mock.lockGetRankingRulesWithContext.Unlock() - if mock.GetRankingRulesWithContextFunc == nil { - var ( - stringsOut *[]string - errOut error - ) - return stringsOut, errOut - } - return mock.GetRankingRulesWithContextFunc(ctx) -} - -// GetRankingRulesWithContextCalls gets all the calls that were made to GetRankingRulesWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetRankingRulesWithContextCalls()) -func (mock *MeiliIndexManager) GetRankingRulesWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetRankingRulesWithContext.RLock() - calls = mock.calls.GetRankingRulesWithContext - mock.lockGetRankingRulesWithContext.RUnlock() - return calls -} - -// GetSearch calls GetSearchFunc. -func (mock *MeiliIndexManager) GetSearch() meilisearch.SearchReader { - callInfo := struct { - }{} - mock.lockGetSearch.Lock() - mock.calls.GetSearch = append(mock.calls.GetSearch, callInfo) - mock.lockGetSearch.Unlock() - if mock.GetSearchFunc == nil { - var ( - searchReaderOut meilisearch.SearchReader - ) - return searchReaderOut - } - return mock.GetSearchFunc() -} - -// GetSearchCalls gets all the calls that were made to GetSearch. -// Check the length with: -// -// len(mockedIndexManager.GetSearchCalls()) -func (mock *MeiliIndexManager) GetSearchCalls() []struct { -} { - var calls []struct { - } - mock.lockGetSearch.RLock() - calls = mock.calls.GetSearch - mock.lockGetSearch.RUnlock() - return calls -} - -// GetSearchCutoffMs calls GetSearchCutoffMsFunc. -func (mock *MeiliIndexManager) GetSearchCutoffMs() (int64, error) { - callInfo := struct { - }{} - mock.lockGetSearchCutoffMs.Lock() - mock.calls.GetSearchCutoffMs = append(mock.calls.GetSearchCutoffMs, callInfo) - mock.lockGetSearchCutoffMs.Unlock() - if mock.GetSearchCutoffMsFunc == nil { - var ( - nOut int64 - errOut error - ) - return nOut, errOut - } - return mock.GetSearchCutoffMsFunc() -} - -// GetSearchCutoffMsCalls gets all the calls that were made to GetSearchCutoffMs. -// Check the length with: -// -// len(mockedIndexManager.GetSearchCutoffMsCalls()) -func (mock *MeiliIndexManager) GetSearchCutoffMsCalls() []struct { -} { - var calls []struct { - } - mock.lockGetSearchCutoffMs.RLock() - calls = mock.calls.GetSearchCutoffMs - mock.lockGetSearchCutoffMs.RUnlock() - return calls -} - -// GetSearchCutoffMsWithContext calls GetSearchCutoffMsWithContextFunc. -func (mock *MeiliIndexManager) GetSearchCutoffMsWithContext(ctx context.Context) (int64, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetSearchCutoffMsWithContext.Lock() - mock.calls.GetSearchCutoffMsWithContext = append(mock.calls.GetSearchCutoffMsWithContext, callInfo) - mock.lockGetSearchCutoffMsWithContext.Unlock() - if mock.GetSearchCutoffMsWithContextFunc == nil { - var ( - nOut int64 - errOut error - ) - return nOut, errOut - } - return mock.GetSearchCutoffMsWithContextFunc(ctx) -} - -// GetSearchCutoffMsWithContextCalls gets all the calls that were made to GetSearchCutoffMsWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetSearchCutoffMsWithContextCalls()) -func (mock *MeiliIndexManager) GetSearchCutoffMsWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetSearchCutoffMsWithContext.RLock() - calls = mock.calls.GetSearchCutoffMsWithContext - mock.lockGetSearchCutoffMsWithContext.RUnlock() - return calls -} - -// GetSearchableAttributes calls GetSearchableAttributesFunc. -func (mock *MeiliIndexManager) GetSearchableAttributes() (*[]string, error) { - callInfo := struct { - }{} - mock.lockGetSearchableAttributes.Lock() - mock.calls.GetSearchableAttributes = append(mock.calls.GetSearchableAttributes, callInfo) - mock.lockGetSearchableAttributes.Unlock() - if mock.GetSearchableAttributesFunc == nil { - var ( - stringsOut *[]string - errOut error - ) - return stringsOut, errOut - } - return mock.GetSearchableAttributesFunc() -} - -// GetSearchableAttributesCalls gets all the calls that were made to GetSearchableAttributes. -// Check the length with: -// -// len(mockedIndexManager.GetSearchableAttributesCalls()) -func (mock *MeiliIndexManager) GetSearchableAttributesCalls() []struct { -} { - var calls []struct { - } - mock.lockGetSearchableAttributes.RLock() - calls = mock.calls.GetSearchableAttributes - mock.lockGetSearchableAttributes.RUnlock() - return calls -} - -// GetSearchableAttributesWithContext calls GetSearchableAttributesWithContextFunc. -func (mock *MeiliIndexManager) GetSearchableAttributesWithContext(ctx context.Context) (*[]string, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetSearchableAttributesWithContext.Lock() - mock.calls.GetSearchableAttributesWithContext = append(mock.calls.GetSearchableAttributesWithContext, callInfo) - mock.lockGetSearchableAttributesWithContext.Unlock() - if mock.GetSearchableAttributesWithContextFunc == nil { - var ( - stringsOut *[]string - errOut error - ) - return stringsOut, errOut - } - return mock.GetSearchableAttributesWithContextFunc(ctx) -} - -// GetSearchableAttributesWithContextCalls gets all the calls that were made to GetSearchableAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetSearchableAttributesWithContextCalls()) -func (mock *MeiliIndexManager) GetSearchableAttributesWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetSearchableAttributesWithContext.RLock() - calls = mock.calls.GetSearchableAttributesWithContext - mock.lockGetSearchableAttributesWithContext.RUnlock() - return calls -} - -// GetSeparatorTokens calls GetSeparatorTokensFunc. -func (mock *MeiliIndexManager) GetSeparatorTokens() ([]string, error) { - callInfo := struct { - }{} - mock.lockGetSeparatorTokens.Lock() - mock.calls.GetSeparatorTokens = append(mock.calls.GetSeparatorTokens, callInfo) - mock.lockGetSeparatorTokens.Unlock() - if mock.GetSeparatorTokensFunc == nil { - var ( - stringsOut []string - errOut error - ) - return stringsOut, errOut - } - return mock.GetSeparatorTokensFunc() -} - -// GetSeparatorTokensCalls gets all the calls that were made to GetSeparatorTokens. -// Check the length with: -// -// len(mockedIndexManager.GetSeparatorTokensCalls()) -func (mock *MeiliIndexManager) GetSeparatorTokensCalls() []struct { -} { - var calls []struct { - } - mock.lockGetSeparatorTokens.RLock() - calls = mock.calls.GetSeparatorTokens - mock.lockGetSeparatorTokens.RUnlock() - return calls -} - -// GetSeparatorTokensWithContext calls GetSeparatorTokensWithContextFunc. -func (mock *MeiliIndexManager) GetSeparatorTokensWithContext(ctx context.Context) ([]string, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetSeparatorTokensWithContext.Lock() - mock.calls.GetSeparatorTokensWithContext = append(mock.calls.GetSeparatorTokensWithContext, callInfo) - mock.lockGetSeparatorTokensWithContext.Unlock() - if mock.GetSeparatorTokensWithContextFunc == nil { - var ( - stringsOut []string - errOut error - ) - return stringsOut, errOut - } - return mock.GetSeparatorTokensWithContextFunc(ctx) -} - -// GetSeparatorTokensWithContextCalls gets all the calls that were made to GetSeparatorTokensWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetSeparatorTokensWithContextCalls()) -func (mock *MeiliIndexManager) GetSeparatorTokensWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetSeparatorTokensWithContext.RLock() - calls = mock.calls.GetSeparatorTokensWithContext - mock.lockGetSeparatorTokensWithContext.RUnlock() - return calls -} - -// GetSettings calls GetSettingsFunc. -func (mock *MeiliIndexManager) GetSettings() (*meilisearch.Settings, error) { - callInfo := struct { - }{} - mock.lockGetSettings.Lock() - mock.calls.GetSettings = append(mock.calls.GetSettings, callInfo) - mock.lockGetSettings.Unlock() - if mock.GetSettingsFunc == nil { - var ( - settingsOut *meilisearch.Settings - errOut error - ) - return settingsOut, errOut - } - return mock.GetSettingsFunc() -} - -// GetSettingsCalls gets all the calls that were made to GetSettings. -// Check the length with: -// -// len(mockedIndexManager.GetSettingsCalls()) -func (mock *MeiliIndexManager) GetSettingsCalls() []struct { -} { - var calls []struct { - } - mock.lockGetSettings.RLock() - calls = mock.calls.GetSettings - mock.lockGetSettings.RUnlock() - return calls -} - -// GetSettingsManager calls GetSettingsManagerFunc. -func (mock *MeiliIndexManager) GetSettingsManager() meilisearch.SettingsManager { - callInfo := struct { - }{} - mock.lockGetSettingsManager.Lock() - mock.calls.GetSettingsManager = append(mock.calls.GetSettingsManager, callInfo) - mock.lockGetSettingsManager.Unlock() - if mock.GetSettingsManagerFunc == nil { - var ( - settingsManagerOut meilisearch.SettingsManager - ) - return settingsManagerOut - } - return mock.GetSettingsManagerFunc() -} - -// GetSettingsManagerCalls gets all the calls that were made to GetSettingsManager. -// Check the length with: -// -// len(mockedIndexManager.GetSettingsManagerCalls()) -func (mock *MeiliIndexManager) GetSettingsManagerCalls() []struct { -} { - var calls []struct { - } - mock.lockGetSettingsManager.RLock() - calls = mock.calls.GetSettingsManager - mock.lockGetSettingsManager.RUnlock() - return calls -} - -// GetSettingsReader calls GetSettingsReaderFunc. -func (mock *MeiliIndexManager) GetSettingsReader() meilisearch.SettingsReader { - callInfo := struct { - }{} - mock.lockGetSettingsReader.Lock() - mock.calls.GetSettingsReader = append(mock.calls.GetSettingsReader, callInfo) - mock.lockGetSettingsReader.Unlock() - if mock.GetSettingsReaderFunc == nil { - var ( - settingsReaderOut meilisearch.SettingsReader - ) - return settingsReaderOut - } - return mock.GetSettingsReaderFunc() -} - -// GetSettingsReaderCalls gets all the calls that were made to GetSettingsReader. -// Check the length with: -// -// len(mockedIndexManager.GetSettingsReaderCalls()) -func (mock *MeiliIndexManager) GetSettingsReaderCalls() []struct { -} { - var calls []struct { - } - mock.lockGetSettingsReader.RLock() - calls = mock.calls.GetSettingsReader - mock.lockGetSettingsReader.RUnlock() - return calls -} - -// GetSettingsWithContext calls GetSettingsWithContextFunc. -func (mock *MeiliIndexManager) GetSettingsWithContext(ctx context.Context) (*meilisearch.Settings, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetSettingsWithContext.Lock() - mock.calls.GetSettingsWithContext = append(mock.calls.GetSettingsWithContext, callInfo) - mock.lockGetSettingsWithContext.Unlock() - if mock.GetSettingsWithContextFunc == nil { - var ( - settingsOut *meilisearch.Settings - errOut error - ) - return settingsOut, errOut - } - return mock.GetSettingsWithContextFunc(ctx) -} - -// GetSettingsWithContextCalls gets all the calls that were made to GetSettingsWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetSettingsWithContextCalls()) -func (mock *MeiliIndexManager) GetSettingsWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetSettingsWithContext.RLock() - calls = mock.calls.GetSettingsWithContext - mock.lockGetSettingsWithContext.RUnlock() - return calls -} - -// GetSortableAttributes calls GetSortableAttributesFunc. -func (mock *MeiliIndexManager) GetSortableAttributes() (*[]string, error) { - callInfo := struct { - }{} - mock.lockGetSortableAttributes.Lock() - mock.calls.GetSortableAttributes = append(mock.calls.GetSortableAttributes, callInfo) - mock.lockGetSortableAttributes.Unlock() - if mock.GetSortableAttributesFunc == nil { - var ( - stringsOut *[]string - errOut error - ) - return stringsOut, errOut - } - return mock.GetSortableAttributesFunc() -} - -// GetSortableAttributesCalls gets all the calls that were made to GetSortableAttributes. -// Check the length with: -// -// len(mockedIndexManager.GetSortableAttributesCalls()) -func (mock *MeiliIndexManager) GetSortableAttributesCalls() []struct { -} { - var calls []struct { - } - mock.lockGetSortableAttributes.RLock() - calls = mock.calls.GetSortableAttributes - mock.lockGetSortableAttributes.RUnlock() - return calls -} - -// GetSortableAttributesWithContext calls GetSortableAttributesWithContextFunc. -func (mock *MeiliIndexManager) GetSortableAttributesWithContext(ctx context.Context) (*[]string, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetSortableAttributesWithContext.Lock() - mock.calls.GetSortableAttributesWithContext = append(mock.calls.GetSortableAttributesWithContext, callInfo) - mock.lockGetSortableAttributesWithContext.Unlock() - if mock.GetSortableAttributesWithContextFunc == nil { - var ( - stringsOut *[]string - errOut error - ) - return stringsOut, errOut - } - return mock.GetSortableAttributesWithContextFunc(ctx) -} - -// GetSortableAttributesWithContextCalls gets all the calls that were made to GetSortableAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetSortableAttributesWithContextCalls()) -func (mock *MeiliIndexManager) GetSortableAttributesWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetSortableAttributesWithContext.RLock() - calls = mock.calls.GetSortableAttributesWithContext - mock.lockGetSortableAttributesWithContext.RUnlock() - return calls -} - -// GetStats calls GetStatsFunc. -func (mock *MeiliIndexManager) GetStats(param *meilisearch.StatsParams) (*meilisearch.StatsIndex, error) { - callInfo := struct { - Param *meilisearch.StatsParams - }{ - Param: param, - } - mock.lockGetStats.Lock() - mock.calls.GetStats = append(mock.calls.GetStats, callInfo) - mock.lockGetStats.Unlock() - if mock.GetStatsFunc == nil { - var ( - statsIndexOut *meilisearch.StatsIndex - errOut error - ) - return statsIndexOut, errOut - } - return mock.GetStatsFunc(param) -} - -// GetStatsCalls gets all the calls that were made to GetStats. -// Check the length with: -// -// len(mockedIndexManager.GetStatsCalls()) -func (mock *MeiliIndexManager) GetStatsCalls() []struct { - Param *meilisearch.StatsParams -} { - var calls []struct { - Param *meilisearch.StatsParams - } - mock.lockGetStats.RLock() - calls = mock.calls.GetStats - mock.lockGetStats.RUnlock() - return calls -} - -// GetStatsWithContext calls GetStatsWithContextFunc. -func (mock *MeiliIndexManager) GetStatsWithContext(ctx context.Context, param *meilisearch.StatsParams) (*meilisearch.StatsIndex, error) { - callInfo := struct { - Ctx context.Context - Param *meilisearch.StatsParams - }{ - Ctx: ctx, - Param: param, - } - mock.lockGetStatsWithContext.Lock() - mock.calls.GetStatsWithContext = append(mock.calls.GetStatsWithContext, callInfo) - mock.lockGetStatsWithContext.Unlock() - if mock.GetStatsWithContextFunc == nil { - var ( - statsIndexOut *meilisearch.StatsIndex - errOut error - ) - return statsIndexOut, errOut - } - return mock.GetStatsWithContextFunc(ctx, param) -} - -// GetStatsWithContextCalls gets all the calls that were made to GetStatsWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetStatsWithContextCalls()) -func (mock *MeiliIndexManager) GetStatsWithContextCalls() []struct { - Ctx context.Context - Param *meilisearch.StatsParams -} { - var calls []struct { - Ctx context.Context - Param *meilisearch.StatsParams - } - mock.lockGetStatsWithContext.RLock() - calls = mock.calls.GetStatsWithContext - mock.lockGetStatsWithContext.RUnlock() - return calls -} - -// GetStopWords calls GetStopWordsFunc. -func (mock *MeiliIndexManager) GetStopWords() (*[]string, error) { - callInfo := struct { - }{} - mock.lockGetStopWords.Lock() - mock.calls.GetStopWords = append(mock.calls.GetStopWords, callInfo) - mock.lockGetStopWords.Unlock() - if mock.GetStopWordsFunc == nil { - var ( - stringsOut *[]string - errOut error - ) - return stringsOut, errOut - } - return mock.GetStopWordsFunc() -} - -// GetStopWordsCalls gets all the calls that were made to GetStopWords. -// Check the length with: -// -// len(mockedIndexManager.GetStopWordsCalls()) -func (mock *MeiliIndexManager) GetStopWordsCalls() []struct { -} { - var calls []struct { - } - mock.lockGetStopWords.RLock() - calls = mock.calls.GetStopWords - mock.lockGetStopWords.RUnlock() - return calls -} - -// GetStopWordsWithContext calls GetStopWordsWithContextFunc. -func (mock *MeiliIndexManager) GetStopWordsWithContext(ctx context.Context) (*[]string, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetStopWordsWithContext.Lock() - mock.calls.GetStopWordsWithContext = append(mock.calls.GetStopWordsWithContext, callInfo) - mock.lockGetStopWordsWithContext.Unlock() - if mock.GetStopWordsWithContextFunc == nil { - var ( - stringsOut *[]string - errOut error - ) - return stringsOut, errOut - } - return mock.GetStopWordsWithContextFunc(ctx) -} - -// GetStopWordsWithContextCalls gets all the calls that were made to GetStopWordsWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetStopWordsWithContextCalls()) -func (mock *MeiliIndexManager) GetStopWordsWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetStopWordsWithContext.RLock() - calls = mock.calls.GetStopWordsWithContext - mock.lockGetStopWordsWithContext.RUnlock() - return calls -} - -// GetSynonyms calls GetSynonymsFunc. -func (mock *MeiliIndexManager) GetSynonyms() (*map[string][]string, error) { - callInfo := struct { - }{} - mock.lockGetSynonyms.Lock() - mock.calls.GetSynonyms = append(mock.calls.GetSynonyms, callInfo) - mock.lockGetSynonyms.Unlock() - if mock.GetSynonymsFunc == nil { - var ( - stringToStringsOut *map[string][]string - errOut error - ) - return stringToStringsOut, errOut - } - return mock.GetSynonymsFunc() -} - -// GetSynonymsCalls gets all the calls that were made to GetSynonyms. -// Check the length with: -// -// len(mockedIndexManager.GetSynonymsCalls()) -func (mock *MeiliIndexManager) GetSynonymsCalls() []struct { -} { - var calls []struct { - } - mock.lockGetSynonyms.RLock() - calls = mock.calls.GetSynonyms - mock.lockGetSynonyms.RUnlock() - return calls -} - -// GetSynonymsWithContext calls GetSynonymsWithContextFunc. -func (mock *MeiliIndexManager) GetSynonymsWithContext(ctx context.Context) (*map[string][]string, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetSynonymsWithContext.Lock() - mock.calls.GetSynonymsWithContext = append(mock.calls.GetSynonymsWithContext, callInfo) - mock.lockGetSynonymsWithContext.Unlock() - if mock.GetSynonymsWithContextFunc == nil { - var ( - stringToStringsOut *map[string][]string - errOut error - ) - return stringToStringsOut, errOut - } - return mock.GetSynonymsWithContextFunc(ctx) -} - -// GetSynonymsWithContextCalls gets all the calls that were made to GetSynonymsWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetSynonymsWithContextCalls()) -func (mock *MeiliIndexManager) GetSynonymsWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetSynonymsWithContext.RLock() - calls = mock.calls.GetSynonymsWithContext - mock.lockGetSynonymsWithContext.RUnlock() - return calls -} - -// GetTask calls GetTaskFunc. -func (mock *MeiliIndexManager) GetTask(taskUID int64) (*meilisearch.Task, error) { - callInfo := struct { - TaskUID int64 - }{ - TaskUID: taskUID, - } - mock.lockGetTask.Lock() - mock.calls.GetTask = append(mock.calls.GetTask, callInfo) - mock.lockGetTask.Unlock() - if mock.GetTaskFunc == nil { - var ( - taskOut *meilisearch.Task - errOut error - ) - return taskOut, errOut - } - return mock.GetTaskFunc(taskUID) -} - -// GetTaskCalls gets all the calls that were made to GetTask. -// Check the length with: -// -// len(mockedIndexManager.GetTaskCalls()) -func (mock *MeiliIndexManager) GetTaskCalls() []struct { - TaskUID int64 -} { - var calls []struct { - TaskUID int64 - } - mock.lockGetTask.RLock() - calls = mock.calls.GetTask - mock.lockGetTask.RUnlock() - return calls -} - -// GetTaskReader calls GetTaskReaderFunc. -func (mock *MeiliIndexManager) GetTaskReader() meilisearch.TaskReader { - callInfo := struct { - }{} - mock.lockGetTaskReader.Lock() - mock.calls.GetTaskReader = append(mock.calls.GetTaskReader, callInfo) - mock.lockGetTaskReader.Unlock() - if mock.GetTaskReaderFunc == nil { - var ( - taskReaderOut meilisearch.TaskReader - ) - return taskReaderOut - } - return mock.GetTaskReaderFunc() -} - -// GetTaskReaderCalls gets all the calls that were made to GetTaskReader. -// Check the length with: -// -// len(mockedIndexManager.GetTaskReaderCalls()) -func (mock *MeiliIndexManager) GetTaskReaderCalls() []struct { -} { - var calls []struct { - } - mock.lockGetTaskReader.RLock() - calls = mock.calls.GetTaskReader - mock.lockGetTaskReader.RUnlock() - return calls -} - -// GetTaskWithContext calls GetTaskWithContextFunc. -func (mock *MeiliIndexManager) GetTaskWithContext(ctx context.Context, taskUID int64) (*meilisearch.Task, error) { - callInfo := struct { - Ctx context.Context - TaskUID int64 - }{ - Ctx: ctx, - TaskUID: taskUID, - } - mock.lockGetTaskWithContext.Lock() - mock.calls.GetTaskWithContext = append(mock.calls.GetTaskWithContext, callInfo) - mock.lockGetTaskWithContext.Unlock() - if mock.GetTaskWithContextFunc == nil { - var ( - taskOut *meilisearch.Task - errOut error - ) - return taskOut, errOut - } - return mock.GetTaskWithContextFunc(ctx, taskUID) -} - -// GetTaskWithContextCalls gets all the calls that were made to GetTaskWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetTaskWithContextCalls()) -func (mock *MeiliIndexManager) GetTaskWithContextCalls() []struct { - Ctx context.Context - TaskUID int64 -} { - var calls []struct { - Ctx context.Context - TaskUID int64 - } - mock.lockGetTaskWithContext.RLock() - calls = mock.calls.GetTaskWithContext - mock.lockGetTaskWithContext.RUnlock() - return calls -} - -// GetTasks calls GetTasksFunc. -func (mock *MeiliIndexManager) GetTasks(param *meilisearch.TasksQuery) (*meilisearch.TaskResult, error) { - callInfo := struct { - Param *meilisearch.TasksQuery - }{ - Param: param, - } - mock.lockGetTasks.Lock() - mock.calls.GetTasks = append(mock.calls.GetTasks, callInfo) - mock.lockGetTasks.Unlock() - if mock.GetTasksFunc == nil { - var ( - taskResultOut *meilisearch.TaskResult - errOut error - ) - return taskResultOut, errOut - } - return mock.GetTasksFunc(param) -} - -// GetTasksCalls gets all the calls that were made to GetTasks. -// Check the length with: -// -// len(mockedIndexManager.GetTasksCalls()) -func (mock *MeiliIndexManager) GetTasksCalls() []struct { - Param *meilisearch.TasksQuery -} { - var calls []struct { - Param *meilisearch.TasksQuery - } - mock.lockGetTasks.RLock() - calls = mock.calls.GetTasks - mock.lockGetTasks.RUnlock() - return calls -} - -// GetTasksWithContext calls GetTasksWithContextFunc. -func (mock *MeiliIndexManager) GetTasksWithContext(ctx context.Context, param *meilisearch.TasksQuery) (*meilisearch.TaskResult, error) { - callInfo := struct { - Ctx context.Context - Param *meilisearch.TasksQuery - }{ - Ctx: ctx, - Param: param, - } - mock.lockGetTasksWithContext.Lock() - mock.calls.GetTasksWithContext = append(mock.calls.GetTasksWithContext, callInfo) - mock.lockGetTasksWithContext.Unlock() - if mock.GetTasksWithContextFunc == nil { - var ( - taskResultOut *meilisearch.TaskResult - errOut error - ) - return taskResultOut, errOut - } - return mock.GetTasksWithContextFunc(ctx, param) -} - -// GetTasksWithContextCalls gets all the calls that were made to GetTasksWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetTasksWithContextCalls()) -func (mock *MeiliIndexManager) GetTasksWithContextCalls() []struct { - Ctx context.Context - Param *meilisearch.TasksQuery -} { - var calls []struct { - Ctx context.Context - Param *meilisearch.TasksQuery - } - mock.lockGetTasksWithContext.RLock() - calls = mock.calls.GetTasksWithContext - mock.lockGetTasksWithContext.RUnlock() - return calls -} - -// GetTypoTolerance calls GetTypoToleranceFunc. -func (mock *MeiliIndexManager) GetTypoTolerance() (*meilisearch.TypoTolerance, error) { - callInfo := struct { - }{} - mock.lockGetTypoTolerance.Lock() - mock.calls.GetTypoTolerance = append(mock.calls.GetTypoTolerance, callInfo) - mock.lockGetTypoTolerance.Unlock() - if mock.GetTypoToleranceFunc == nil { - var ( - typoToleranceOut *meilisearch.TypoTolerance - errOut error - ) - return typoToleranceOut, errOut - } - return mock.GetTypoToleranceFunc() -} - -// GetTypoToleranceCalls gets all the calls that were made to GetTypoTolerance. -// Check the length with: -// -// len(mockedIndexManager.GetTypoToleranceCalls()) -func (mock *MeiliIndexManager) GetTypoToleranceCalls() []struct { -} { - var calls []struct { - } - mock.lockGetTypoTolerance.RLock() - calls = mock.calls.GetTypoTolerance - mock.lockGetTypoTolerance.RUnlock() - return calls -} - -// GetTypoToleranceWithContext calls GetTypoToleranceWithContextFunc. -func (mock *MeiliIndexManager) GetTypoToleranceWithContext(ctx context.Context) (*meilisearch.TypoTolerance, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetTypoToleranceWithContext.Lock() - mock.calls.GetTypoToleranceWithContext = append(mock.calls.GetTypoToleranceWithContext, callInfo) - mock.lockGetTypoToleranceWithContext.Unlock() - if mock.GetTypoToleranceWithContextFunc == nil { - var ( - typoToleranceOut *meilisearch.TypoTolerance - errOut error - ) - return typoToleranceOut, errOut - } - return mock.GetTypoToleranceWithContextFunc(ctx) -} - -// GetTypoToleranceWithContextCalls gets all the calls that were made to GetTypoToleranceWithContext. -// Check the length with: -// -// len(mockedIndexManager.GetTypoToleranceWithContextCalls()) -func (mock *MeiliIndexManager) GetTypoToleranceWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetTypoToleranceWithContext.RLock() - calls = mock.calls.GetTypoToleranceWithContext - mock.lockGetTypoToleranceWithContext.RUnlock() - return calls -} - -// ResetDictionary calls ResetDictionaryFunc. -func (mock *MeiliIndexManager) ResetDictionary() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetDictionary.Lock() - mock.calls.ResetDictionary = append(mock.calls.ResetDictionary, callInfo) - mock.lockResetDictionary.Unlock() - if mock.ResetDictionaryFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetDictionaryFunc() -} - -// ResetDictionaryCalls gets all the calls that were made to ResetDictionary. -// Check the length with: -// -// len(mockedIndexManager.ResetDictionaryCalls()) -func (mock *MeiliIndexManager) ResetDictionaryCalls() []struct { -} { - var calls []struct { - } - mock.lockResetDictionary.RLock() - calls = mock.calls.ResetDictionary - mock.lockResetDictionary.RUnlock() - return calls -} - -// ResetDictionaryWithContext calls ResetDictionaryWithContextFunc. -func (mock *MeiliIndexManager) ResetDictionaryWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetDictionaryWithContext.Lock() - mock.calls.ResetDictionaryWithContext = append(mock.calls.ResetDictionaryWithContext, callInfo) - mock.lockResetDictionaryWithContext.Unlock() - if mock.ResetDictionaryWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetDictionaryWithContextFunc(ctx) -} - -// ResetDictionaryWithContextCalls gets all the calls that were made to ResetDictionaryWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetDictionaryWithContextCalls()) -func (mock *MeiliIndexManager) ResetDictionaryWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetDictionaryWithContext.RLock() - calls = mock.calls.ResetDictionaryWithContext - mock.lockResetDictionaryWithContext.RUnlock() - return calls -} - -// ResetDisplayedAttributes calls ResetDisplayedAttributesFunc. -func (mock *MeiliIndexManager) ResetDisplayedAttributes() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetDisplayedAttributes.Lock() - mock.calls.ResetDisplayedAttributes = append(mock.calls.ResetDisplayedAttributes, callInfo) - mock.lockResetDisplayedAttributes.Unlock() - if mock.ResetDisplayedAttributesFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetDisplayedAttributesFunc() -} - -// ResetDisplayedAttributesCalls gets all the calls that were made to ResetDisplayedAttributes. -// Check the length with: -// -// len(mockedIndexManager.ResetDisplayedAttributesCalls()) -func (mock *MeiliIndexManager) ResetDisplayedAttributesCalls() []struct { -} { - var calls []struct { - } - mock.lockResetDisplayedAttributes.RLock() - calls = mock.calls.ResetDisplayedAttributes - mock.lockResetDisplayedAttributes.RUnlock() - return calls -} - -// ResetDisplayedAttributesWithContext calls ResetDisplayedAttributesWithContextFunc. -func (mock *MeiliIndexManager) ResetDisplayedAttributesWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetDisplayedAttributesWithContext.Lock() - mock.calls.ResetDisplayedAttributesWithContext = append(mock.calls.ResetDisplayedAttributesWithContext, callInfo) - mock.lockResetDisplayedAttributesWithContext.Unlock() - if mock.ResetDisplayedAttributesWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetDisplayedAttributesWithContextFunc(ctx) -} - -// ResetDisplayedAttributesWithContextCalls gets all the calls that were made to ResetDisplayedAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetDisplayedAttributesWithContextCalls()) -func (mock *MeiliIndexManager) ResetDisplayedAttributesWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetDisplayedAttributesWithContext.RLock() - calls = mock.calls.ResetDisplayedAttributesWithContext - mock.lockResetDisplayedAttributesWithContext.RUnlock() - return calls -} - -// ResetDistinctAttribute calls ResetDistinctAttributeFunc. -func (mock *MeiliIndexManager) ResetDistinctAttribute() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetDistinctAttribute.Lock() - mock.calls.ResetDistinctAttribute = append(mock.calls.ResetDistinctAttribute, callInfo) - mock.lockResetDistinctAttribute.Unlock() - if mock.ResetDistinctAttributeFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetDistinctAttributeFunc() -} - -// ResetDistinctAttributeCalls gets all the calls that were made to ResetDistinctAttribute. -// Check the length with: -// -// len(mockedIndexManager.ResetDistinctAttributeCalls()) -func (mock *MeiliIndexManager) ResetDistinctAttributeCalls() []struct { -} { - var calls []struct { - } - mock.lockResetDistinctAttribute.RLock() - calls = mock.calls.ResetDistinctAttribute - mock.lockResetDistinctAttribute.RUnlock() - return calls -} - -// ResetDistinctAttributeWithContext calls ResetDistinctAttributeWithContextFunc. -func (mock *MeiliIndexManager) ResetDistinctAttributeWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetDistinctAttributeWithContext.Lock() - mock.calls.ResetDistinctAttributeWithContext = append(mock.calls.ResetDistinctAttributeWithContext, callInfo) - mock.lockResetDistinctAttributeWithContext.Unlock() - if mock.ResetDistinctAttributeWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetDistinctAttributeWithContextFunc(ctx) -} - -// ResetDistinctAttributeWithContextCalls gets all the calls that were made to ResetDistinctAttributeWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetDistinctAttributeWithContextCalls()) -func (mock *MeiliIndexManager) ResetDistinctAttributeWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetDistinctAttributeWithContext.RLock() - calls = mock.calls.ResetDistinctAttributeWithContext - mock.lockResetDistinctAttributeWithContext.RUnlock() - return calls -} - -// ResetEmbedders calls ResetEmbeddersFunc. -func (mock *MeiliIndexManager) ResetEmbedders() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetEmbedders.Lock() - mock.calls.ResetEmbedders = append(mock.calls.ResetEmbedders, callInfo) - mock.lockResetEmbedders.Unlock() - if mock.ResetEmbeddersFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetEmbeddersFunc() -} - -// ResetEmbeddersCalls gets all the calls that were made to ResetEmbedders. -// Check the length with: -// -// len(mockedIndexManager.ResetEmbeddersCalls()) -func (mock *MeiliIndexManager) ResetEmbeddersCalls() []struct { -} { - var calls []struct { - } - mock.lockResetEmbedders.RLock() - calls = mock.calls.ResetEmbedders - mock.lockResetEmbedders.RUnlock() - return calls -} - -// ResetEmbeddersWithContext calls ResetEmbeddersWithContextFunc. -func (mock *MeiliIndexManager) ResetEmbeddersWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetEmbeddersWithContext.Lock() - mock.calls.ResetEmbeddersWithContext = append(mock.calls.ResetEmbeddersWithContext, callInfo) - mock.lockResetEmbeddersWithContext.Unlock() - if mock.ResetEmbeddersWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetEmbeddersWithContextFunc(ctx) -} - -// ResetEmbeddersWithContextCalls gets all the calls that were made to ResetEmbeddersWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetEmbeddersWithContextCalls()) -func (mock *MeiliIndexManager) ResetEmbeddersWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetEmbeddersWithContext.RLock() - calls = mock.calls.ResetEmbeddersWithContext - mock.lockResetEmbeddersWithContext.RUnlock() - return calls -} - -// ResetFacetSearch calls ResetFacetSearchFunc. -func (mock *MeiliIndexManager) ResetFacetSearch() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetFacetSearch.Lock() - mock.calls.ResetFacetSearch = append(mock.calls.ResetFacetSearch, callInfo) - mock.lockResetFacetSearch.Unlock() - if mock.ResetFacetSearchFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetFacetSearchFunc() -} - -// ResetFacetSearchCalls gets all the calls that were made to ResetFacetSearch. -// Check the length with: -// -// len(mockedIndexManager.ResetFacetSearchCalls()) -func (mock *MeiliIndexManager) ResetFacetSearchCalls() []struct { -} { - var calls []struct { - } - mock.lockResetFacetSearch.RLock() - calls = mock.calls.ResetFacetSearch - mock.lockResetFacetSearch.RUnlock() - return calls -} - -// ResetFacetSearchWithContext calls ResetFacetSearchWithContextFunc. -func (mock *MeiliIndexManager) ResetFacetSearchWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetFacetSearchWithContext.Lock() - mock.calls.ResetFacetSearchWithContext = append(mock.calls.ResetFacetSearchWithContext, callInfo) - mock.lockResetFacetSearchWithContext.Unlock() - if mock.ResetFacetSearchWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetFacetSearchWithContextFunc(ctx) -} - -// ResetFacetSearchWithContextCalls gets all the calls that were made to ResetFacetSearchWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetFacetSearchWithContextCalls()) -func (mock *MeiliIndexManager) ResetFacetSearchWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetFacetSearchWithContext.RLock() - calls = mock.calls.ResetFacetSearchWithContext - mock.lockResetFacetSearchWithContext.RUnlock() - return calls -} - -// ResetFaceting calls ResetFacetingFunc. -func (mock *MeiliIndexManager) ResetFaceting() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetFaceting.Lock() - mock.calls.ResetFaceting = append(mock.calls.ResetFaceting, callInfo) - mock.lockResetFaceting.Unlock() - if mock.ResetFacetingFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetFacetingFunc() -} - -// ResetFacetingCalls gets all the calls that were made to ResetFaceting. -// Check the length with: -// -// len(mockedIndexManager.ResetFacetingCalls()) -func (mock *MeiliIndexManager) ResetFacetingCalls() []struct { -} { - var calls []struct { - } - mock.lockResetFaceting.RLock() - calls = mock.calls.ResetFaceting - mock.lockResetFaceting.RUnlock() - return calls -} - -// ResetFacetingWithContext calls ResetFacetingWithContextFunc. -func (mock *MeiliIndexManager) ResetFacetingWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetFacetingWithContext.Lock() - mock.calls.ResetFacetingWithContext = append(mock.calls.ResetFacetingWithContext, callInfo) - mock.lockResetFacetingWithContext.Unlock() - if mock.ResetFacetingWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetFacetingWithContextFunc(ctx) -} - -// ResetFacetingWithContextCalls gets all the calls that were made to ResetFacetingWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetFacetingWithContextCalls()) -func (mock *MeiliIndexManager) ResetFacetingWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetFacetingWithContext.RLock() - calls = mock.calls.ResetFacetingWithContext - mock.lockResetFacetingWithContext.RUnlock() - return calls -} - -// ResetFilterableAttributes calls ResetFilterableAttributesFunc. -func (mock *MeiliIndexManager) ResetFilterableAttributes() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetFilterableAttributes.Lock() - mock.calls.ResetFilterableAttributes = append(mock.calls.ResetFilterableAttributes, callInfo) - mock.lockResetFilterableAttributes.Unlock() - if mock.ResetFilterableAttributesFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetFilterableAttributesFunc() -} - -// ResetFilterableAttributesCalls gets all the calls that were made to ResetFilterableAttributes. -// Check the length with: -// -// len(mockedIndexManager.ResetFilterableAttributesCalls()) -func (mock *MeiliIndexManager) ResetFilterableAttributesCalls() []struct { -} { - var calls []struct { - } - mock.lockResetFilterableAttributes.RLock() - calls = mock.calls.ResetFilterableAttributes - mock.lockResetFilterableAttributes.RUnlock() - return calls -} - -// ResetFilterableAttributesWithContext calls ResetFilterableAttributesWithContextFunc. -func (mock *MeiliIndexManager) ResetFilterableAttributesWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetFilterableAttributesWithContext.Lock() - mock.calls.ResetFilterableAttributesWithContext = append(mock.calls.ResetFilterableAttributesWithContext, callInfo) - mock.lockResetFilterableAttributesWithContext.Unlock() - if mock.ResetFilterableAttributesWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetFilterableAttributesWithContextFunc(ctx) -} - -// ResetFilterableAttributesWithContextCalls gets all the calls that were made to ResetFilterableAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetFilterableAttributesWithContextCalls()) -func (mock *MeiliIndexManager) ResetFilterableAttributesWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetFilterableAttributesWithContext.RLock() - calls = mock.calls.ResetFilterableAttributesWithContext - mock.lockResetFilterableAttributesWithContext.RUnlock() - return calls -} - -// ResetLocalizedAttributes calls ResetLocalizedAttributesFunc. -func (mock *MeiliIndexManager) ResetLocalizedAttributes() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetLocalizedAttributes.Lock() - mock.calls.ResetLocalizedAttributes = append(mock.calls.ResetLocalizedAttributes, callInfo) - mock.lockResetLocalizedAttributes.Unlock() - if mock.ResetLocalizedAttributesFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetLocalizedAttributesFunc() -} - -// ResetLocalizedAttributesCalls gets all the calls that were made to ResetLocalizedAttributes. -// Check the length with: -// -// len(mockedIndexManager.ResetLocalizedAttributesCalls()) -func (mock *MeiliIndexManager) ResetLocalizedAttributesCalls() []struct { -} { - var calls []struct { - } - mock.lockResetLocalizedAttributes.RLock() - calls = mock.calls.ResetLocalizedAttributes - mock.lockResetLocalizedAttributes.RUnlock() - return calls -} - -// ResetLocalizedAttributesWithContext calls ResetLocalizedAttributesWithContextFunc. -func (mock *MeiliIndexManager) ResetLocalizedAttributesWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetLocalizedAttributesWithContext.Lock() - mock.calls.ResetLocalizedAttributesWithContext = append(mock.calls.ResetLocalizedAttributesWithContext, callInfo) - mock.lockResetLocalizedAttributesWithContext.Unlock() - if mock.ResetLocalizedAttributesWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetLocalizedAttributesWithContextFunc(ctx) -} - -// ResetLocalizedAttributesWithContextCalls gets all the calls that were made to ResetLocalizedAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetLocalizedAttributesWithContextCalls()) -func (mock *MeiliIndexManager) ResetLocalizedAttributesWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetLocalizedAttributesWithContext.RLock() - calls = mock.calls.ResetLocalizedAttributesWithContext - mock.lockResetLocalizedAttributesWithContext.RUnlock() - return calls -} - -// ResetNonSeparatorTokens calls ResetNonSeparatorTokensFunc. -func (mock *MeiliIndexManager) ResetNonSeparatorTokens() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetNonSeparatorTokens.Lock() - mock.calls.ResetNonSeparatorTokens = append(mock.calls.ResetNonSeparatorTokens, callInfo) - mock.lockResetNonSeparatorTokens.Unlock() - if mock.ResetNonSeparatorTokensFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetNonSeparatorTokensFunc() -} - -// ResetNonSeparatorTokensCalls gets all the calls that were made to ResetNonSeparatorTokens. -// Check the length with: -// -// len(mockedIndexManager.ResetNonSeparatorTokensCalls()) -func (mock *MeiliIndexManager) ResetNonSeparatorTokensCalls() []struct { -} { - var calls []struct { - } - mock.lockResetNonSeparatorTokens.RLock() - calls = mock.calls.ResetNonSeparatorTokens - mock.lockResetNonSeparatorTokens.RUnlock() - return calls -} - -// ResetNonSeparatorTokensWithContext calls ResetNonSeparatorTokensWithContextFunc. -func (mock *MeiliIndexManager) ResetNonSeparatorTokensWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetNonSeparatorTokensWithContext.Lock() - mock.calls.ResetNonSeparatorTokensWithContext = append(mock.calls.ResetNonSeparatorTokensWithContext, callInfo) - mock.lockResetNonSeparatorTokensWithContext.Unlock() - if mock.ResetNonSeparatorTokensWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetNonSeparatorTokensWithContextFunc(ctx) -} - -// ResetNonSeparatorTokensWithContextCalls gets all the calls that were made to ResetNonSeparatorTokensWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetNonSeparatorTokensWithContextCalls()) -func (mock *MeiliIndexManager) ResetNonSeparatorTokensWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetNonSeparatorTokensWithContext.RLock() - calls = mock.calls.ResetNonSeparatorTokensWithContext - mock.lockResetNonSeparatorTokensWithContext.RUnlock() - return calls -} - -// ResetPagination calls ResetPaginationFunc. -func (mock *MeiliIndexManager) ResetPagination() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetPagination.Lock() - mock.calls.ResetPagination = append(mock.calls.ResetPagination, callInfo) - mock.lockResetPagination.Unlock() - if mock.ResetPaginationFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetPaginationFunc() -} - -// ResetPaginationCalls gets all the calls that were made to ResetPagination. -// Check the length with: -// -// len(mockedIndexManager.ResetPaginationCalls()) -func (mock *MeiliIndexManager) ResetPaginationCalls() []struct { -} { - var calls []struct { - } - mock.lockResetPagination.RLock() - calls = mock.calls.ResetPagination - mock.lockResetPagination.RUnlock() - return calls -} - -// ResetPaginationWithContext calls ResetPaginationWithContextFunc. -func (mock *MeiliIndexManager) ResetPaginationWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetPaginationWithContext.Lock() - mock.calls.ResetPaginationWithContext = append(mock.calls.ResetPaginationWithContext, callInfo) - mock.lockResetPaginationWithContext.Unlock() - if mock.ResetPaginationWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetPaginationWithContextFunc(ctx) -} - -// ResetPaginationWithContextCalls gets all the calls that were made to ResetPaginationWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetPaginationWithContextCalls()) -func (mock *MeiliIndexManager) ResetPaginationWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetPaginationWithContext.RLock() - calls = mock.calls.ResetPaginationWithContext - mock.lockResetPaginationWithContext.RUnlock() - return calls -} - -// ResetPrefixSearch calls ResetPrefixSearchFunc. -func (mock *MeiliIndexManager) ResetPrefixSearch() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetPrefixSearch.Lock() - mock.calls.ResetPrefixSearch = append(mock.calls.ResetPrefixSearch, callInfo) - mock.lockResetPrefixSearch.Unlock() - if mock.ResetPrefixSearchFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetPrefixSearchFunc() -} - -// ResetPrefixSearchCalls gets all the calls that were made to ResetPrefixSearch. -// Check the length with: -// -// len(mockedIndexManager.ResetPrefixSearchCalls()) -func (mock *MeiliIndexManager) ResetPrefixSearchCalls() []struct { -} { - var calls []struct { - } - mock.lockResetPrefixSearch.RLock() - calls = mock.calls.ResetPrefixSearch - mock.lockResetPrefixSearch.RUnlock() - return calls -} - -// ResetPrefixSearchWithContext calls ResetPrefixSearchWithContextFunc. -func (mock *MeiliIndexManager) ResetPrefixSearchWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetPrefixSearchWithContext.Lock() - mock.calls.ResetPrefixSearchWithContext = append(mock.calls.ResetPrefixSearchWithContext, callInfo) - mock.lockResetPrefixSearchWithContext.Unlock() - if mock.ResetPrefixSearchWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetPrefixSearchWithContextFunc(ctx) -} - -// ResetPrefixSearchWithContextCalls gets all the calls that were made to ResetPrefixSearchWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetPrefixSearchWithContextCalls()) -func (mock *MeiliIndexManager) ResetPrefixSearchWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetPrefixSearchWithContext.RLock() - calls = mock.calls.ResetPrefixSearchWithContext - mock.lockResetPrefixSearchWithContext.RUnlock() - return calls -} - -// ResetProximityPrecision calls ResetProximityPrecisionFunc. -func (mock *MeiliIndexManager) ResetProximityPrecision() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetProximityPrecision.Lock() - mock.calls.ResetProximityPrecision = append(mock.calls.ResetProximityPrecision, callInfo) - mock.lockResetProximityPrecision.Unlock() - if mock.ResetProximityPrecisionFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetProximityPrecisionFunc() -} - -// ResetProximityPrecisionCalls gets all the calls that were made to ResetProximityPrecision. -// Check the length with: -// -// len(mockedIndexManager.ResetProximityPrecisionCalls()) -func (mock *MeiliIndexManager) ResetProximityPrecisionCalls() []struct { -} { - var calls []struct { - } - mock.lockResetProximityPrecision.RLock() - calls = mock.calls.ResetProximityPrecision - mock.lockResetProximityPrecision.RUnlock() - return calls -} - -// ResetProximityPrecisionWithContext calls ResetProximityPrecisionWithContextFunc. -func (mock *MeiliIndexManager) ResetProximityPrecisionWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetProximityPrecisionWithContext.Lock() - mock.calls.ResetProximityPrecisionWithContext = append(mock.calls.ResetProximityPrecisionWithContext, callInfo) - mock.lockResetProximityPrecisionWithContext.Unlock() - if mock.ResetProximityPrecisionWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetProximityPrecisionWithContextFunc(ctx) -} - -// ResetProximityPrecisionWithContextCalls gets all the calls that were made to ResetProximityPrecisionWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetProximityPrecisionWithContextCalls()) -func (mock *MeiliIndexManager) ResetProximityPrecisionWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetProximityPrecisionWithContext.RLock() - calls = mock.calls.ResetProximityPrecisionWithContext - mock.lockResetProximityPrecisionWithContext.RUnlock() - return calls -} - -// ResetRankingRules calls ResetRankingRulesFunc. -func (mock *MeiliIndexManager) ResetRankingRules() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetRankingRules.Lock() - mock.calls.ResetRankingRules = append(mock.calls.ResetRankingRules, callInfo) - mock.lockResetRankingRules.Unlock() - if mock.ResetRankingRulesFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetRankingRulesFunc() -} - -// ResetRankingRulesCalls gets all the calls that were made to ResetRankingRules. -// Check the length with: -// -// len(mockedIndexManager.ResetRankingRulesCalls()) -func (mock *MeiliIndexManager) ResetRankingRulesCalls() []struct { -} { - var calls []struct { - } - mock.lockResetRankingRules.RLock() - calls = mock.calls.ResetRankingRules - mock.lockResetRankingRules.RUnlock() - return calls -} - -// ResetRankingRulesWithContext calls ResetRankingRulesWithContextFunc. -func (mock *MeiliIndexManager) ResetRankingRulesWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetRankingRulesWithContext.Lock() - mock.calls.ResetRankingRulesWithContext = append(mock.calls.ResetRankingRulesWithContext, callInfo) - mock.lockResetRankingRulesWithContext.Unlock() - if mock.ResetRankingRulesWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetRankingRulesWithContextFunc(ctx) -} - -// ResetRankingRulesWithContextCalls gets all the calls that were made to ResetRankingRulesWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetRankingRulesWithContextCalls()) -func (mock *MeiliIndexManager) ResetRankingRulesWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetRankingRulesWithContext.RLock() - calls = mock.calls.ResetRankingRulesWithContext - mock.lockResetRankingRulesWithContext.RUnlock() - return calls -} - -// ResetSearchCutoffMs calls ResetSearchCutoffMsFunc. -func (mock *MeiliIndexManager) ResetSearchCutoffMs() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetSearchCutoffMs.Lock() - mock.calls.ResetSearchCutoffMs = append(mock.calls.ResetSearchCutoffMs, callInfo) - mock.lockResetSearchCutoffMs.Unlock() - if mock.ResetSearchCutoffMsFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetSearchCutoffMsFunc() -} - -// ResetSearchCutoffMsCalls gets all the calls that were made to ResetSearchCutoffMs. -// Check the length with: -// -// len(mockedIndexManager.ResetSearchCutoffMsCalls()) -func (mock *MeiliIndexManager) ResetSearchCutoffMsCalls() []struct { -} { - var calls []struct { - } - mock.lockResetSearchCutoffMs.RLock() - calls = mock.calls.ResetSearchCutoffMs - mock.lockResetSearchCutoffMs.RUnlock() - return calls -} - -// ResetSearchCutoffMsWithContext calls ResetSearchCutoffMsWithContextFunc. -func (mock *MeiliIndexManager) ResetSearchCutoffMsWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetSearchCutoffMsWithContext.Lock() - mock.calls.ResetSearchCutoffMsWithContext = append(mock.calls.ResetSearchCutoffMsWithContext, callInfo) - mock.lockResetSearchCutoffMsWithContext.Unlock() - if mock.ResetSearchCutoffMsWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetSearchCutoffMsWithContextFunc(ctx) -} - -// ResetSearchCutoffMsWithContextCalls gets all the calls that were made to ResetSearchCutoffMsWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetSearchCutoffMsWithContextCalls()) -func (mock *MeiliIndexManager) ResetSearchCutoffMsWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetSearchCutoffMsWithContext.RLock() - calls = mock.calls.ResetSearchCutoffMsWithContext - mock.lockResetSearchCutoffMsWithContext.RUnlock() - return calls -} - -// ResetSearchableAttributes calls ResetSearchableAttributesFunc. -func (mock *MeiliIndexManager) ResetSearchableAttributes() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetSearchableAttributes.Lock() - mock.calls.ResetSearchableAttributes = append(mock.calls.ResetSearchableAttributes, callInfo) - mock.lockResetSearchableAttributes.Unlock() - if mock.ResetSearchableAttributesFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetSearchableAttributesFunc() -} - -// ResetSearchableAttributesCalls gets all the calls that were made to ResetSearchableAttributes. -// Check the length with: -// -// len(mockedIndexManager.ResetSearchableAttributesCalls()) -func (mock *MeiliIndexManager) ResetSearchableAttributesCalls() []struct { -} { - var calls []struct { - } - mock.lockResetSearchableAttributes.RLock() - calls = mock.calls.ResetSearchableAttributes - mock.lockResetSearchableAttributes.RUnlock() - return calls -} - -// ResetSearchableAttributesWithContext calls ResetSearchableAttributesWithContextFunc. -func (mock *MeiliIndexManager) ResetSearchableAttributesWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetSearchableAttributesWithContext.Lock() - mock.calls.ResetSearchableAttributesWithContext = append(mock.calls.ResetSearchableAttributesWithContext, callInfo) - mock.lockResetSearchableAttributesWithContext.Unlock() - if mock.ResetSearchableAttributesWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetSearchableAttributesWithContextFunc(ctx) -} - -// ResetSearchableAttributesWithContextCalls gets all the calls that were made to ResetSearchableAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetSearchableAttributesWithContextCalls()) -func (mock *MeiliIndexManager) ResetSearchableAttributesWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetSearchableAttributesWithContext.RLock() - calls = mock.calls.ResetSearchableAttributesWithContext - mock.lockResetSearchableAttributesWithContext.RUnlock() - return calls -} - -// ResetSeparatorTokens calls ResetSeparatorTokensFunc. -func (mock *MeiliIndexManager) ResetSeparatorTokens() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetSeparatorTokens.Lock() - mock.calls.ResetSeparatorTokens = append(mock.calls.ResetSeparatorTokens, callInfo) - mock.lockResetSeparatorTokens.Unlock() - if mock.ResetSeparatorTokensFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetSeparatorTokensFunc() -} - -// ResetSeparatorTokensCalls gets all the calls that were made to ResetSeparatorTokens. -// Check the length with: -// -// len(mockedIndexManager.ResetSeparatorTokensCalls()) -func (mock *MeiliIndexManager) ResetSeparatorTokensCalls() []struct { -} { - var calls []struct { - } - mock.lockResetSeparatorTokens.RLock() - calls = mock.calls.ResetSeparatorTokens - mock.lockResetSeparatorTokens.RUnlock() - return calls -} - -// ResetSeparatorTokensWithContext calls ResetSeparatorTokensWithContextFunc. -func (mock *MeiliIndexManager) ResetSeparatorTokensWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetSeparatorTokensWithContext.Lock() - mock.calls.ResetSeparatorTokensWithContext = append(mock.calls.ResetSeparatorTokensWithContext, callInfo) - mock.lockResetSeparatorTokensWithContext.Unlock() - if mock.ResetSeparatorTokensWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetSeparatorTokensWithContextFunc(ctx) -} - -// ResetSeparatorTokensWithContextCalls gets all the calls that were made to ResetSeparatorTokensWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetSeparatorTokensWithContextCalls()) -func (mock *MeiliIndexManager) ResetSeparatorTokensWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetSeparatorTokensWithContext.RLock() - calls = mock.calls.ResetSeparatorTokensWithContext - mock.lockResetSeparatorTokensWithContext.RUnlock() - return calls -} - -// ResetSettings calls ResetSettingsFunc. -func (mock *MeiliIndexManager) ResetSettings() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetSettings.Lock() - mock.calls.ResetSettings = append(mock.calls.ResetSettings, callInfo) - mock.lockResetSettings.Unlock() - if mock.ResetSettingsFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetSettingsFunc() -} - -// ResetSettingsCalls gets all the calls that were made to ResetSettings. -// Check the length with: -// -// len(mockedIndexManager.ResetSettingsCalls()) -func (mock *MeiliIndexManager) ResetSettingsCalls() []struct { -} { - var calls []struct { - } - mock.lockResetSettings.RLock() - calls = mock.calls.ResetSettings - mock.lockResetSettings.RUnlock() - return calls -} - -// ResetSettingsWithContext calls ResetSettingsWithContextFunc. -func (mock *MeiliIndexManager) ResetSettingsWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetSettingsWithContext.Lock() - mock.calls.ResetSettingsWithContext = append(mock.calls.ResetSettingsWithContext, callInfo) - mock.lockResetSettingsWithContext.Unlock() - if mock.ResetSettingsWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetSettingsWithContextFunc(ctx) -} - -// ResetSettingsWithContextCalls gets all the calls that were made to ResetSettingsWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetSettingsWithContextCalls()) -func (mock *MeiliIndexManager) ResetSettingsWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetSettingsWithContext.RLock() - calls = mock.calls.ResetSettingsWithContext - mock.lockResetSettingsWithContext.RUnlock() - return calls -} - -// ResetSortableAttributes calls ResetSortableAttributesFunc. -func (mock *MeiliIndexManager) ResetSortableAttributes() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetSortableAttributes.Lock() - mock.calls.ResetSortableAttributes = append(mock.calls.ResetSortableAttributes, callInfo) - mock.lockResetSortableAttributes.Unlock() - if mock.ResetSortableAttributesFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetSortableAttributesFunc() -} - -// ResetSortableAttributesCalls gets all the calls that were made to ResetSortableAttributes. -// Check the length with: -// -// len(mockedIndexManager.ResetSortableAttributesCalls()) -func (mock *MeiliIndexManager) ResetSortableAttributesCalls() []struct { -} { - var calls []struct { - } - mock.lockResetSortableAttributes.RLock() - calls = mock.calls.ResetSortableAttributes - mock.lockResetSortableAttributes.RUnlock() - return calls -} - -// ResetSortableAttributesWithContext calls ResetSortableAttributesWithContextFunc. -func (mock *MeiliIndexManager) ResetSortableAttributesWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetSortableAttributesWithContext.Lock() - mock.calls.ResetSortableAttributesWithContext = append(mock.calls.ResetSortableAttributesWithContext, callInfo) - mock.lockResetSortableAttributesWithContext.Unlock() - if mock.ResetSortableAttributesWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetSortableAttributesWithContextFunc(ctx) -} - -// ResetSortableAttributesWithContextCalls gets all the calls that were made to ResetSortableAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetSortableAttributesWithContextCalls()) -func (mock *MeiliIndexManager) ResetSortableAttributesWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetSortableAttributesWithContext.RLock() - calls = mock.calls.ResetSortableAttributesWithContext - mock.lockResetSortableAttributesWithContext.RUnlock() - return calls -} - -// ResetStopWords calls ResetStopWordsFunc. -func (mock *MeiliIndexManager) ResetStopWords() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetStopWords.Lock() - mock.calls.ResetStopWords = append(mock.calls.ResetStopWords, callInfo) - mock.lockResetStopWords.Unlock() - if mock.ResetStopWordsFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetStopWordsFunc() -} - -// ResetStopWordsCalls gets all the calls that were made to ResetStopWords. -// Check the length with: -// -// len(mockedIndexManager.ResetStopWordsCalls()) -func (mock *MeiliIndexManager) ResetStopWordsCalls() []struct { -} { - var calls []struct { - } - mock.lockResetStopWords.RLock() - calls = mock.calls.ResetStopWords - mock.lockResetStopWords.RUnlock() - return calls -} - -// ResetStopWordsWithContext calls ResetStopWordsWithContextFunc. -func (mock *MeiliIndexManager) ResetStopWordsWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetStopWordsWithContext.Lock() - mock.calls.ResetStopWordsWithContext = append(mock.calls.ResetStopWordsWithContext, callInfo) - mock.lockResetStopWordsWithContext.Unlock() - if mock.ResetStopWordsWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetStopWordsWithContextFunc(ctx) -} - -// ResetStopWordsWithContextCalls gets all the calls that were made to ResetStopWordsWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetStopWordsWithContextCalls()) -func (mock *MeiliIndexManager) ResetStopWordsWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetStopWordsWithContext.RLock() - calls = mock.calls.ResetStopWordsWithContext - mock.lockResetStopWordsWithContext.RUnlock() - return calls -} - -// ResetSynonyms calls ResetSynonymsFunc. -func (mock *MeiliIndexManager) ResetSynonyms() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetSynonyms.Lock() - mock.calls.ResetSynonyms = append(mock.calls.ResetSynonyms, callInfo) - mock.lockResetSynonyms.Unlock() - if mock.ResetSynonymsFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetSynonymsFunc() -} - -// ResetSynonymsCalls gets all the calls that were made to ResetSynonyms. -// Check the length with: -// -// len(mockedIndexManager.ResetSynonymsCalls()) -func (mock *MeiliIndexManager) ResetSynonymsCalls() []struct { -} { - var calls []struct { - } - mock.lockResetSynonyms.RLock() - calls = mock.calls.ResetSynonyms - mock.lockResetSynonyms.RUnlock() - return calls -} - -// ResetSynonymsWithContext calls ResetSynonymsWithContextFunc. -func (mock *MeiliIndexManager) ResetSynonymsWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetSynonymsWithContext.Lock() - mock.calls.ResetSynonymsWithContext = append(mock.calls.ResetSynonymsWithContext, callInfo) - mock.lockResetSynonymsWithContext.Unlock() - if mock.ResetSynonymsWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetSynonymsWithContextFunc(ctx) -} - -// ResetSynonymsWithContextCalls gets all the calls that were made to ResetSynonymsWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetSynonymsWithContextCalls()) -func (mock *MeiliIndexManager) ResetSynonymsWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetSynonymsWithContext.RLock() - calls = mock.calls.ResetSynonymsWithContext - mock.lockResetSynonymsWithContext.RUnlock() - return calls -} - -// ResetTypoTolerance calls ResetTypoToleranceFunc. -func (mock *MeiliIndexManager) ResetTypoTolerance() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockResetTypoTolerance.Lock() - mock.calls.ResetTypoTolerance = append(mock.calls.ResetTypoTolerance, callInfo) - mock.lockResetTypoTolerance.Unlock() - if mock.ResetTypoToleranceFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetTypoToleranceFunc() -} - -// ResetTypoToleranceCalls gets all the calls that were made to ResetTypoTolerance. -// Check the length with: -// -// len(mockedIndexManager.ResetTypoToleranceCalls()) -func (mock *MeiliIndexManager) ResetTypoToleranceCalls() []struct { -} { - var calls []struct { - } - mock.lockResetTypoTolerance.RLock() - calls = mock.calls.ResetTypoTolerance - mock.lockResetTypoTolerance.RUnlock() - return calls -} - -// ResetTypoToleranceWithContext calls ResetTypoToleranceWithContextFunc. -func (mock *MeiliIndexManager) ResetTypoToleranceWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockResetTypoToleranceWithContext.Lock() - mock.calls.ResetTypoToleranceWithContext = append(mock.calls.ResetTypoToleranceWithContext, callInfo) - mock.lockResetTypoToleranceWithContext.Unlock() - if mock.ResetTypoToleranceWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ResetTypoToleranceWithContextFunc(ctx) -} - -// ResetTypoToleranceWithContextCalls gets all the calls that were made to ResetTypoToleranceWithContext. -// Check the length with: -// -// len(mockedIndexManager.ResetTypoToleranceWithContextCalls()) -func (mock *MeiliIndexManager) ResetTypoToleranceWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockResetTypoToleranceWithContext.RLock() - calls = mock.calls.ResetTypoToleranceWithContext - mock.lockResetTypoToleranceWithContext.RUnlock() - return calls -} - -// Search calls SearchFunc. -func (mock *MeiliIndexManager) Search(query string, request *meilisearch.SearchRequest) (*meilisearch.SearchResponse, error) { - callInfo := struct { - Query string - Request *meilisearch.SearchRequest - }{ - Query: query, - Request: request, - } - mock.lockSearch.Lock() - mock.calls.Search = append(mock.calls.Search, callInfo) - mock.lockSearch.Unlock() - if mock.SearchFunc == nil { - var ( - searchResponseOut *meilisearch.SearchResponse - errOut error - ) - return searchResponseOut, errOut - } - return mock.SearchFunc(query, request) -} - -// SearchCalls gets all the calls that were made to Search. -// Check the length with: -// -// len(mockedIndexManager.SearchCalls()) -func (mock *MeiliIndexManager) SearchCalls() []struct { - Query string - Request *meilisearch.SearchRequest -} { - var calls []struct { - Query string - Request *meilisearch.SearchRequest - } - mock.lockSearch.RLock() - calls = mock.calls.Search - mock.lockSearch.RUnlock() - return calls -} - -// SearchRaw calls SearchRawFunc. -func (mock *MeiliIndexManager) SearchRaw(query string, request *meilisearch.SearchRequest) (*json.RawMessage, error) { - callInfo := struct { - Query string - Request *meilisearch.SearchRequest - }{ - Query: query, - Request: request, - } - mock.lockSearchRaw.Lock() - mock.calls.SearchRaw = append(mock.calls.SearchRaw, callInfo) - mock.lockSearchRaw.Unlock() - if mock.SearchRawFunc == nil { - var ( - rawMessageOut *json.RawMessage - errOut error - ) - return rawMessageOut, errOut - } - return mock.SearchRawFunc(query, request) -} - -// SearchRawCalls gets all the calls that were made to SearchRaw. -// Check the length with: -// -// len(mockedIndexManager.SearchRawCalls()) -func (mock *MeiliIndexManager) SearchRawCalls() []struct { - Query string - Request *meilisearch.SearchRequest -} { - var calls []struct { - Query string - Request *meilisearch.SearchRequest - } - mock.lockSearchRaw.RLock() - calls = mock.calls.SearchRaw - mock.lockSearchRaw.RUnlock() - return calls -} - -// SearchRawWithContext calls SearchRawWithContextFunc. -func (mock *MeiliIndexManager) SearchRawWithContext(ctx context.Context, query string, request *meilisearch.SearchRequest) (*json.RawMessage, error) { - callInfo := struct { - Ctx context.Context - Query string - Request *meilisearch.SearchRequest - }{ - Ctx: ctx, - Query: query, - Request: request, - } - mock.lockSearchRawWithContext.Lock() - mock.calls.SearchRawWithContext = append(mock.calls.SearchRawWithContext, callInfo) - mock.lockSearchRawWithContext.Unlock() - if mock.SearchRawWithContextFunc == nil { - var ( - rawMessageOut *json.RawMessage - errOut error - ) - return rawMessageOut, errOut - } - return mock.SearchRawWithContextFunc(ctx, query, request) -} - -// SearchRawWithContextCalls gets all the calls that were made to SearchRawWithContext. -// Check the length with: -// -// len(mockedIndexManager.SearchRawWithContextCalls()) -func (mock *MeiliIndexManager) SearchRawWithContextCalls() []struct { - Ctx context.Context - Query string - Request *meilisearch.SearchRequest -} { - var calls []struct { - Ctx context.Context - Query string - Request *meilisearch.SearchRequest - } - mock.lockSearchRawWithContext.RLock() - calls = mock.calls.SearchRawWithContext - mock.lockSearchRawWithContext.RUnlock() - return calls -} - -// SearchSimilarDocuments calls SearchSimilarDocumentsFunc. -func (mock *MeiliIndexManager) SearchSimilarDocuments(param *meilisearch.SimilarDocumentQuery, resp *meilisearch.SimilarDocumentResult) error { - callInfo := struct { - Param *meilisearch.SimilarDocumentQuery - Resp *meilisearch.SimilarDocumentResult - }{ - Param: param, - Resp: resp, - } - mock.lockSearchSimilarDocuments.Lock() - mock.calls.SearchSimilarDocuments = append(mock.calls.SearchSimilarDocuments, callInfo) - mock.lockSearchSimilarDocuments.Unlock() - if mock.SearchSimilarDocumentsFunc == nil { - var ( - errOut error - ) - return errOut - } - return mock.SearchSimilarDocumentsFunc(param, resp) -} - -// SearchSimilarDocumentsCalls gets all the calls that were made to SearchSimilarDocuments. -// Check the length with: -// -// len(mockedIndexManager.SearchSimilarDocumentsCalls()) -func (mock *MeiliIndexManager) SearchSimilarDocumentsCalls() []struct { - Param *meilisearch.SimilarDocumentQuery - Resp *meilisearch.SimilarDocumentResult -} { - var calls []struct { - Param *meilisearch.SimilarDocumentQuery - Resp *meilisearch.SimilarDocumentResult - } - mock.lockSearchSimilarDocuments.RLock() - calls = mock.calls.SearchSimilarDocuments - mock.lockSearchSimilarDocuments.RUnlock() - return calls -} - -// SearchSimilarDocumentsWithContext calls SearchSimilarDocumentsWithContextFunc. -func (mock *MeiliIndexManager) SearchSimilarDocumentsWithContext(ctx context.Context, param *meilisearch.SimilarDocumentQuery, resp *meilisearch.SimilarDocumentResult) error { - callInfo := struct { - Ctx context.Context - Param *meilisearch.SimilarDocumentQuery - Resp *meilisearch.SimilarDocumentResult - }{ - Ctx: ctx, - Param: param, - Resp: resp, - } - mock.lockSearchSimilarDocumentsWithContext.Lock() - mock.calls.SearchSimilarDocumentsWithContext = append(mock.calls.SearchSimilarDocumentsWithContext, callInfo) - mock.lockSearchSimilarDocumentsWithContext.Unlock() - if mock.SearchSimilarDocumentsWithContextFunc == nil { - var ( - errOut error - ) - return errOut - } - return mock.SearchSimilarDocumentsWithContextFunc(ctx, param, resp) -} - -// SearchSimilarDocumentsWithContextCalls gets all the calls that were made to SearchSimilarDocumentsWithContext. -// Check the length with: -// -// len(mockedIndexManager.SearchSimilarDocumentsWithContextCalls()) -func (mock *MeiliIndexManager) SearchSimilarDocumentsWithContextCalls() []struct { - Ctx context.Context - Param *meilisearch.SimilarDocumentQuery - Resp *meilisearch.SimilarDocumentResult -} { - var calls []struct { - Ctx context.Context - Param *meilisearch.SimilarDocumentQuery - Resp *meilisearch.SimilarDocumentResult - } - mock.lockSearchSimilarDocumentsWithContext.RLock() - calls = mock.calls.SearchSimilarDocumentsWithContext - mock.lockSearchSimilarDocumentsWithContext.RUnlock() - return calls -} - -// SearchWithContext calls SearchWithContextFunc. -func (mock *MeiliIndexManager) SearchWithContext(ctx context.Context, query string, request *meilisearch.SearchRequest) (*meilisearch.SearchResponse, error) { - callInfo := struct { - Ctx context.Context - Query string - Request *meilisearch.SearchRequest - }{ - Ctx: ctx, - Query: query, - Request: request, - } - mock.lockSearchWithContext.Lock() - mock.calls.SearchWithContext = append(mock.calls.SearchWithContext, callInfo) - mock.lockSearchWithContext.Unlock() - if mock.SearchWithContextFunc == nil { - var ( - searchResponseOut *meilisearch.SearchResponse - errOut error - ) - return searchResponseOut, errOut - } - return mock.SearchWithContextFunc(ctx, query, request) -} - -// SearchWithContextCalls gets all the calls that were made to SearchWithContext. -// Check the length with: -// -// len(mockedIndexManager.SearchWithContextCalls()) -func (mock *MeiliIndexManager) SearchWithContextCalls() []struct { - Ctx context.Context - Query string - Request *meilisearch.SearchRequest -} { - var calls []struct { - Ctx context.Context - Query string - Request *meilisearch.SearchRequest - } - mock.lockSearchWithContext.RLock() - calls = mock.calls.SearchWithContext - mock.lockSearchWithContext.RUnlock() - return calls -} - -// UpdateDictionary calls UpdateDictionaryFunc. -func (mock *MeiliIndexManager) UpdateDictionary(words []string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Words []string - }{ - Words: words, - } - mock.lockUpdateDictionary.Lock() - mock.calls.UpdateDictionary = append(mock.calls.UpdateDictionary, callInfo) - mock.lockUpdateDictionary.Unlock() - if mock.UpdateDictionaryFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateDictionaryFunc(words) -} - -// UpdateDictionaryCalls gets all the calls that were made to UpdateDictionary. -// Check the length with: -// -// len(mockedIndexManager.UpdateDictionaryCalls()) -func (mock *MeiliIndexManager) UpdateDictionaryCalls() []struct { - Words []string -} { - var calls []struct { - Words []string - } - mock.lockUpdateDictionary.RLock() - calls = mock.calls.UpdateDictionary - mock.lockUpdateDictionary.RUnlock() - return calls -} - -// UpdateDictionaryWithContext calls UpdateDictionaryWithContextFunc. -func (mock *MeiliIndexManager) UpdateDictionaryWithContext(ctx context.Context, words []string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Words []string - }{ - Ctx: ctx, - Words: words, - } - mock.lockUpdateDictionaryWithContext.Lock() - mock.calls.UpdateDictionaryWithContext = append(mock.calls.UpdateDictionaryWithContext, callInfo) - mock.lockUpdateDictionaryWithContext.Unlock() - if mock.UpdateDictionaryWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateDictionaryWithContextFunc(ctx, words) -} - -// UpdateDictionaryWithContextCalls gets all the calls that were made to UpdateDictionaryWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateDictionaryWithContextCalls()) -func (mock *MeiliIndexManager) UpdateDictionaryWithContextCalls() []struct { - Ctx context.Context - Words []string -} { - var calls []struct { - Ctx context.Context - Words []string - } - mock.lockUpdateDictionaryWithContext.RLock() - calls = mock.calls.UpdateDictionaryWithContext - mock.lockUpdateDictionaryWithContext.RUnlock() - return calls -} - -// UpdateDisplayedAttributes calls UpdateDisplayedAttributesFunc. -func (mock *MeiliIndexManager) UpdateDisplayedAttributes(request *[]string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request *[]string - }{ - Request: request, - } - mock.lockUpdateDisplayedAttributes.Lock() - mock.calls.UpdateDisplayedAttributes = append(mock.calls.UpdateDisplayedAttributes, callInfo) - mock.lockUpdateDisplayedAttributes.Unlock() - if mock.UpdateDisplayedAttributesFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateDisplayedAttributesFunc(request) -} - -// UpdateDisplayedAttributesCalls gets all the calls that were made to UpdateDisplayedAttributes. -// Check the length with: -// -// len(mockedIndexManager.UpdateDisplayedAttributesCalls()) -func (mock *MeiliIndexManager) UpdateDisplayedAttributesCalls() []struct { - Request *[]string -} { - var calls []struct { - Request *[]string - } - mock.lockUpdateDisplayedAttributes.RLock() - calls = mock.calls.UpdateDisplayedAttributes - mock.lockUpdateDisplayedAttributes.RUnlock() - return calls -} - -// UpdateDisplayedAttributesWithContext calls UpdateDisplayedAttributesWithContextFunc. -func (mock *MeiliIndexManager) UpdateDisplayedAttributesWithContext(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request *[]string - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateDisplayedAttributesWithContext.Lock() - mock.calls.UpdateDisplayedAttributesWithContext = append(mock.calls.UpdateDisplayedAttributesWithContext, callInfo) - mock.lockUpdateDisplayedAttributesWithContext.Unlock() - if mock.UpdateDisplayedAttributesWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateDisplayedAttributesWithContextFunc(ctx, request) -} - -// UpdateDisplayedAttributesWithContextCalls gets all the calls that were made to UpdateDisplayedAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateDisplayedAttributesWithContextCalls()) -func (mock *MeiliIndexManager) UpdateDisplayedAttributesWithContextCalls() []struct { - Ctx context.Context - Request *[]string -} { - var calls []struct { - Ctx context.Context - Request *[]string - } - mock.lockUpdateDisplayedAttributesWithContext.RLock() - calls = mock.calls.UpdateDisplayedAttributesWithContext - mock.lockUpdateDisplayedAttributesWithContext.RUnlock() - return calls -} - -// UpdateDistinctAttribute calls UpdateDistinctAttributeFunc. -func (mock *MeiliIndexManager) UpdateDistinctAttribute(request string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request string - }{ - Request: request, - } - mock.lockUpdateDistinctAttribute.Lock() - mock.calls.UpdateDistinctAttribute = append(mock.calls.UpdateDistinctAttribute, callInfo) - mock.lockUpdateDistinctAttribute.Unlock() - if mock.UpdateDistinctAttributeFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateDistinctAttributeFunc(request) -} - -// UpdateDistinctAttributeCalls gets all the calls that were made to UpdateDistinctAttribute. -// Check the length with: -// -// len(mockedIndexManager.UpdateDistinctAttributeCalls()) -func (mock *MeiliIndexManager) UpdateDistinctAttributeCalls() []struct { - Request string -} { - var calls []struct { - Request string - } - mock.lockUpdateDistinctAttribute.RLock() - calls = mock.calls.UpdateDistinctAttribute - mock.lockUpdateDistinctAttribute.RUnlock() - return calls -} - -// UpdateDistinctAttributeWithContext calls UpdateDistinctAttributeWithContextFunc. -func (mock *MeiliIndexManager) UpdateDistinctAttributeWithContext(ctx context.Context, request string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request string - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateDistinctAttributeWithContext.Lock() - mock.calls.UpdateDistinctAttributeWithContext = append(mock.calls.UpdateDistinctAttributeWithContext, callInfo) - mock.lockUpdateDistinctAttributeWithContext.Unlock() - if mock.UpdateDistinctAttributeWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateDistinctAttributeWithContextFunc(ctx, request) -} - -// UpdateDistinctAttributeWithContextCalls gets all the calls that were made to UpdateDistinctAttributeWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateDistinctAttributeWithContextCalls()) -func (mock *MeiliIndexManager) UpdateDistinctAttributeWithContextCalls() []struct { - Ctx context.Context - Request string -} { - var calls []struct { - Ctx context.Context - Request string - } - mock.lockUpdateDistinctAttributeWithContext.RLock() - calls = mock.calls.UpdateDistinctAttributeWithContext - mock.lockUpdateDistinctAttributeWithContext.RUnlock() - return calls -} - -// UpdateDocuments calls UpdateDocumentsFunc. -func (mock *MeiliIndexManager) UpdateDocuments(documentsPtr interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - DocumentsPtr interface{} - Opts *meilisearch.DocumentOptions - }{ - DocumentsPtr: documentsPtr, - Opts: opts, - } - mock.lockUpdateDocuments.Lock() - mock.calls.UpdateDocuments = append(mock.calls.UpdateDocuments, callInfo) - mock.lockUpdateDocuments.Unlock() - if mock.UpdateDocumentsFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateDocumentsFunc(documentsPtr, opts) -} - -// UpdateDocumentsCalls gets all the calls that were made to UpdateDocuments. -// Check the length with: -// -// len(mockedIndexManager.UpdateDocumentsCalls()) -func (mock *MeiliIndexManager) UpdateDocumentsCalls() []struct { - DocumentsPtr interface{} - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - DocumentsPtr interface{} - Opts *meilisearch.DocumentOptions - } - mock.lockUpdateDocuments.RLock() - calls = mock.calls.UpdateDocuments - mock.lockUpdateDocuments.RUnlock() - return calls -} - -// UpdateDocumentsByFunction calls UpdateDocumentsByFunctionFunc. -func (mock *MeiliIndexManager) UpdateDocumentsByFunction(req *meilisearch.UpdateDocumentByFunctionRequest) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Req *meilisearch.UpdateDocumentByFunctionRequest - }{ - Req: req, - } - mock.lockUpdateDocumentsByFunction.Lock() - mock.calls.UpdateDocumentsByFunction = append(mock.calls.UpdateDocumentsByFunction, callInfo) - mock.lockUpdateDocumentsByFunction.Unlock() - if mock.UpdateDocumentsByFunctionFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateDocumentsByFunctionFunc(req) -} - -// UpdateDocumentsByFunctionCalls gets all the calls that were made to UpdateDocumentsByFunction. -// Check the length with: -// -// len(mockedIndexManager.UpdateDocumentsByFunctionCalls()) -func (mock *MeiliIndexManager) UpdateDocumentsByFunctionCalls() []struct { - Req *meilisearch.UpdateDocumentByFunctionRequest -} { - var calls []struct { - Req *meilisearch.UpdateDocumentByFunctionRequest - } - mock.lockUpdateDocumentsByFunction.RLock() - calls = mock.calls.UpdateDocumentsByFunction - mock.lockUpdateDocumentsByFunction.RUnlock() - return calls -} - -// UpdateDocumentsByFunctionWithContext calls UpdateDocumentsByFunctionWithContextFunc. -func (mock *MeiliIndexManager) UpdateDocumentsByFunctionWithContext(ctx context.Context, req *meilisearch.UpdateDocumentByFunctionRequest) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Req *meilisearch.UpdateDocumentByFunctionRequest - }{ - Ctx: ctx, - Req: req, - } - mock.lockUpdateDocumentsByFunctionWithContext.Lock() - mock.calls.UpdateDocumentsByFunctionWithContext = append(mock.calls.UpdateDocumentsByFunctionWithContext, callInfo) - mock.lockUpdateDocumentsByFunctionWithContext.Unlock() - if mock.UpdateDocumentsByFunctionWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateDocumentsByFunctionWithContextFunc(ctx, req) -} - -// UpdateDocumentsByFunctionWithContextCalls gets all the calls that were made to UpdateDocumentsByFunctionWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateDocumentsByFunctionWithContextCalls()) -func (mock *MeiliIndexManager) UpdateDocumentsByFunctionWithContextCalls() []struct { - Ctx context.Context - Req *meilisearch.UpdateDocumentByFunctionRequest -} { - var calls []struct { - Ctx context.Context - Req *meilisearch.UpdateDocumentByFunctionRequest - } - mock.lockUpdateDocumentsByFunctionWithContext.RLock() - calls = mock.calls.UpdateDocumentsByFunctionWithContext - mock.lockUpdateDocumentsByFunctionWithContext.RUnlock() - return calls -} - -// UpdateDocumentsCsv calls UpdateDocumentsCsvFunc. -func (mock *MeiliIndexManager) UpdateDocumentsCsv(documents []byte, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Documents []byte - Options *meilisearch.CsvDocumentsQuery - }{ - Documents: documents, - Options: options, - } - mock.lockUpdateDocumentsCsv.Lock() - mock.calls.UpdateDocumentsCsv = append(mock.calls.UpdateDocumentsCsv, callInfo) - mock.lockUpdateDocumentsCsv.Unlock() - if mock.UpdateDocumentsCsvFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateDocumentsCsvFunc(documents, options) -} - -// UpdateDocumentsCsvCalls gets all the calls that were made to UpdateDocumentsCsv. -// Check the length with: -// -// len(mockedIndexManager.UpdateDocumentsCsvCalls()) -func (mock *MeiliIndexManager) UpdateDocumentsCsvCalls() []struct { - Documents []byte - Options *meilisearch.CsvDocumentsQuery -} { - var calls []struct { - Documents []byte - Options *meilisearch.CsvDocumentsQuery - } - mock.lockUpdateDocumentsCsv.RLock() - calls = mock.calls.UpdateDocumentsCsv - mock.lockUpdateDocumentsCsv.RUnlock() - return calls -} - -// UpdateDocumentsCsvInBatches calls UpdateDocumentsCsvInBatchesFunc. -func (mock *MeiliIndexManager) UpdateDocumentsCsvInBatches(documents []byte, batchsize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - Documents []byte - Batchsize int - Options *meilisearch.CsvDocumentsQuery - }{ - Documents: documents, - Batchsize: batchsize, - Options: options, - } - mock.lockUpdateDocumentsCsvInBatches.Lock() - mock.calls.UpdateDocumentsCsvInBatches = append(mock.calls.UpdateDocumentsCsvInBatches, callInfo) - mock.lockUpdateDocumentsCsvInBatches.Unlock() - if mock.UpdateDocumentsCsvInBatchesFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.UpdateDocumentsCsvInBatchesFunc(documents, batchsize, options) -} - -// UpdateDocumentsCsvInBatchesCalls gets all the calls that were made to UpdateDocumentsCsvInBatches. -// Check the length with: -// -// len(mockedIndexManager.UpdateDocumentsCsvInBatchesCalls()) -func (mock *MeiliIndexManager) UpdateDocumentsCsvInBatchesCalls() []struct { - Documents []byte - Batchsize int - Options *meilisearch.CsvDocumentsQuery -} { - var calls []struct { - Documents []byte - Batchsize int - Options *meilisearch.CsvDocumentsQuery - } - mock.lockUpdateDocumentsCsvInBatches.RLock() - calls = mock.calls.UpdateDocumentsCsvInBatches - mock.lockUpdateDocumentsCsvInBatches.RUnlock() - return calls -} - -// UpdateDocumentsCsvInBatchesWithContext calls UpdateDocumentsCsvInBatchesWithContextFunc. -func (mock *MeiliIndexManager) UpdateDocumentsCsvInBatchesWithContext(ctx context.Context, documents []byte, batchsize int, options *meilisearch.CsvDocumentsQuery) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Documents []byte - Batchsize int - Options *meilisearch.CsvDocumentsQuery - }{ - Ctx: ctx, - Documents: documents, - Batchsize: batchsize, - Options: options, - } - mock.lockUpdateDocumentsCsvInBatchesWithContext.Lock() - mock.calls.UpdateDocumentsCsvInBatchesWithContext = append(mock.calls.UpdateDocumentsCsvInBatchesWithContext, callInfo) - mock.lockUpdateDocumentsCsvInBatchesWithContext.Unlock() - if mock.UpdateDocumentsCsvInBatchesWithContextFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.UpdateDocumentsCsvInBatchesWithContextFunc(ctx, documents, batchsize, options) -} - -// UpdateDocumentsCsvInBatchesWithContextCalls gets all the calls that were made to UpdateDocumentsCsvInBatchesWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateDocumentsCsvInBatchesWithContextCalls()) -func (mock *MeiliIndexManager) UpdateDocumentsCsvInBatchesWithContextCalls() []struct { - Ctx context.Context - Documents []byte - Batchsize int - Options *meilisearch.CsvDocumentsQuery -} { - var calls []struct { - Ctx context.Context - Documents []byte - Batchsize int - Options *meilisearch.CsvDocumentsQuery - } - mock.lockUpdateDocumentsCsvInBatchesWithContext.RLock() - calls = mock.calls.UpdateDocumentsCsvInBatchesWithContext - mock.lockUpdateDocumentsCsvInBatchesWithContext.RUnlock() - return calls -} - -// UpdateDocumentsCsvWithContext calls UpdateDocumentsCsvWithContextFunc. -func (mock *MeiliIndexManager) UpdateDocumentsCsvWithContext(ctx context.Context, documents []byte, options *meilisearch.CsvDocumentsQuery) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Documents []byte - Options *meilisearch.CsvDocumentsQuery - }{ - Ctx: ctx, - Documents: documents, - Options: options, - } - mock.lockUpdateDocumentsCsvWithContext.Lock() - mock.calls.UpdateDocumentsCsvWithContext = append(mock.calls.UpdateDocumentsCsvWithContext, callInfo) - mock.lockUpdateDocumentsCsvWithContext.Unlock() - if mock.UpdateDocumentsCsvWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateDocumentsCsvWithContextFunc(ctx, documents, options) -} - -// UpdateDocumentsCsvWithContextCalls gets all the calls that were made to UpdateDocumentsCsvWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateDocumentsCsvWithContextCalls()) -func (mock *MeiliIndexManager) UpdateDocumentsCsvWithContextCalls() []struct { - Ctx context.Context - Documents []byte - Options *meilisearch.CsvDocumentsQuery -} { - var calls []struct { - Ctx context.Context - Documents []byte - Options *meilisearch.CsvDocumentsQuery - } - mock.lockUpdateDocumentsCsvWithContext.RLock() - calls = mock.calls.UpdateDocumentsCsvWithContext - mock.lockUpdateDocumentsCsvWithContext.RUnlock() - return calls -} - -// UpdateDocumentsInBatches calls UpdateDocumentsInBatchesFunc. -func (mock *MeiliIndexManager) UpdateDocumentsInBatches(documentsPtr interface{}, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - DocumentsPtr interface{} - BatchSize int - Opts *meilisearch.DocumentOptions - }{ - DocumentsPtr: documentsPtr, - BatchSize: batchSize, - Opts: opts, - } - mock.lockUpdateDocumentsInBatches.Lock() - mock.calls.UpdateDocumentsInBatches = append(mock.calls.UpdateDocumentsInBatches, callInfo) - mock.lockUpdateDocumentsInBatches.Unlock() - if mock.UpdateDocumentsInBatchesFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.UpdateDocumentsInBatchesFunc(documentsPtr, batchSize, opts) -} - -// UpdateDocumentsInBatchesCalls gets all the calls that were made to UpdateDocumentsInBatches. -// Check the length with: -// -// len(mockedIndexManager.UpdateDocumentsInBatchesCalls()) -func (mock *MeiliIndexManager) UpdateDocumentsInBatchesCalls() []struct { - DocumentsPtr interface{} - BatchSize int - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - DocumentsPtr interface{} - BatchSize int - Opts *meilisearch.DocumentOptions - } - mock.lockUpdateDocumentsInBatches.RLock() - calls = mock.calls.UpdateDocumentsInBatches - mock.lockUpdateDocumentsInBatches.RUnlock() - return calls -} - -// UpdateDocumentsInBatchesWithContext calls UpdateDocumentsInBatchesWithContextFunc. -func (mock *MeiliIndexManager) UpdateDocumentsInBatchesWithContext(ctx context.Context, documentsPtr interface{}, batchSize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - DocumentsPtr interface{} - BatchSize int - Opts *meilisearch.DocumentOptions - }{ - Ctx: ctx, - DocumentsPtr: documentsPtr, - BatchSize: batchSize, - Opts: opts, - } - mock.lockUpdateDocumentsInBatchesWithContext.Lock() - mock.calls.UpdateDocumentsInBatchesWithContext = append(mock.calls.UpdateDocumentsInBatchesWithContext, callInfo) - mock.lockUpdateDocumentsInBatchesWithContext.Unlock() - if mock.UpdateDocumentsInBatchesWithContextFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.UpdateDocumentsInBatchesWithContextFunc(ctx, documentsPtr, batchSize, opts) -} - -// UpdateDocumentsInBatchesWithContextCalls gets all the calls that were made to UpdateDocumentsInBatchesWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateDocumentsInBatchesWithContextCalls()) -func (mock *MeiliIndexManager) UpdateDocumentsInBatchesWithContextCalls() []struct { - Ctx context.Context - DocumentsPtr interface{} - BatchSize int - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Ctx context.Context - DocumentsPtr interface{} - BatchSize int - Opts *meilisearch.DocumentOptions - } - mock.lockUpdateDocumentsInBatchesWithContext.RLock() - calls = mock.calls.UpdateDocumentsInBatchesWithContext - mock.lockUpdateDocumentsInBatchesWithContext.RUnlock() - return calls -} - -// UpdateDocumentsNdjson calls UpdateDocumentsNdjsonFunc. -func (mock *MeiliIndexManager) UpdateDocumentsNdjson(documents []byte, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Documents []byte - Opts *meilisearch.DocumentOptions - }{ - Documents: documents, - Opts: opts, - } - mock.lockUpdateDocumentsNdjson.Lock() - mock.calls.UpdateDocumentsNdjson = append(mock.calls.UpdateDocumentsNdjson, callInfo) - mock.lockUpdateDocumentsNdjson.Unlock() - if mock.UpdateDocumentsNdjsonFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateDocumentsNdjsonFunc(documents, opts) -} - -// UpdateDocumentsNdjsonCalls gets all the calls that were made to UpdateDocumentsNdjson. -// Check the length with: -// -// len(mockedIndexManager.UpdateDocumentsNdjsonCalls()) -func (mock *MeiliIndexManager) UpdateDocumentsNdjsonCalls() []struct { - Documents []byte - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Documents []byte - Opts *meilisearch.DocumentOptions - } - mock.lockUpdateDocumentsNdjson.RLock() - calls = mock.calls.UpdateDocumentsNdjson - mock.lockUpdateDocumentsNdjson.RUnlock() - return calls -} - -// UpdateDocumentsNdjsonInBatches calls UpdateDocumentsNdjsonInBatchesFunc. -func (mock *MeiliIndexManager) UpdateDocumentsNdjsonInBatches(documents []byte, batchsize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - Documents []byte - Batchsize int - Opts *meilisearch.DocumentOptions - }{ - Documents: documents, - Batchsize: batchsize, - Opts: opts, - } - mock.lockUpdateDocumentsNdjsonInBatches.Lock() - mock.calls.UpdateDocumentsNdjsonInBatches = append(mock.calls.UpdateDocumentsNdjsonInBatches, callInfo) - mock.lockUpdateDocumentsNdjsonInBatches.Unlock() - if mock.UpdateDocumentsNdjsonInBatchesFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.UpdateDocumentsNdjsonInBatchesFunc(documents, batchsize, opts) -} - -// UpdateDocumentsNdjsonInBatchesCalls gets all the calls that were made to UpdateDocumentsNdjsonInBatches. -// Check the length with: -// -// len(mockedIndexManager.UpdateDocumentsNdjsonInBatchesCalls()) -func (mock *MeiliIndexManager) UpdateDocumentsNdjsonInBatchesCalls() []struct { - Documents []byte - Batchsize int - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Documents []byte - Batchsize int - Opts *meilisearch.DocumentOptions - } - mock.lockUpdateDocumentsNdjsonInBatches.RLock() - calls = mock.calls.UpdateDocumentsNdjsonInBatches - mock.lockUpdateDocumentsNdjsonInBatches.RUnlock() - return calls -} - -// UpdateDocumentsNdjsonInBatchesWithContext calls UpdateDocumentsNdjsonInBatchesWithContextFunc. -func (mock *MeiliIndexManager) UpdateDocumentsNdjsonInBatchesWithContext(ctx context.Context, documents []byte, batchsize int, opts *meilisearch.DocumentOptions) ([]meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Documents []byte - Batchsize int - Opts *meilisearch.DocumentOptions - }{ - Ctx: ctx, - Documents: documents, - Batchsize: batchsize, - Opts: opts, - } - mock.lockUpdateDocumentsNdjsonInBatchesWithContext.Lock() - mock.calls.UpdateDocumentsNdjsonInBatchesWithContext = append(mock.calls.UpdateDocumentsNdjsonInBatchesWithContext, callInfo) - mock.lockUpdateDocumentsNdjsonInBatchesWithContext.Unlock() - if mock.UpdateDocumentsNdjsonInBatchesWithContextFunc == nil { - var ( - taskInfosOut []meilisearch.TaskInfo - errOut error - ) - return taskInfosOut, errOut - } - return mock.UpdateDocumentsNdjsonInBatchesWithContextFunc(ctx, documents, batchsize, opts) -} - -// UpdateDocumentsNdjsonInBatchesWithContextCalls gets all the calls that were made to UpdateDocumentsNdjsonInBatchesWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateDocumentsNdjsonInBatchesWithContextCalls()) -func (mock *MeiliIndexManager) UpdateDocumentsNdjsonInBatchesWithContextCalls() []struct { - Ctx context.Context - Documents []byte - Batchsize int - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Ctx context.Context - Documents []byte - Batchsize int - Opts *meilisearch.DocumentOptions - } - mock.lockUpdateDocumentsNdjsonInBatchesWithContext.RLock() - calls = mock.calls.UpdateDocumentsNdjsonInBatchesWithContext - mock.lockUpdateDocumentsNdjsonInBatchesWithContext.RUnlock() - return calls -} - -// UpdateDocumentsNdjsonWithContext calls UpdateDocumentsNdjsonWithContextFunc. -func (mock *MeiliIndexManager) UpdateDocumentsNdjsonWithContext(ctx context.Context, documents []byte, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Documents []byte - Opts *meilisearch.DocumentOptions - }{ - Ctx: ctx, - Documents: documents, - Opts: opts, - } - mock.lockUpdateDocumentsNdjsonWithContext.Lock() - mock.calls.UpdateDocumentsNdjsonWithContext = append(mock.calls.UpdateDocumentsNdjsonWithContext, callInfo) - mock.lockUpdateDocumentsNdjsonWithContext.Unlock() - if mock.UpdateDocumentsNdjsonWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateDocumentsNdjsonWithContextFunc(ctx, documents, opts) -} - -// UpdateDocumentsNdjsonWithContextCalls gets all the calls that were made to UpdateDocumentsNdjsonWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateDocumentsNdjsonWithContextCalls()) -func (mock *MeiliIndexManager) UpdateDocumentsNdjsonWithContextCalls() []struct { - Ctx context.Context - Documents []byte - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Ctx context.Context - Documents []byte - Opts *meilisearch.DocumentOptions - } - mock.lockUpdateDocumentsNdjsonWithContext.RLock() - calls = mock.calls.UpdateDocumentsNdjsonWithContext - mock.lockUpdateDocumentsNdjsonWithContext.RUnlock() - return calls -} - -// UpdateDocumentsWithContext calls UpdateDocumentsWithContextFunc. -func (mock *MeiliIndexManager) UpdateDocumentsWithContext(ctx context.Context, documentsPtr interface{}, opts *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - DocumentsPtr interface{} - Opts *meilisearch.DocumentOptions - }{ - Ctx: ctx, - DocumentsPtr: documentsPtr, - Opts: opts, - } - mock.lockUpdateDocumentsWithContext.Lock() - mock.calls.UpdateDocumentsWithContext = append(mock.calls.UpdateDocumentsWithContext, callInfo) - mock.lockUpdateDocumentsWithContext.Unlock() - if mock.UpdateDocumentsWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateDocumentsWithContextFunc(ctx, documentsPtr, opts) -} - -// UpdateDocumentsWithContextCalls gets all the calls that were made to UpdateDocumentsWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateDocumentsWithContextCalls()) -func (mock *MeiliIndexManager) UpdateDocumentsWithContextCalls() []struct { - Ctx context.Context - DocumentsPtr interface{} - Opts *meilisearch.DocumentOptions -} { - var calls []struct { - Ctx context.Context - DocumentsPtr interface{} - Opts *meilisearch.DocumentOptions - } - mock.lockUpdateDocumentsWithContext.RLock() - calls = mock.calls.UpdateDocumentsWithContext - mock.lockUpdateDocumentsWithContext.RUnlock() - return calls -} - -// UpdateEmbedders calls UpdateEmbeddersFunc. -func (mock *MeiliIndexManager) UpdateEmbedders(request map[string]meilisearch.Embedder) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request map[string]meilisearch.Embedder - }{ - Request: request, - } - mock.lockUpdateEmbedders.Lock() - mock.calls.UpdateEmbedders = append(mock.calls.UpdateEmbedders, callInfo) - mock.lockUpdateEmbedders.Unlock() - if mock.UpdateEmbeddersFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateEmbeddersFunc(request) -} - -// UpdateEmbeddersCalls gets all the calls that were made to UpdateEmbedders. -// Check the length with: -// -// len(mockedIndexManager.UpdateEmbeddersCalls()) -func (mock *MeiliIndexManager) UpdateEmbeddersCalls() []struct { - Request map[string]meilisearch.Embedder -} { - var calls []struct { - Request map[string]meilisearch.Embedder - } - mock.lockUpdateEmbedders.RLock() - calls = mock.calls.UpdateEmbedders - mock.lockUpdateEmbedders.RUnlock() - return calls -} - -// UpdateEmbeddersWithContext calls UpdateEmbeddersWithContextFunc. -func (mock *MeiliIndexManager) UpdateEmbeddersWithContext(ctx context.Context, request map[string]meilisearch.Embedder) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request map[string]meilisearch.Embedder - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateEmbeddersWithContext.Lock() - mock.calls.UpdateEmbeddersWithContext = append(mock.calls.UpdateEmbeddersWithContext, callInfo) - mock.lockUpdateEmbeddersWithContext.Unlock() - if mock.UpdateEmbeddersWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateEmbeddersWithContextFunc(ctx, request) -} - -// UpdateEmbeddersWithContextCalls gets all the calls that were made to UpdateEmbeddersWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateEmbeddersWithContextCalls()) -func (mock *MeiliIndexManager) UpdateEmbeddersWithContextCalls() []struct { - Ctx context.Context - Request map[string]meilisearch.Embedder -} { - var calls []struct { - Ctx context.Context - Request map[string]meilisearch.Embedder - } - mock.lockUpdateEmbeddersWithContext.RLock() - calls = mock.calls.UpdateEmbeddersWithContext - mock.lockUpdateEmbeddersWithContext.RUnlock() - return calls -} - -// UpdateFacetSearch calls UpdateFacetSearchFunc. -func (mock *MeiliIndexManager) UpdateFacetSearch(request bool) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request bool - }{ - Request: request, - } - mock.lockUpdateFacetSearch.Lock() - mock.calls.UpdateFacetSearch = append(mock.calls.UpdateFacetSearch, callInfo) - mock.lockUpdateFacetSearch.Unlock() - if mock.UpdateFacetSearchFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateFacetSearchFunc(request) -} - -// UpdateFacetSearchCalls gets all the calls that were made to UpdateFacetSearch. -// Check the length with: -// -// len(mockedIndexManager.UpdateFacetSearchCalls()) -func (mock *MeiliIndexManager) UpdateFacetSearchCalls() []struct { - Request bool -} { - var calls []struct { - Request bool - } - mock.lockUpdateFacetSearch.RLock() - calls = mock.calls.UpdateFacetSearch - mock.lockUpdateFacetSearch.RUnlock() - return calls -} - -// UpdateFacetSearchWithContext calls UpdateFacetSearchWithContextFunc. -func (mock *MeiliIndexManager) UpdateFacetSearchWithContext(ctx context.Context, request bool) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request bool - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateFacetSearchWithContext.Lock() - mock.calls.UpdateFacetSearchWithContext = append(mock.calls.UpdateFacetSearchWithContext, callInfo) - mock.lockUpdateFacetSearchWithContext.Unlock() - if mock.UpdateFacetSearchWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateFacetSearchWithContextFunc(ctx, request) -} - -// UpdateFacetSearchWithContextCalls gets all the calls that were made to UpdateFacetSearchWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateFacetSearchWithContextCalls()) -func (mock *MeiliIndexManager) UpdateFacetSearchWithContextCalls() []struct { - Ctx context.Context - Request bool -} { - var calls []struct { - Ctx context.Context - Request bool - } - mock.lockUpdateFacetSearchWithContext.RLock() - calls = mock.calls.UpdateFacetSearchWithContext - mock.lockUpdateFacetSearchWithContext.RUnlock() - return calls -} - -// UpdateFaceting calls UpdateFacetingFunc. -func (mock *MeiliIndexManager) UpdateFaceting(request *meilisearch.Faceting) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request *meilisearch.Faceting - }{ - Request: request, - } - mock.lockUpdateFaceting.Lock() - mock.calls.UpdateFaceting = append(mock.calls.UpdateFaceting, callInfo) - mock.lockUpdateFaceting.Unlock() - if mock.UpdateFacetingFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateFacetingFunc(request) -} - -// UpdateFacetingCalls gets all the calls that were made to UpdateFaceting. -// Check the length with: -// -// len(mockedIndexManager.UpdateFacetingCalls()) -func (mock *MeiliIndexManager) UpdateFacetingCalls() []struct { - Request *meilisearch.Faceting -} { - var calls []struct { - Request *meilisearch.Faceting - } - mock.lockUpdateFaceting.RLock() - calls = mock.calls.UpdateFaceting - mock.lockUpdateFaceting.RUnlock() - return calls -} - -// UpdateFacetingWithContext calls UpdateFacetingWithContextFunc. -func (mock *MeiliIndexManager) UpdateFacetingWithContext(ctx context.Context, request *meilisearch.Faceting) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request *meilisearch.Faceting - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateFacetingWithContext.Lock() - mock.calls.UpdateFacetingWithContext = append(mock.calls.UpdateFacetingWithContext, callInfo) - mock.lockUpdateFacetingWithContext.Unlock() - if mock.UpdateFacetingWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateFacetingWithContextFunc(ctx, request) -} - -// UpdateFacetingWithContextCalls gets all the calls that were made to UpdateFacetingWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateFacetingWithContextCalls()) -func (mock *MeiliIndexManager) UpdateFacetingWithContextCalls() []struct { - Ctx context.Context - Request *meilisearch.Faceting -} { - var calls []struct { - Ctx context.Context - Request *meilisearch.Faceting - } - mock.lockUpdateFacetingWithContext.RLock() - calls = mock.calls.UpdateFacetingWithContext - mock.lockUpdateFacetingWithContext.RUnlock() - return calls -} - -// UpdateFilterableAttributes calls UpdateFilterableAttributesFunc. -func (mock *MeiliIndexManager) UpdateFilterableAttributes(request *[]interface{}) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request *[]interface{} - }{ - Request: request, - } - mock.lockUpdateFilterableAttributes.Lock() - mock.calls.UpdateFilterableAttributes = append(mock.calls.UpdateFilterableAttributes, callInfo) - mock.lockUpdateFilterableAttributes.Unlock() - if mock.UpdateFilterableAttributesFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateFilterableAttributesFunc(request) -} - -// UpdateFilterableAttributesCalls gets all the calls that were made to UpdateFilterableAttributes. -// Check the length with: -// -// len(mockedIndexManager.UpdateFilterableAttributesCalls()) -func (mock *MeiliIndexManager) UpdateFilterableAttributesCalls() []struct { - Request *[]interface{} -} { - var calls []struct { - Request *[]interface{} - } - mock.lockUpdateFilterableAttributes.RLock() - calls = mock.calls.UpdateFilterableAttributes - mock.lockUpdateFilterableAttributes.RUnlock() - return calls -} - -// UpdateFilterableAttributesWithContext calls UpdateFilterableAttributesWithContextFunc. -func (mock *MeiliIndexManager) UpdateFilterableAttributesWithContext(ctx context.Context, request *[]interface{}) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request *[]interface{} - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateFilterableAttributesWithContext.Lock() - mock.calls.UpdateFilterableAttributesWithContext = append(mock.calls.UpdateFilterableAttributesWithContext, callInfo) - mock.lockUpdateFilterableAttributesWithContext.Unlock() - if mock.UpdateFilterableAttributesWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateFilterableAttributesWithContextFunc(ctx, request) -} - -// UpdateFilterableAttributesWithContextCalls gets all the calls that were made to UpdateFilterableAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateFilterableAttributesWithContextCalls()) -func (mock *MeiliIndexManager) UpdateFilterableAttributesWithContextCalls() []struct { - Ctx context.Context - Request *[]interface{} -} { - var calls []struct { - Ctx context.Context - Request *[]interface{} - } - mock.lockUpdateFilterableAttributesWithContext.RLock() - calls = mock.calls.UpdateFilterableAttributesWithContext - mock.lockUpdateFilterableAttributesWithContext.RUnlock() - return calls -} - -// UpdateIndex calls UpdateIndexFunc. -func (mock *MeiliIndexManager) UpdateIndex(params *meilisearch.UpdateIndexRequestParams) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Params *meilisearch.UpdateIndexRequestParams - }{ - Params: params, - } - mock.lockUpdateIndex.Lock() - mock.calls.UpdateIndex = append(mock.calls.UpdateIndex, callInfo) - mock.lockUpdateIndex.Unlock() - if mock.UpdateIndexFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateIndexFunc(params) -} - -// UpdateIndexCalls gets all the calls that were made to UpdateIndex. -// Check the length with: -// -// len(mockedIndexManager.UpdateIndexCalls()) -func (mock *MeiliIndexManager) UpdateIndexCalls() []struct { - Params *meilisearch.UpdateIndexRequestParams -} { - var calls []struct { - Params *meilisearch.UpdateIndexRequestParams - } - mock.lockUpdateIndex.RLock() - calls = mock.calls.UpdateIndex - mock.lockUpdateIndex.RUnlock() - return calls -} - -// UpdateIndexWithContext calls UpdateIndexWithContextFunc. -func (mock *MeiliIndexManager) UpdateIndexWithContext(ctx context.Context, params *meilisearch.UpdateIndexRequestParams) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Params *meilisearch.UpdateIndexRequestParams - }{ - Ctx: ctx, - Params: params, - } - mock.lockUpdateIndexWithContext.Lock() - mock.calls.UpdateIndexWithContext = append(mock.calls.UpdateIndexWithContext, callInfo) - mock.lockUpdateIndexWithContext.Unlock() - if mock.UpdateIndexWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateIndexWithContextFunc(ctx, params) -} - -// UpdateIndexWithContextCalls gets all the calls that were made to UpdateIndexWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateIndexWithContextCalls()) -func (mock *MeiliIndexManager) UpdateIndexWithContextCalls() []struct { - Ctx context.Context - Params *meilisearch.UpdateIndexRequestParams -} { - var calls []struct { - Ctx context.Context - Params *meilisearch.UpdateIndexRequestParams - } - mock.lockUpdateIndexWithContext.RLock() - calls = mock.calls.UpdateIndexWithContext - mock.lockUpdateIndexWithContext.RUnlock() - return calls -} - -// UpdateLocalizedAttributes calls UpdateLocalizedAttributesFunc. -func (mock *MeiliIndexManager) UpdateLocalizedAttributes(request []*meilisearch.LocalizedAttributes) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request []*meilisearch.LocalizedAttributes - }{ - Request: request, - } - mock.lockUpdateLocalizedAttributes.Lock() - mock.calls.UpdateLocalizedAttributes = append(mock.calls.UpdateLocalizedAttributes, callInfo) - mock.lockUpdateLocalizedAttributes.Unlock() - if mock.UpdateLocalizedAttributesFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateLocalizedAttributesFunc(request) -} - -// UpdateLocalizedAttributesCalls gets all the calls that were made to UpdateLocalizedAttributes. -// Check the length with: -// -// len(mockedIndexManager.UpdateLocalizedAttributesCalls()) -func (mock *MeiliIndexManager) UpdateLocalizedAttributesCalls() []struct { - Request []*meilisearch.LocalizedAttributes -} { - var calls []struct { - Request []*meilisearch.LocalizedAttributes - } - mock.lockUpdateLocalizedAttributes.RLock() - calls = mock.calls.UpdateLocalizedAttributes - mock.lockUpdateLocalizedAttributes.RUnlock() - return calls -} - -// UpdateLocalizedAttributesWithContext calls UpdateLocalizedAttributesWithContextFunc. -func (mock *MeiliIndexManager) UpdateLocalizedAttributesWithContext(ctx context.Context, request []*meilisearch.LocalizedAttributes) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request []*meilisearch.LocalizedAttributes - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateLocalizedAttributesWithContext.Lock() - mock.calls.UpdateLocalizedAttributesWithContext = append(mock.calls.UpdateLocalizedAttributesWithContext, callInfo) - mock.lockUpdateLocalizedAttributesWithContext.Unlock() - if mock.UpdateLocalizedAttributesWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateLocalizedAttributesWithContextFunc(ctx, request) -} - -// UpdateLocalizedAttributesWithContextCalls gets all the calls that were made to UpdateLocalizedAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateLocalizedAttributesWithContextCalls()) -func (mock *MeiliIndexManager) UpdateLocalizedAttributesWithContextCalls() []struct { - Ctx context.Context - Request []*meilisearch.LocalizedAttributes -} { - var calls []struct { - Ctx context.Context - Request []*meilisearch.LocalizedAttributes - } - mock.lockUpdateLocalizedAttributesWithContext.RLock() - calls = mock.calls.UpdateLocalizedAttributesWithContext - mock.lockUpdateLocalizedAttributesWithContext.RUnlock() - return calls -} - -// UpdateNonSeparatorTokens calls UpdateNonSeparatorTokensFunc. -func (mock *MeiliIndexManager) UpdateNonSeparatorTokens(tokens []string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Tokens []string - }{ - Tokens: tokens, - } - mock.lockUpdateNonSeparatorTokens.Lock() - mock.calls.UpdateNonSeparatorTokens = append(mock.calls.UpdateNonSeparatorTokens, callInfo) - mock.lockUpdateNonSeparatorTokens.Unlock() - if mock.UpdateNonSeparatorTokensFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateNonSeparatorTokensFunc(tokens) -} - -// UpdateNonSeparatorTokensCalls gets all the calls that were made to UpdateNonSeparatorTokens. -// Check the length with: -// -// len(mockedIndexManager.UpdateNonSeparatorTokensCalls()) -func (mock *MeiliIndexManager) UpdateNonSeparatorTokensCalls() []struct { - Tokens []string -} { - var calls []struct { - Tokens []string - } - mock.lockUpdateNonSeparatorTokens.RLock() - calls = mock.calls.UpdateNonSeparatorTokens - mock.lockUpdateNonSeparatorTokens.RUnlock() - return calls -} - -// UpdateNonSeparatorTokensWithContext calls UpdateNonSeparatorTokensWithContextFunc. -func (mock *MeiliIndexManager) UpdateNonSeparatorTokensWithContext(ctx context.Context, tokens []string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Tokens []string - }{ - Ctx: ctx, - Tokens: tokens, - } - mock.lockUpdateNonSeparatorTokensWithContext.Lock() - mock.calls.UpdateNonSeparatorTokensWithContext = append(mock.calls.UpdateNonSeparatorTokensWithContext, callInfo) - mock.lockUpdateNonSeparatorTokensWithContext.Unlock() - if mock.UpdateNonSeparatorTokensWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateNonSeparatorTokensWithContextFunc(ctx, tokens) -} - -// UpdateNonSeparatorTokensWithContextCalls gets all the calls that were made to UpdateNonSeparatorTokensWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateNonSeparatorTokensWithContextCalls()) -func (mock *MeiliIndexManager) UpdateNonSeparatorTokensWithContextCalls() []struct { - Ctx context.Context - Tokens []string -} { - var calls []struct { - Ctx context.Context - Tokens []string - } - mock.lockUpdateNonSeparatorTokensWithContext.RLock() - calls = mock.calls.UpdateNonSeparatorTokensWithContext - mock.lockUpdateNonSeparatorTokensWithContext.RUnlock() - return calls -} - -// UpdatePagination calls UpdatePaginationFunc. -func (mock *MeiliIndexManager) UpdatePagination(request *meilisearch.Pagination) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request *meilisearch.Pagination - }{ - Request: request, - } - mock.lockUpdatePagination.Lock() - mock.calls.UpdatePagination = append(mock.calls.UpdatePagination, callInfo) - mock.lockUpdatePagination.Unlock() - if mock.UpdatePaginationFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdatePaginationFunc(request) -} - -// UpdatePaginationCalls gets all the calls that were made to UpdatePagination. -// Check the length with: -// -// len(mockedIndexManager.UpdatePaginationCalls()) -func (mock *MeiliIndexManager) UpdatePaginationCalls() []struct { - Request *meilisearch.Pagination -} { - var calls []struct { - Request *meilisearch.Pagination - } - mock.lockUpdatePagination.RLock() - calls = mock.calls.UpdatePagination - mock.lockUpdatePagination.RUnlock() - return calls -} - -// UpdatePaginationWithContext calls UpdatePaginationWithContextFunc. -func (mock *MeiliIndexManager) UpdatePaginationWithContext(ctx context.Context, request *meilisearch.Pagination) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request *meilisearch.Pagination - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdatePaginationWithContext.Lock() - mock.calls.UpdatePaginationWithContext = append(mock.calls.UpdatePaginationWithContext, callInfo) - mock.lockUpdatePaginationWithContext.Unlock() - if mock.UpdatePaginationWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdatePaginationWithContextFunc(ctx, request) -} - -// UpdatePaginationWithContextCalls gets all the calls that were made to UpdatePaginationWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdatePaginationWithContextCalls()) -func (mock *MeiliIndexManager) UpdatePaginationWithContextCalls() []struct { - Ctx context.Context - Request *meilisearch.Pagination -} { - var calls []struct { - Ctx context.Context - Request *meilisearch.Pagination - } - mock.lockUpdatePaginationWithContext.RLock() - calls = mock.calls.UpdatePaginationWithContext - mock.lockUpdatePaginationWithContext.RUnlock() - return calls -} - -// UpdatePrefixSearch calls UpdatePrefixSearchFunc. -func (mock *MeiliIndexManager) UpdatePrefixSearch(request string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request string - }{ - Request: request, - } - mock.lockUpdatePrefixSearch.Lock() - mock.calls.UpdatePrefixSearch = append(mock.calls.UpdatePrefixSearch, callInfo) - mock.lockUpdatePrefixSearch.Unlock() - if mock.UpdatePrefixSearchFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdatePrefixSearchFunc(request) -} - -// UpdatePrefixSearchCalls gets all the calls that were made to UpdatePrefixSearch. -// Check the length with: -// -// len(mockedIndexManager.UpdatePrefixSearchCalls()) -func (mock *MeiliIndexManager) UpdatePrefixSearchCalls() []struct { - Request string -} { - var calls []struct { - Request string - } - mock.lockUpdatePrefixSearch.RLock() - calls = mock.calls.UpdatePrefixSearch - mock.lockUpdatePrefixSearch.RUnlock() - return calls -} - -// UpdatePrefixSearchWithContext calls UpdatePrefixSearchWithContextFunc. -func (mock *MeiliIndexManager) UpdatePrefixSearchWithContext(ctx context.Context, request string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request string - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdatePrefixSearchWithContext.Lock() - mock.calls.UpdatePrefixSearchWithContext = append(mock.calls.UpdatePrefixSearchWithContext, callInfo) - mock.lockUpdatePrefixSearchWithContext.Unlock() - if mock.UpdatePrefixSearchWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdatePrefixSearchWithContextFunc(ctx, request) -} - -// UpdatePrefixSearchWithContextCalls gets all the calls that were made to UpdatePrefixSearchWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdatePrefixSearchWithContextCalls()) -func (mock *MeiliIndexManager) UpdatePrefixSearchWithContextCalls() []struct { - Ctx context.Context - Request string -} { - var calls []struct { - Ctx context.Context - Request string - } - mock.lockUpdatePrefixSearchWithContext.RLock() - calls = mock.calls.UpdatePrefixSearchWithContext - mock.lockUpdatePrefixSearchWithContext.RUnlock() - return calls -} - -// UpdateProximityPrecision calls UpdateProximityPrecisionFunc. -func (mock *MeiliIndexManager) UpdateProximityPrecision(proximityType meilisearch.ProximityPrecisionType) (*meilisearch.TaskInfo, error) { - callInfo := struct { - ProximityType meilisearch.ProximityPrecisionType - }{ - ProximityType: proximityType, - } - mock.lockUpdateProximityPrecision.Lock() - mock.calls.UpdateProximityPrecision = append(mock.calls.UpdateProximityPrecision, callInfo) - mock.lockUpdateProximityPrecision.Unlock() - if mock.UpdateProximityPrecisionFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateProximityPrecisionFunc(proximityType) -} - -// UpdateProximityPrecisionCalls gets all the calls that were made to UpdateProximityPrecision. -// Check the length with: -// -// len(mockedIndexManager.UpdateProximityPrecisionCalls()) -func (mock *MeiliIndexManager) UpdateProximityPrecisionCalls() []struct { - ProximityType meilisearch.ProximityPrecisionType -} { - var calls []struct { - ProximityType meilisearch.ProximityPrecisionType - } - mock.lockUpdateProximityPrecision.RLock() - calls = mock.calls.UpdateProximityPrecision - mock.lockUpdateProximityPrecision.RUnlock() - return calls -} - -// UpdateProximityPrecisionWithContext calls UpdateProximityPrecisionWithContextFunc. -func (mock *MeiliIndexManager) UpdateProximityPrecisionWithContext(ctx context.Context, proximityType meilisearch.ProximityPrecisionType) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - ProximityType meilisearch.ProximityPrecisionType - }{ - Ctx: ctx, - ProximityType: proximityType, - } - mock.lockUpdateProximityPrecisionWithContext.Lock() - mock.calls.UpdateProximityPrecisionWithContext = append(mock.calls.UpdateProximityPrecisionWithContext, callInfo) - mock.lockUpdateProximityPrecisionWithContext.Unlock() - if mock.UpdateProximityPrecisionWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateProximityPrecisionWithContextFunc(ctx, proximityType) -} - -// UpdateProximityPrecisionWithContextCalls gets all the calls that were made to UpdateProximityPrecisionWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateProximityPrecisionWithContextCalls()) -func (mock *MeiliIndexManager) UpdateProximityPrecisionWithContextCalls() []struct { - Ctx context.Context - ProximityType meilisearch.ProximityPrecisionType -} { - var calls []struct { - Ctx context.Context - ProximityType meilisearch.ProximityPrecisionType - } - mock.lockUpdateProximityPrecisionWithContext.RLock() - calls = mock.calls.UpdateProximityPrecisionWithContext - mock.lockUpdateProximityPrecisionWithContext.RUnlock() - return calls -} - -// UpdateRankingRules calls UpdateRankingRulesFunc. -func (mock *MeiliIndexManager) UpdateRankingRules(request *[]string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request *[]string - }{ - Request: request, - } - mock.lockUpdateRankingRules.Lock() - mock.calls.UpdateRankingRules = append(mock.calls.UpdateRankingRules, callInfo) - mock.lockUpdateRankingRules.Unlock() - if mock.UpdateRankingRulesFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateRankingRulesFunc(request) -} - -// UpdateRankingRulesCalls gets all the calls that were made to UpdateRankingRules. -// Check the length with: -// -// len(mockedIndexManager.UpdateRankingRulesCalls()) -func (mock *MeiliIndexManager) UpdateRankingRulesCalls() []struct { - Request *[]string -} { - var calls []struct { - Request *[]string - } - mock.lockUpdateRankingRules.RLock() - calls = mock.calls.UpdateRankingRules - mock.lockUpdateRankingRules.RUnlock() - return calls -} - -// UpdateRankingRulesWithContext calls UpdateRankingRulesWithContextFunc. -func (mock *MeiliIndexManager) UpdateRankingRulesWithContext(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request *[]string - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateRankingRulesWithContext.Lock() - mock.calls.UpdateRankingRulesWithContext = append(mock.calls.UpdateRankingRulesWithContext, callInfo) - mock.lockUpdateRankingRulesWithContext.Unlock() - if mock.UpdateRankingRulesWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateRankingRulesWithContextFunc(ctx, request) -} - -// UpdateRankingRulesWithContextCalls gets all the calls that were made to UpdateRankingRulesWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateRankingRulesWithContextCalls()) -func (mock *MeiliIndexManager) UpdateRankingRulesWithContextCalls() []struct { - Ctx context.Context - Request *[]string -} { - var calls []struct { - Ctx context.Context - Request *[]string - } - mock.lockUpdateRankingRulesWithContext.RLock() - calls = mock.calls.UpdateRankingRulesWithContext - mock.lockUpdateRankingRulesWithContext.RUnlock() - return calls -} - -// UpdateSearchCutoffMs calls UpdateSearchCutoffMsFunc. -func (mock *MeiliIndexManager) UpdateSearchCutoffMs(request int64) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request int64 - }{ - Request: request, - } - mock.lockUpdateSearchCutoffMs.Lock() - mock.calls.UpdateSearchCutoffMs = append(mock.calls.UpdateSearchCutoffMs, callInfo) - mock.lockUpdateSearchCutoffMs.Unlock() - if mock.UpdateSearchCutoffMsFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateSearchCutoffMsFunc(request) -} - -// UpdateSearchCutoffMsCalls gets all the calls that were made to UpdateSearchCutoffMs. -// Check the length with: -// -// len(mockedIndexManager.UpdateSearchCutoffMsCalls()) -func (mock *MeiliIndexManager) UpdateSearchCutoffMsCalls() []struct { - Request int64 -} { - var calls []struct { - Request int64 - } - mock.lockUpdateSearchCutoffMs.RLock() - calls = mock.calls.UpdateSearchCutoffMs - mock.lockUpdateSearchCutoffMs.RUnlock() - return calls -} - -// UpdateSearchCutoffMsWithContext calls UpdateSearchCutoffMsWithContextFunc. -func (mock *MeiliIndexManager) UpdateSearchCutoffMsWithContext(ctx context.Context, request int64) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request int64 - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateSearchCutoffMsWithContext.Lock() - mock.calls.UpdateSearchCutoffMsWithContext = append(mock.calls.UpdateSearchCutoffMsWithContext, callInfo) - mock.lockUpdateSearchCutoffMsWithContext.Unlock() - if mock.UpdateSearchCutoffMsWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateSearchCutoffMsWithContextFunc(ctx, request) -} - -// UpdateSearchCutoffMsWithContextCalls gets all the calls that were made to UpdateSearchCutoffMsWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateSearchCutoffMsWithContextCalls()) -func (mock *MeiliIndexManager) UpdateSearchCutoffMsWithContextCalls() []struct { - Ctx context.Context - Request int64 -} { - var calls []struct { - Ctx context.Context - Request int64 - } - mock.lockUpdateSearchCutoffMsWithContext.RLock() - calls = mock.calls.UpdateSearchCutoffMsWithContext - mock.lockUpdateSearchCutoffMsWithContext.RUnlock() - return calls -} - -// UpdateSearchableAttributes calls UpdateSearchableAttributesFunc. -func (mock *MeiliIndexManager) UpdateSearchableAttributes(request *[]string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request *[]string - }{ - Request: request, - } - mock.lockUpdateSearchableAttributes.Lock() - mock.calls.UpdateSearchableAttributes = append(mock.calls.UpdateSearchableAttributes, callInfo) - mock.lockUpdateSearchableAttributes.Unlock() - if mock.UpdateSearchableAttributesFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateSearchableAttributesFunc(request) -} - -// UpdateSearchableAttributesCalls gets all the calls that were made to UpdateSearchableAttributes. -// Check the length with: -// -// len(mockedIndexManager.UpdateSearchableAttributesCalls()) -func (mock *MeiliIndexManager) UpdateSearchableAttributesCalls() []struct { - Request *[]string -} { - var calls []struct { - Request *[]string - } - mock.lockUpdateSearchableAttributes.RLock() - calls = mock.calls.UpdateSearchableAttributes - mock.lockUpdateSearchableAttributes.RUnlock() - return calls -} - -// UpdateSearchableAttributesWithContext calls UpdateSearchableAttributesWithContextFunc. -func (mock *MeiliIndexManager) UpdateSearchableAttributesWithContext(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request *[]string - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateSearchableAttributesWithContext.Lock() - mock.calls.UpdateSearchableAttributesWithContext = append(mock.calls.UpdateSearchableAttributesWithContext, callInfo) - mock.lockUpdateSearchableAttributesWithContext.Unlock() - if mock.UpdateSearchableAttributesWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateSearchableAttributesWithContextFunc(ctx, request) -} - -// UpdateSearchableAttributesWithContextCalls gets all the calls that were made to UpdateSearchableAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateSearchableAttributesWithContextCalls()) -func (mock *MeiliIndexManager) UpdateSearchableAttributesWithContextCalls() []struct { - Ctx context.Context - Request *[]string -} { - var calls []struct { - Ctx context.Context - Request *[]string - } - mock.lockUpdateSearchableAttributesWithContext.RLock() - calls = mock.calls.UpdateSearchableAttributesWithContext - mock.lockUpdateSearchableAttributesWithContext.RUnlock() - return calls -} - -// UpdateSeparatorTokens calls UpdateSeparatorTokensFunc. -func (mock *MeiliIndexManager) UpdateSeparatorTokens(tokens []string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Tokens []string - }{ - Tokens: tokens, - } - mock.lockUpdateSeparatorTokens.Lock() - mock.calls.UpdateSeparatorTokens = append(mock.calls.UpdateSeparatorTokens, callInfo) - mock.lockUpdateSeparatorTokens.Unlock() - if mock.UpdateSeparatorTokensFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateSeparatorTokensFunc(tokens) -} - -// UpdateSeparatorTokensCalls gets all the calls that were made to UpdateSeparatorTokens. -// Check the length with: -// -// len(mockedIndexManager.UpdateSeparatorTokensCalls()) -func (mock *MeiliIndexManager) UpdateSeparatorTokensCalls() []struct { - Tokens []string -} { - var calls []struct { - Tokens []string - } - mock.lockUpdateSeparatorTokens.RLock() - calls = mock.calls.UpdateSeparatorTokens - mock.lockUpdateSeparatorTokens.RUnlock() - return calls -} - -// UpdateSeparatorTokensWithContext calls UpdateSeparatorTokensWithContextFunc. -func (mock *MeiliIndexManager) UpdateSeparatorTokensWithContext(ctx context.Context, tokens []string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Tokens []string - }{ - Ctx: ctx, - Tokens: tokens, - } - mock.lockUpdateSeparatorTokensWithContext.Lock() - mock.calls.UpdateSeparatorTokensWithContext = append(mock.calls.UpdateSeparatorTokensWithContext, callInfo) - mock.lockUpdateSeparatorTokensWithContext.Unlock() - if mock.UpdateSeparatorTokensWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateSeparatorTokensWithContextFunc(ctx, tokens) -} - -// UpdateSeparatorTokensWithContextCalls gets all the calls that were made to UpdateSeparatorTokensWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateSeparatorTokensWithContextCalls()) -func (mock *MeiliIndexManager) UpdateSeparatorTokensWithContextCalls() []struct { - Ctx context.Context - Tokens []string -} { - var calls []struct { - Ctx context.Context - Tokens []string - } - mock.lockUpdateSeparatorTokensWithContext.RLock() - calls = mock.calls.UpdateSeparatorTokensWithContext - mock.lockUpdateSeparatorTokensWithContext.RUnlock() - return calls -} - -// UpdateSettings calls UpdateSettingsFunc. -func (mock *MeiliIndexManager) UpdateSettings(request *meilisearch.Settings) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request *meilisearch.Settings - }{ - Request: request, - } - mock.lockUpdateSettings.Lock() - mock.calls.UpdateSettings = append(mock.calls.UpdateSettings, callInfo) - mock.lockUpdateSettings.Unlock() - if mock.UpdateSettingsFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateSettingsFunc(request) -} - -// UpdateSettingsCalls gets all the calls that were made to UpdateSettings. -// Check the length with: -// -// len(mockedIndexManager.UpdateSettingsCalls()) -func (mock *MeiliIndexManager) UpdateSettingsCalls() []struct { - Request *meilisearch.Settings -} { - var calls []struct { - Request *meilisearch.Settings - } - mock.lockUpdateSettings.RLock() - calls = mock.calls.UpdateSettings - mock.lockUpdateSettings.RUnlock() - return calls -} - -// UpdateSettingsWithContext calls UpdateSettingsWithContextFunc. -func (mock *MeiliIndexManager) UpdateSettingsWithContext(ctx context.Context, request *meilisearch.Settings) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request *meilisearch.Settings - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateSettingsWithContext.Lock() - mock.calls.UpdateSettingsWithContext = append(mock.calls.UpdateSettingsWithContext, callInfo) - mock.lockUpdateSettingsWithContext.Unlock() - if mock.UpdateSettingsWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateSettingsWithContextFunc(ctx, request) -} - -// UpdateSettingsWithContextCalls gets all the calls that were made to UpdateSettingsWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateSettingsWithContextCalls()) -func (mock *MeiliIndexManager) UpdateSettingsWithContextCalls() []struct { - Ctx context.Context - Request *meilisearch.Settings -} { - var calls []struct { - Ctx context.Context - Request *meilisearch.Settings - } - mock.lockUpdateSettingsWithContext.RLock() - calls = mock.calls.UpdateSettingsWithContext - mock.lockUpdateSettingsWithContext.RUnlock() - return calls -} - -// UpdateSortableAttributes calls UpdateSortableAttributesFunc. -func (mock *MeiliIndexManager) UpdateSortableAttributes(request *[]string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request *[]string - }{ - Request: request, - } - mock.lockUpdateSortableAttributes.Lock() - mock.calls.UpdateSortableAttributes = append(mock.calls.UpdateSortableAttributes, callInfo) - mock.lockUpdateSortableAttributes.Unlock() - if mock.UpdateSortableAttributesFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateSortableAttributesFunc(request) -} - -// UpdateSortableAttributesCalls gets all the calls that were made to UpdateSortableAttributes. -// Check the length with: -// -// len(mockedIndexManager.UpdateSortableAttributesCalls()) -func (mock *MeiliIndexManager) UpdateSortableAttributesCalls() []struct { - Request *[]string -} { - var calls []struct { - Request *[]string - } - mock.lockUpdateSortableAttributes.RLock() - calls = mock.calls.UpdateSortableAttributes - mock.lockUpdateSortableAttributes.RUnlock() - return calls -} - -// UpdateSortableAttributesWithContext calls UpdateSortableAttributesWithContextFunc. -func (mock *MeiliIndexManager) UpdateSortableAttributesWithContext(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request *[]string - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateSortableAttributesWithContext.Lock() - mock.calls.UpdateSortableAttributesWithContext = append(mock.calls.UpdateSortableAttributesWithContext, callInfo) - mock.lockUpdateSortableAttributesWithContext.Unlock() - if mock.UpdateSortableAttributesWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateSortableAttributesWithContextFunc(ctx, request) -} - -// UpdateSortableAttributesWithContextCalls gets all the calls that were made to UpdateSortableAttributesWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateSortableAttributesWithContextCalls()) -func (mock *MeiliIndexManager) UpdateSortableAttributesWithContextCalls() []struct { - Ctx context.Context - Request *[]string -} { - var calls []struct { - Ctx context.Context - Request *[]string - } - mock.lockUpdateSortableAttributesWithContext.RLock() - calls = mock.calls.UpdateSortableAttributesWithContext - mock.lockUpdateSortableAttributesWithContext.RUnlock() - return calls -} - -// UpdateStopWords calls UpdateStopWordsFunc. -func (mock *MeiliIndexManager) UpdateStopWords(request *[]string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request *[]string - }{ - Request: request, - } - mock.lockUpdateStopWords.Lock() - mock.calls.UpdateStopWords = append(mock.calls.UpdateStopWords, callInfo) - mock.lockUpdateStopWords.Unlock() - if mock.UpdateStopWordsFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateStopWordsFunc(request) -} - -// UpdateStopWordsCalls gets all the calls that were made to UpdateStopWords. -// Check the length with: -// -// len(mockedIndexManager.UpdateStopWordsCalls()) -func (mock *MeiliIndexManager) UpdateStopWordsCalls() []struct { - Request *[]string -} { - var calls []struct { - Request *[]string - } - mock.lockUpdateStopWords.RLock() - calls = mock.calls.UpdateStopWords - mock.lockUpdateStopWords.RUnlock() - return calls -} - -// UpdateStopWordsWithContext calls UpdateStopWordsWithContextFunc. -func (mock *MeiliIndexManager) UpdateStopWordsWithContext(ctx context.Context, request *[]string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request *[]string - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateStopWordsWithContext.Lock() - mock.calls.UpdateStopWordsWithContext = append(mock.calls.UpdateStopWordsWithContext, callInfo) - mock.lockUpdateStopWordsWithContext.Unlock() - if mock.UpdateStopWordsWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateStopWordsWithContextFunc(ctx, request) -} - -// UpdateStopWordsWithContextCalls gets all the calls that were made to UpdateStopWordsWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateStopWordsWithContextCalls()) -func (mock *MeiliIndexManager) UpdateStopWordsWithContextCalls() []struct { - Ctx context.Context - Request *[]string -} { - var calls []struct { - Ctx context.Context - Request *[]string - } - mock.lockUpdateStopWordsWithContext.RLock() - calls = mock.calls.UpdateStopWordsWithContext - mock.lockUpdateStopWordsWithContext.RUnlock() - return calls -} - -// UpdateSynonyms calls UpdateSynonymsFunc. -func (mock *MeiliIndexManager) UpdateSynonyms(request *map[string][]string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request *map[string][]string - }{ - Request: request, - } - mock.lockUpdateSynonyms.Lock() - mock.calls.UpdateSynonyms = append(mock.calls.UpdateSynonyms, callInfo) - mock.lockUpdateSynonyms.Unlock() - if mock.UpdateSynonymsFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateSynonymsFunc(request) -} - -// UpdateSynonymsCalls gets all the calls that were made to UpdateSynonyms. -// Check the length with: -// -// len(mockedIndexManager.UpdateSynonymsCalls()) -func (mock *MeiliIndexManager) UpdateSynonymsCalls() []struct { - Request *map[string][]string -} { - var calls []struct { - Request *map[string][]string - } - mock.lockUpdateSynonyms.RLock() - calls = mock.calls.UpdateSynonyms - mock.lockUpdateSynonyms.RUnlock() - return calls -} - -// UpdateSynonymsWithContext calls UpdateSynonymsWithContextFunc. -func (mock *MeiliIndexManager) UpdateSynonymsWithContext(ctx context.Context, request *map[string][]string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request *map[string][]string - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateSynonymsWithContext.Lock() - mock.calls.UpdateSynonymsWithContext = append(mock.calls.UpdateSynonymsWithContext, callInfo) - mock.lockUpdateSynonymsWithContext.Unlock() - if mock.UpdateSynonymsWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateSynonymsWithContextFunc(ctx, request) -} - -// UpdateSynonymsWithContextCalls gets all the calls that were made to UpdateSynonymsWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateSynonymsWithContextCalls()) -func (mock *MeiliIndexManager) UpdateSynonymsWithContextCalls() []struct { - Ctx context.Context - Request *map[string][]string -} { - var calls []struct { - Ctx context.Context - Request *map[string][]string - } - mock.lockUpdateSynonymsWithContext.RLock() - calls = mock.calls.UpdateSynonymsWithContext - mock.lockUpdateSynonymsWithContext.RUnlock() - return calls -} - -// UpdateTypoTolerance calls UpdateTypoToleranceFunc. -func (mock *MeiliIndexManager) UpdateTypoTolerance(request *meilisearch.TypoTolerance) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Request *meilisearch.TypoTolerance - }{ - Request: request, - } - mock.lockUpdateTypoTolerance.Lock() - mock.calls.UpdateTypoTolerance = append(mock.calls.UpdateTypoTolerance, callInfo) - mock.lockUpdateTypoTolerance.Unlock() - if mock.UpdateTypoToleranceFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateTypoToleranceFunc(request) -} - -// UpdateTypoToleranceCalls gets all the calls that were made to UpdateTypoTolerance. -// Check the length with: -// -// len(mockedIndexManager.UpdateTypoToleranceCalls()) -func (mock *MeiliIndexManager) UpdateTypoToleranceCalls() []struct { - Request *meilisearch.TypoTolerance -} { - var calls []struct { - Request *meilisearch.TypoTolerance - } - mock.lockUpdateTypoTolerance.RLock() - calls = mock.calls.UpdateTypoTolerance - mock.lockUpdateTypoTolerance.RUnlock() - return calls -} - -// UpdateTypoToleranceWithContext calls UpdateTypoToleranceWithContextFunc. -func (mock *MeiliIndexManager) UpdateTypoToleranceWithContext(ctx context.Context, request *meilisearch.TypoTolerance) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Request *meilisearch.TypoTolerance - }{ - Ctx: ctx, - Request: request, - } - mock.lockUpdateTypoToleranceWithContext.Lock() - mock.calls.UpdateTypoToleranceWithContext = append(mock.calls.UpdateTypoToleranceWithContext, callInfo) - mock.lockUpdateTypoToleranceWithContext.Unlock() - if mock.UpdateTypoToleranceWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.UpdateTypoToleranceWithContextFunc(ctx, request) -} - -// UpdateTypoToleranceWithContextCalls gets all the calls that were made to UpdateTypoToleranceWithContext. -// Check the length with: -// -// len(mockedIndexManager.UpdateTypoToleranceWithContextCalls()) -func (mock *MeiliIndexManager) UpdateTypoToleranceWithContextCalls() []struct { - Ctx context.Context - Request *meilisearch.TypoTolerance -} { - var calls []struct { - Ctx context.Context - Request *meilisearch.TypoTolerance - } - mock.lockUpdateTypoToleranceWithContext.RLock() - calls = mock.calls.UpdateTypoToleranceWithContext - mock.lockUpdateTypoToleranceWithContext.RUnlock() - return calls -} - -// WaitForTask calls WaitForTaskFunc. -func (mock *MeiliIndexManager) WaitForTask(taskUID int64, interval time.Duration) (*meilisearch.Task, error) { - callInfo := struct { - TaskUID int64 - Interval time.Duration - }{ - TaskUID: taskUID, - Interval: interval, - } - mock.lockWaitForTask.Lock() - mock.calls.WaitForTask = append(mock.calls.WaitForTask, callInfo) - mock.lockWaitForTask.Unlock() - if mock.WaitForTaskFunc == nil { - var ( - taskOut *meilisearch.Task - errOut error - ) - return taskOut, errOut - } - return mock.WaitForTaskFunc(taskUID, interval) -} - -// WaitForTaskCalls gets all the calls that were made to WaitForTask. -// Check the length with: -// -// len(mockedIndexManager.WaitForTaskCalls()) -func (mock *MeiliIndexManager) WaitForTaskCalls() []struct { - TaskUID int64 - Interval time.Duration -} { - var calls []struct { - TaskUID int64 - Interval time.Duration - } - mock.lockWaitForTask.RLock() - calls = mock.calls.WaitForTask - mock.lockWaitForTask.RUnlock() - return calls -} - -// WaitForTaskWithContext calls WaitForTaskWithContextFunc. -func (mock *MeiliIndexManager) WaitForTaskWithContext(ctx context.Context, taskUID int64, interval time.Duration) (*meilisearch.Task, error) { - callInfo := struct { - Ctx context.Context - TaskUID int64 - Interval time.Duration - }{ - Ctx: ctx, - TaskUID: taskUID, - Interval: interval, - } - mock.lockWaitForTaskWithContext.Lock() - mock.calls.WaitForTaskWithContext = append(mock.calls.WaitForTaskWithContext, callInfo) - mock.lockWaitForTaskWithContext.Unlock() - if mock.WaitForTaskWithContextFunc == nil { - var ( - taskOut *meilisearch.Task - errOut error - ) - return taskOut, errOut - } - return mock.WaitForTaskWithContextFunc(ctx, taskUID, interval) -} - -// WaitForTaskWithContextCalls gets all the calls that were made to WaitForTaskWithContext. -// Check the length with: -// -// len(mockedIndexManager.WaitForTaskWithContextCalls()) -func (mock *MeiliIndexManager) WaitForTaskWithContextCalls() []struct { - Ctx context.Context - TaskUID int64 - Interval time.Duration -} { - var calls []struct { - Ctx context.Context - TaskUID int64 - Interval time.Duration - } - mock.lockWaitForTaskWithContext.RLock() - calls = mock.calls.WaitForTaskWithContext - mock.lockWaitForTaskWithContext.RUnlock() - return calls -} diff --git a/server/core/internal/_mock/meilisearch_service_manager.go b/server/core/internal/_mock/meilisearch_service_manager.go deleted file mode 100644 index 5f4326a5..00000000 --- a/server/core/internal/_mock/meilisearch_service_manager.go +++ /dev/null @@ -1,5186 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package mock - -import ( - "context" - "sync" - "time" - - "github.com/meilisearch/meilisearch-go" -) - -// Ensure, that MeiliServiceManager does implement meilisearch.ServiceManager. -// If this is not the case, regenerate this file with moq. -var _ meilisearch.ServiceManager = &MeiliServiceManager{} - -// MeiliServiceManager is a mock implementation of meilisearch.ServiceManager. -// -// func TestSomethingThatUsesServiceManager(t *testing.T) { -// -// // make and configure a mocked meilisearch.ServiceManager -// mockedServiceManager := &MeiliServiceManager{ -// AddWebhookFunc: func(params *meilisearch.AddWebhookRequest) (*meilisearch.Webhook, error) { -// panic("mock out the AddWebhook method") -// }, -// AddWebhookWithContextFunc: func(ctx context.Context, params *meilisearch.AddWebhookRequest) (*meilisearch.Webhook, error) { -// panic("mock out the AddWebhookWithContext method") -// }, -// CancelTasksFunc: func(param *meilisearch.CancelTasksQuery) (*meilisearch.TaskInfo, error) { -// panic("mock out the CancelTasks method") -// }, -// CancelTasksWithContextFunc: func(ctx context.Context, param *meilisearch.CancelTasksQuery) (*meilisearch.TaskInfo, error) { -// panic("mock out the CancelTasksWithContext method") -// }, -// ChatCompletionStreamFunc: func(workspace string, query *meilisearch.ChatCompletionQuery) (*meilisearch.Stream[*meilisearch.ChatCompletionStreamChunk], error) { -// panic("mock out the ChatCompletionStream method") -// }, -// ChatCompletionStreamWithContextFunc: func(ctx context.Context, workspace string, query *meilisearch.ChatCompletionQuery) (*meilisearch.Stream[*meilisearch.ChatCompletionStreamChunk], error) { -// panic("mock out the ChatCompletionStreamWithContext method") -// }, -// ChatManagerFunc: func() meilisearch.ChatManager { -// panic("mock out the ChatManager method") -// }, -// ChatReaderFunc: func() meilisearch.ChatReader { -// panic("mock out the ChatReader method") -// }, -// CloseFunc: func() { -// panic("mock out the Close method") -// }, -// CreateDumpFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the CreateDump method") -// }, -// CreateDumpWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the CreateDumpWithContext method") -// }, -// CreateIndexFunc: func(config *meilisearch.IndexConfig) (*meilisearch.TaskInfo, error) { -// panic("mock out the CreateIndex method") -// }, -// CreateIndexWithContextFunc: func(ctx context.Context, config *meilisearch.IndexConfig) (*meilisearch.TaskInfo, error) { -// panic("mock out the CreateIndexWithContext method") -// }, -// CreateKeyFunc: func(request *meilisearch.Key) (*meilisearch.Key, error) { -// panic("mock out the CreateKey method") -// }, -// CreateKeyWithContextFunc: func(ctx context.Context, request *meilisearch.Key) (*meilisearch.Key, error) { -// panic("mock out the CreateKeyWithContext method") -// }, -// CreateSnapshotFunc: func() (*meilisearch.TaskInfo, error) { -// panic("mock out the CreateSnapshot method") -// }, -// CreateSnapshotWithContextFunc: func(ctx context.Context) (*meilisearch.TaskInfo, error) { -// panic("mock out the CreateSnapshotWithContext method") -// }, -// DeleteIndexFunc: func(uid string) (*meilisearch.TaskInfo, error) { -// panic("mock out the DeleteIndex method") -// }, -// DeleteIndexWithContextFunc: func(ctx context.Context, uid string) (*meilisearch.TaskInfo, error) { -// panic("mock out the DeleteIndexWithContext method") -// }, -// DeleteKeyFunc: func(keyOrUID string) (bool, error) { -// panic("mock out the DeleteKey method") -// }, -// DeleteKeyWithContextFunc: func(ctx context.Context, keyOrUID string) (bool, error) { -// panic("mock out the DeleteKeyWithContext method") -// }, -// DeleteSearchRuleFunc: func(uid string) error { -// panic("mock out the DeleteSearchRule method") -// }, -// DeleteSearchRuleWithContextFunc: func(ctx context.Context, uid string) error { -// panic("mock out the DeleteSearchRuleWithContext method") -// }, -// DeleteTasksFunc: func(param *meilisearch.DeleteTasksQuery) (*meilisearch.TaskInfo, error) { -// panic("mock out the DeleteTasks method") -// }, -// DeleteTasksWithContextFunc: func(ctx context.Context, param *meilisearch.DeleteTasksQuery) (*meilisearch.TaskInfo, error) { -// panic("mock out the DeleteTasksWithContext method") -// }, -// DeleteWebhookFunc: func(uuid string) error { -// panic("mock out the DeleteWebhook method") -// }, -// DeleteWebhookWithContextFunc: func(ctx context.Context, uuid string) error { -// panic("mock out the DeleteWebhookWithContext method") -// }, -// ExperimentalFeaturesFunc: func() *meilisearch.ExperimentalFeatures { -// panic("mock out the ExperimentalFeatures method") -// }, -// ExportFunc: func(params *meilisearch.ExportParams) (*meilisearch.TaskInfo, error) { -// panic("mock out the Export method") -// }, -// ExportWithContextFunc: func(ctx context.Context, params *meilisearch.ExportParams) (*meilisearch.TaskInfo, error) { -// panic("mock out the ExportWithContext method") -// }, -// GenerateTenantTokenFunc: func(apiKeyUID string, searchRules map[string]interface{}, options *meilisearch.TenantTokenOptions) (string, error) { -// panic("mock out the GenerateTenantToken method") -// }, -// GetBatchFunc: func(batchUID int) (*meilisearch.Batch, error) { -// panic("mock out the GetBatch method") -// }, -// GetBatchWithContextFunc: func(ctx context.Context, batchUID int) (*meilisearch.Batch, error) { -// panic("mock out the GetBatchWithContext method") -// }, -// GetBatchesFunc: func(param *meilisearch.BatchesQuery) (*meilisearch.BatchesResults, error) { -// panic("mock out the GetBatches method") -// }, -// GetBatchesWithContextFunc: func(ctx context.Context, param *meilisearch.BatchesQuery) (*meilisearch.BatchesResults, error) { -// panic("mock out the GetBatchesWithContext method") -// }, -// GetChatWorkspaceFunc: func(uid string) (*meilisearch.ChatWorkspace, error) { -// panic("mock out the GetChatWorkspace method") -// }, -// GetChatWorkspaceSettingsFunc: func(uid string) (*meilisearch.ChatWorkspaceSettings, error) { -// panic("mock out the GetChatWorkspaceSettings method") -// }, -// GetChatWorkspaceSettingsWithContextFunc: func(ctx context.Context, uid string) (*meilisearch.ChatWorkspaceSettings, error) { -// panic("mock out the GetChatWorkspaceSettingsWithContext method") -// }, -// GetChatWorkspaceWithContextFunc: func(ctx context.Context, uid string) (*meilisearch.ChatWorkspace, error) { -// panic("mock out the GetChatWorkspaceWithContext method") -// }, -// GetIndexFunc: func(indexID string) (*meilisearch.IndexResult, error) { -// panic("mock out the GetIndex method") -// }, -// GetIndexWithContextFunc: func(ctx context.Context, indexID string) (*meilisearch.IndexResult, error) { -// panic("mock out the GetIndexWithContext method") -// }, -// GetKeyFunc: func(identifier string) (*meilisearch.Key, error) { -// panic("mock out the GetKey method") -// }, -// GetKeyWithContextFunc: func(ctx context.Context, identifier string) (*meilisearch.Key, error) { -// panic("mock out the GetKeyWithContext method") -// }, -// GetKeysFunc: func(param *meilisearch.KeysQuery) (*meilisearch.KeysResults, error) { -// panic("mock out the GetKeys method") -// }, -// GetKeysWithContextFunc: func(ctx context.Context, param *meilisearch.KeysQuery) (*meilisearch.KeysResults, error) { -// panic("mock out the GetKeysWithContext method") -// }, -// GetNetworkFunc: func() (*meilisearch.Network, error) { -// panic("mock out the GetNetwork method") -// }, -// GetNetworkWithContextFunc: func(ctx context.Context) (*meilisearch.Network, error) { -// panic("mock out the GetNetworkWithContext method") -// }, -// GetRawIndexFunc: func(uid string) (map[string]interface{}, error) { -// panic("mock out the GetRawIndex method") -// }, -// GetRawIndexWithContextFunc: func(ctx context.Context, uid string) (map[string]interface{}, error) { -// panic("mock out the GetRawIndexWithContext method") -// }, -// GetRawIndexesFunc: func(param *meilisearch.IndexesQuery) (map[string]interface{}, error) { -// panic("mock out the GetRawIndexes method") -// }, -// GetRawIndexesWithContextFunc: func(ctx context.Context, param *meilisearch.IndexesQuery) (map[string]interface{}, error) { -// panic("mock out the GetRawIndexesWithContext method") -// }, -// GetSearchRuleFunc: func(uid string) (*meilisearch.SearchRule, error) { -// panic("mock out the GetSearchRule method") -// }, -// GetSearchRuleWithContextFunc: func(ctx context.Context, uid string) (*meilisearch.SearchRule, error) { -// panic("mock out the GetSearchRuleWithContext method") -// }, -// GetStatsFunc: func(param *meilisearch.StatsParams) (*meilisearch.Stats, error) { -// panic("mock out the GetStats method") -// }, -// GetStatsWithContextFunc: func(ctx context.Context, param *meilisearch.StatsParams) (*meilisearch.Stats, error) { -// panic("mock out the GetStatsWithContext method") -// }, -// GetTaskFunc: func(taskUID int64) (*meilisearch.Task, error) { -// panic("mock out the GetTask method") -// }, -// GetTaskDocumentsFunc: func(taskUID int64, dst interface{}) error { -// panic("mock out the GetTaskDocuments method") -// }, -// GetTaskDocumentsWithContextFunc: func(ctx context.Context, taskUID int64, dst interface{}) error { -// panic("mock out the GetTaskDocumentsWithContext method") -// }, -// GetTaskWithContextFunc: func(ctx context.Context, taskUID int64) (*meilisearch.Task, error) { -// panic("mock out the GetTaskWithContext method") -// }, -// GetTasksFunc: func(param *meilisearch.TasksQuery) (*meilisearch.TaskResult, error) { -// panic("mock out the GetTasks method") -// }, -// GetTasksWithContextFunc: func(ctx context.Context, param *meilisearch.TasksQuery) (*meilisearch.TaskResult, error) { -// panic("mock out the GetTasksWithContext method") -// }, -// GetWebhookFunc: func(uuid string) (*meilisearch.Webhook, error) { -// panic("mock out the GetWebhook method") -// }, -// GetWebhookWithContextFunc: func(ctx context.Context, uuid string) (*meilisearch.Webhook, error) { -// panic("mock out the GetWebhookWithContext method") -// }, -// HealthFunc: func() (*meilisearch.Health, error) { -// panic("mock out the Health method") -// }, -// HealthWithContextFunc: func(ctx context.Context) (*meilisearch.Health, error) { -// panic("mock out the HealthWithContext method") -// }, -// IndexFunc: func(uid string) meilisearch.IndexManager { -// panic("mock out the Index method") -// }, -// IsHealthyFunc: func() bool { -// panic("mock out the IsHealthy method") -// }, -// KeyManagerFunc: func() meilisearch.KeyManager { -// panic("mock out the KeyManager method") -// }, -// KeyReaderFunc: func() meilisearch.KeyReader { -// panic("mock out the KeyReader method") -// }, -// ListChatWorkspacesFunc: func(query *meilisearch.ListChatWorkSpaceQuery) (*meilisearch.ListChatWorkspace, error) { -// panic("mock out the ListChatWorkspaces method") -// }, -// ListChatWorkspacesWithContextFunc: func(ctx context.Context, query *meilisearch.ListChatWorkSpaceQuery) (*meilisearch.ListChatWorkspace, error) { -// panic("mock out the ListChatWorkspacesWithContext method") -// }, -// ListIndexesFunc: func(param *meilisearch.IndexesQuery) (*meilisearch.IndexesResults, error) { -// panic("mock out the ListIndexes method") -// }, -// ListIndexesWithContextFunc: func(ctx context.Context, param *meilisearch.IndexesQuery) (*meilisearch.IndexesResults, error) { -// panic("mock out the ListIndexesWithContext method") -// }, -// ListSearchRulesFunc: func(params *meilisearch.SearchRulesParams) (*meilisearch.SearchRulesResults, error) { -// panic("mock out the ListSearchRules method") -// }, -// ListSearchRulesWithContextFunc: func(ctx context.Context, params *meilisearch.SearchRulesParams) (*meilisearch.SearchRulesResults, error) { -// panic("mock out the ListSearchRulesWithContext method") -// }, -// ListWebhooksFunc: func() (*meilisearch.WebhookResults, error) { -// panic("mock out the ListWebhooks method") -// }, -// ListWebhooksWithContextFunc: func(ctx context.Context) (*meilisearch.WebhookResults, error) { -// panic("mock out the ListWebhooksWithContext method") -// }, -// MultiSearchFunc: func(queries *meilisearch.MultiSearchRequest) (*meilisearch.MultiSearchResponse, error) { -// panic("mock out the MultiSearch method") -// }, -// MultiSearchWithContextFunc: func(ctx context.Context, queries *meilisearch.MultiSearchRequest) (*meilisearch.MultiSearchResponse, error) { -// panic("mock out the MultiSearchWithContext method") -// }, -// ResetChatWorkspaceFunc: func(uid string) (*meilisearch.ChatWorkspaceSettings, error) { -// panic("mock out the ResetChatWorkspace method") -// }, -// ResetChatWorkspaceWithContextFunc: func(ctx context.Context, uid string) (*meilisearch.ChatWorkspaceSettings, error) { -// panic("mock out the ResetChatWorkspaceWithContext method") -// }, -// SearchRulesManagerFunc: func() meilisearch.SearchRulesManager { -// panic("mock out the SearchRulesManager method") -// }, -// SearchRulesReaderFunc: func() meilisearch.SearchRulesReader { -// panic("mock out the SearchRulesReader method") -// }, -// ServiceReaderFunc: func() meilisearch.ServiceReader { -// panic("mock out the ServiceReader method") -// }, -// SwapIndexesFunc: func(param []*meilisearch.SwapIndexesParams) (*meilisearch.TaskInfo, error) { -// panic("mock out the SwapIndexes method") -// }, -// SwapIndexesWithContextFunc: func(ctx context.Context, param []*meilisearch.SwapIndexesParams) (*meilisearch.TaskInfo, error) { -// panic("mock out the SwapIndexesWithContext method") -// }, -// TaskManagerFunc: func() meilisearch.TaskManager { -// panic("mock out the TaskManager method") -// }, -// TaskReaderFunc: func() meilisearch.TaskReader { -// panic("mock out the TaskReader method") -// }, -// UpdateChatWorkspaceFunc: func(uid string, settings *meilisearch.ChatWorkspaceSettings) (*meilisearch.ChatWorkspaceSettings, error) { -// panic("mock out the UpdateChatWorkspace method") -// }, -// UpdateChatWorkspaceWithContextFunc: func(ctx context.Context, uid string, settings *meilisearch.ChatWorkspaceSettings) (*meilisearch.ChatWorkspaceSettings, error) { -// panic("mock out the UpdateChatWorkspaceWithContext method") -// }, -// UpdateKeyFunc: func(keyOrUID string, request *meilisearch.Key) (*meilisearch.Key, error) { -// panic("mock out the UpdateKey method") -// }, -// UpdateKeyWithContextFunc: func(ctx context.Context, keyOrUID string, request *meilisearch.Key) (*meilisearch.Key, error) { -// panic("mock out the UpdateKeyWithContext method") -// }, -// UpdateNetworkFunc: func(params *meilisearch.UpdateNetworkRequest) (any, error) { -// panic("mock out the UpdateNetwork method") -// }, -// UpdateNetworkWithContextFunc: func(ctx context.Context, params *meilisearch.UpdateNetworkRequest) (any, error) { -// panic("mock out the UpdateNetworkWithContext method") -// }, -// UpdateSearchRuleFunc: func(uid string, params *meilisearch.SearchRulesRequest) (*meilisearch.SearchRule, error) { -// panic("mock out the UpdateSearchRule method") -// }, -// UpdateSearchRuleWithContextFunc: func(ctx context.Context, uid string, params *meilisearch.SearchRulesRequest) (*meilisearch.SearchRule, error) { -// panic("mock out the UpdateSearchRuleWithContext method") -// }, -// UpdateWebhookFunc: func(uuid string, params *meilisearch.UpdateWebhookRequest) (*meilisearch.Webhook, error) { -// panic("mock out the UpdateWebhook method") -// }, -// UpdateWebhookWithContextFunc: func(ctx context.Context, uuid string, params *meilisearch.UpdateWebhookRequest) (*meilisearch.Webhook, error) { -// panic("mock out the UpdateWebhookWithContext method") -// }, -// VersionFunc: func() (*meilisearch.Version, error) { -// panic("mock out the Version method") -// }, -// VersionWithContextFunc: func(ctx context.Context) (*meilisearch.Version, error) { -// panic("mock out the VersionWithContext method") -// }, -// WaitForTaskFunc: func(taskUID int64, interval time.Duration) (*meilisearch.Task, error) { -// panic("mock out the WaitForTask method") -// }, -// WaitForTaskWithContextFunc: func(ctx context.Context, taskUID int64, interval time.Duration) (*meilisearch.Task, error) { -// panic("mock out the WaitForTaskWithContext method") -// }, -// WebhookManagerFunc: func() meilisearch.WebhookManager { -// panic("mock out the WebhookManager method") -// }, -// WebhookReaderFunc: func() meilisearch.WebhookReader { -// panic("mock out the WebhookReader method") -// }, -// } -// -// // use mockedServiceManager in code that requires meilisearch.ServiceManager -// // and then make assertions. -// -// } -type MeiliServiceManager struct { - // AddWebhookFunc mocks the AddWebhook method. - AddWebhookFunc func(params *meilisearch.AddWebhookRequest) (*meilisearch.Webhook, error) - - // AddWebhookWithContextFunc mocks the AddWebhookWithContext method. - AddWebhookWithContextFunc func(ctx context.Context, params *meilisearch.AddWebhookRequest) (*meilisearch.Webhook, error) - - // CancelTasksFunc mocks the CancelTasks method. - CancelTasksFunc func(param *meilisearch.CancelTasksQuery) (*meilisearch.TaskInfo, error) - - // CancelTasksWithContextFunc mocks the CancelTasksWithContext method. - CancelTasksWithContextFunc func(ctx context.Context, param *meilisearch.CancelTasksQuery) (*meilisearch.TaskInfo, error) - - // ChatCompletionStreamFunc mocks the ChatCompletionStream method. - ChatCompletionStreamFunc func(workspace string, query *meilisearch.ChatCompletionQuery) (*meilisearch.Stream[*meilisearch.ChatCompletionStreamChunk], error) - - // ChatCompletionStreamWithContextFunc mocks the ChatCompletionStreamWithContext method. - ChatCompletionStreamWithContextFunc func(ctx context.Context, workspace string, query *meilisearch.ChatCompletionQuery) (*meilisearch.Stream[*meilisearch.ChatCompletionStreamChunk], error) - - // ChatManagerFunc mocks the ChatManager method. - ChatManagerFunc func() meilisearch.ChatManager - - // ChatReaderFunc mocks the ChatReader method. - ChatReaderFunc func() meilisearch.ChatReader - - // CloseFunc mocks the Close method. - CloseFunc func() - - // CreateDumpFunc mocks the CreateDump method. - CreateDumpFunc func() (*meilisearch.TaskInfo, error) - - // CreateDumpWithContextFunc mocks the CreateDumpWithContext method. - CreateDumpWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // CreateIndexFunc mocks the CreateIndex method. - CreateIndexFunc func(config *meilisearch.IndexConfig) (*meilisearch.TaskInfo, error) - - // CreateIndexWithContextFunc mocks the CreateIndexWithContext method. - CreateIndexWithContextFunc func(ctx context.Context, config *meilisearch.IndexConfig) (*meilisearch.TaskInfo, error) - - // CreateKeyFunc mocks the CreateKey method. - CreateKeyFunc func(request *meilisearch.Key) (*meilisearch.Key, error) - - // CreateKeyWithContextFunc mocks the CreateKeyWithContext method. - CreateKeyWithContextFunc func(ctx context.Context, request *meilisearch.Key) (*meilisearch.Key, error) - - // CreateSnapshotFunc mocks the CreateSnapshot method. - CreateSnapshotFunc func() (*meilisearch.TaskInfo, error) - - // CreateSnapshotWithContextFunc mocks the CreateSnapshotWithContext method. - CreateSnapshotWithContextFunc func(ctx context.Context) (*meilisearch.TaskInfo, error) - - // DeleteIndexFunc mocks the DeleteIndex method. - DeleteIndexFunc func(uid string) (*meilisearch.TaskInfo, error) - - // DeleteIndexWithContextFunc mocks the DeleteIndexWithContext method. - DeleteIndexWithContextFunc func(ctx context.Context, uid string) (*meilisearch.TaskInfo, error) - - // DeleteKeyFunc mocks the DeleteKey method. - DeleteKeyFunc func(keyOrUID string) (bool, error) - - // DeleteKeyWithContextFunc mocks the DeleteKeyWithContext method. - DeleteKeyWithContextFunc func(ctx context.Context, keyOrUID string) (bool, error) - - // DeleteSearchRuleFunc mocks the DeleteSearchRule method. - DeleteSearchRuleFunc func(uid string) error - - // DeleteSearchRuleWithContextFunc mocks the DeleteSearchRuleWithContext method. - DeleteSearchRuleWithContextFunc func(ctx context.Context, uid string) error - - // DeleteTasksFunc mocks the DeleteTasks method. - DeleteTasksFunc func(param *meilisearch.DeleteTasksQuery) (*meilisearch.TaskInfo, error) - - // DeleteTasksWithContextFunc mocks the DeleteTasksWithContext method. - DeleteTasksWithContextFunc func(ctx context.Context, param *meilisearch.DeleteTasksQuery) (*meilisearch.TaskInfo, error) - - // DeleteWebhookFunc mocks the DeleteWebhook method. - DeleteWebhookFunc func(uuid string) error - - // DeleteWebhookWithContextFunc mocks the DeleteWebhookWithContext method. - DeleteWebhookWithContextFunc func(ctx context.Context, uuid string) error - - // ExperimentalFeaturesFunc mocks the ExperimentalFeatures method. - ExperimentalFeaturesFunc func() *meilisearch.ExperimentalFeatures - - // ExportFunc mocks the Export method. - ExportFunc func(params *meilisearch.ExportParams) (*meilisearch.TaskInfo, error) - - // ExportWithContextFunc mocks the ExportWithContext method. - ExportWithContextFunc func(ctx context.Context, params *meilisearch.ExportParams) (*meilisearch.TaskInfo, error) - - // GenerateTenantTokenFunc mocks the GenerateTenantToken method. - GenerateTenantTokenFunc func(apiKeyUID string, searchRules map[string]interface{}, options *meilisearch.TenantTokenOptions) (string, error) - - // GetBatchFunc mocks the GetBatch method. - GetBatchFunc func(batchUID int) (*meilisearch.Batch, error) - - // GetBatchWithContextFunc mocks the GetBatchWithContext method. - GetBatchWithContextFunc func(ctx context.Context, batchUID int) (*meilisearch.Batch, error) - - // GetBatchesFunc mocks the GetBatches method. - GetBatchesFunc func(param *meilisearch.BatchesQuery) (*meilisearch.BatchesResults, error) - - // GetBatchesWithContextFunc mocks the GetBatchesWithContext method. - GetBatchesWithContextFunc func(ctx context.Context, param *meilisearch.BatchesQuery) (*meilisearch.BatchesResults, error) - - // GetChatWorkspaceFunc mocks the GetChatWorkspace method. - GetChatWorkspaceFunc func(uid string) (*meilisearch.ChatWorkspace, error) - - // GetChatWorkspaceSettingsFunc mocks the GetChatWorkspaceSettings method. - GetChatWorkspaceSettingsFunc func(uid string) (*meilisearch.ChatWorkspaceSettings, error) - - // GetChatWorkspaceSettingsWithContextFunc mocks the GetChatWorkspaceSettingsWithContext method. - GetChatWorkspaceSettingsWithContextFunc func(ctx context.Context, uid string) (*meilisearch.ChatWorkspaceSettings, error) - - // GetChatWorkspaceWithContextFunc mocks the GetChatWorkspaceWithContext method. - GetChatWorkspaceWithContextFunc func(ctx context.Context, uid string) (*meilisearch.ChatWorkspace, error) - - // GetIndexFunc mocks the GetIndex method. - GetIndexFunc func(indexID string) (*meilisearch.IndexResult, error) - - // GetIndexWithContextFunc mocks the GetIndexWithContext method. - GetIndexWithContextFunc func(ctx context.Context, indexID string) (*meilisearch.IndexResult, error) - - // GetKeyFunc mocks the GetKey method. - GetKeyFunc func(identifier string) (*meilisearch.Key, error) - - // GetKeyWithContextFunc mocks the GetKeyWithContext method. - GetKeyWithContextFunc func(ctx context.Context, identifier string) (*meilisearch.Key, error) - - // GetKeysFunc mocks the GetKeys method. - GetKeysFunc func(param *meilisearch.KeysQuery) (*meilisearch.KeysResults, error) - - // GetKeysWithContextFunc mocks the GetKeysWithContext method. - GetKeysWithContextFunc func(ctx context.Context, param *meilisearch.KeysQuery) (*meilisearch.KeysResults, error) - - // GetNetworkFunc mocks the GetNetwork method. - GetNetworkFunc func() (*meilisearch.Network, error) - - // GetNetworkWithContextFunc mocks the GetNetworkWithContext method. - GetNetworkWithContextFunc func(ctx context.Context) (*meilisearch.Network, error) - - // GetRawIndexFunc mocks the GetRawIndex method. - GetRawIndexFunc func(uid string) (map[string]interface{}, error) - - // GetRawIndexWithContextFunc mocks the GetRawIndexWithContext method. - GetRawIndexWithContextFunc func(ctx context.Context, uid string) (map[string]interface{}, error) - - // GetRawIndexesFunc mocks the GetRawIndexes method. - GetRawIndexesFunc func(param *meilisearch.IndexesQuery) (map[string]interface{}, error) - - // GetRawIndexesWithContextFunc mocks the GetRawIndexesWithContext method. - GetRawIndexesWithContextFunc func(ctx context.Context, param *meilisearch.IndexesQuery) (map[string]interface{}, error) - - // GetSearchRuleFunc mocks the GetSearchRule method. - GetSearchRuleFunc func(uid string) (*meilisearch.SearchRule, error) - - // GetSearchRuleWithContextFunc mocks the GetSearchRuleWithContext method. - GetSearchRuleWithContextFunc func(ctx context.Context, uid string) (*meilisearch.SearchRule, error) - - // GetStatsFunc mocks the GetStats method. - GetStatsFunc func(param *meilisearch.StatsParams) (*meilisearch.Stats, error) - - // GetStatsWithContextFunc mocks the GetStatsWithContext method. - GetStatsWithContextFunc func(ctx context.Context, param *meilisearch.StatsParams) (*meilisearch.Stats, error) - - // GetTaskFunc mocks the GetTask method. - GetTaskFunc func(taskUID int64) (*meilisearch.Task, error) - - // GetTaskDocumentsFunc mocks the GetTaskDocuments method. - GetTaskDocumentsFunc func(taskUID int64, dst interface{}) error - - // GetTaskDocumentsWithContextFunc mocks the GetTaskDocumentsWithContext method. - GetTaskDocumentsWithContextFunc func(ctx context.Context, taskUID int64, dst interface{}) error - - // GetTaskWithContextFunc mocks the GetTaskWithContext method. - GetTaskWithContextFunc func(ctx context.Context, taskUID int64) (*meilisearch.Task, error) - - // GetTasksFunc mocks the GetTasks method. - GetTasksFunc func(param *meilisearch.TasksQuery) (*meilisearch.TaskResult, error) - - // GetTasksWithContextFunc mocks the GetTasksWithContext method. - GetTasksWithContextFunc func(ctx context.Context, param *meilisearch.TasksQuery) (*meilisearch.TaskResult, error) - - // GetWebhookFunc mocks the GetWebhook method. - GetWebhookFunc func(uuid string) (*meilisearch.Webhook, error) - - // GetWebhookWithContextFunc mocks the GetWebhookWithContext method. - GetWebhookWithContextFunc func(ctx context.Context, uuid string) (*meilisearch.Webhook, error) - - // HealthFunc mocks the Health method. - HealthFunc func() (*meilisearch.Health, error) - - // HealthWithContextFunc mocks the HealthWithContext method. - HealthWithContextFunc func(ctx context.Context) (*meilisearch.Health, error) - - // IndexFunc mocks the Index method. - IndexFunc func(uid string) meilisearch.IndexManager - - // IsHealthyFunc mocks the IsHealthy method. - IsHealthyFunc func() bool - - // KeyManagerFunc mocks the KeyManager method. - KeyManagerFunc func() meilisearch.KeyManager - - // KeyReaderFunc mocks the KeyReader method. - KeyReaderFunc func() meilisearch.KeyReader - - // ListChatWorkspacesFunc mocks the ListChatWorkspaces method. - ListChatWorkspacesFunc func(query *meilisearch.ListChatWorkSpaceQuery) (*meilisearch.ListChatWorkspace, error) - - // ListChatWorkspacesWithContextFunc mocks the ListChatWorkspacesWithContext method. - ListChatWorkspacesWithContextFunc func(ctx context.Context, query *meilisearch.ListChatWorkSpaceQuery) (*meilisearch.ListChatWorkspace, error) - - // ListIndexesFunc mocks the ListIndexes method. - ListIndexesFunc func(param *meilisearch.IndexesQuery) (*meilisearch.IndexesResults, error) - - // ListIndexesWithContextFunc mocks the ListIndexesWithContext method. - ListIndexesWithContextFunc func(ctx context.Context, param *meilisearch.IndexesQuery) (*meilisearch.IndexesResults, error) - - // ListSearchRulesFunc mocks the ListSearchRules method. - ListSearchRulesFunc func(params *meilisearch.SearchRulesParams) (*meilisearch.SearchRulesResults, error) - - // ListSearchRulesWithContextFunc mocks the ListSearchRulesWithContext method. - ListSearchRulesWithContextFunc func(ctx context.Context, params *meilisearch.SearchRulesParams) (*meilisearch.SearchRulesResults, error) - - // ListWebhooksFunc mocks the ListWebhooks method. - ListWebhooksFunc func() (*meilisearch.WebhookResults, error) - - // ListWebhooksWithContextFunc mocks the ListWebhooksWithContext method. - ListWebhooksWithContextFunc func(ctx context.Context) (*meilisearch.WebhookResults, error) - - // MultiSearchFunc mocks the MultiSearch method. - MultiSearchFunc func(queries *meilisearch.MultiSearchRequest) (*meilisearch.MultiSearchResponse, error) - - // MultiSearchWithContextFunc mocks the MultiSearchWithContext method. - MultiSearchWithContextFunc func(ctx context.Context, queries *meilisearch.MultiSearchRequest) (*meilisearch.MultiSearchResponse, error) - - // ResetChatWorkspaceFunc mocks the ResetChatWorkspace method. - ResetChatWorkspaceFunc func(uid string) (*meilisearch.ChatWorkspaceSettings, error) - - // ResetChatWorkspaceWithContextFunc mocks the ResetChatWorkspaceWithContext method. - ResetChatWorkspaceWithContextFunc func(ctx context.Context, uid string) (*meilisearch.ChatWorkspaceSettings, error) - - // SearchRulesManagerFunc mocks the SearchRulesManager method. - SearchRulesManagerFunc func() meilisearch.SearchRulesManager - - // SearchRulesReaderFunc mocks the SearchRulesReader method. - SearchRulesReaderFunc func() meilisearch.SearchRulesReader - - // ServiceReaderFunc mocks the ServiceReader method. - ServiceReaderFunc func() meilisearch.ServiceReader - - // SwapIndexesFunc mocks the SwapIndexes method. - SwapIndexesFunc func(param []*meilisearch.SwapIndexesParams) (*meilisearch.TaskInfo, error) - - // SwapIndexesWithContextFunc mocks the SwapIndexesWithContext method. - SwapIndexesWithContextFunc func(ctx context.Context, param []*meilisearch.SwapIndexesParams) (*meilisearch.TaskInfo, error) - - // TaskManagerFunc mocks the TaskManager method. - TaskManagerFunc func() meilisearch.TaskManager - - // TaskReaderFunc mocks the TaskReader method. - TaskReaderFunc func() meilisearch.TaskReader - - // UpdateChatWorkspaceFunc mocks the UpdateChatWorkspace method. - UpdateChatWorkspaceFunc func(uid string, settings *meilisearch.ChatWorkspaceSettings) (*meilisearch.ChatWorkspaceSettings, error) - - // UpdateChatWorkspaceWithContextFunc mocks the UpdateChatWorkspaceWithContext method. - UpdateChatWorkspaceWithContextFunc func(ctx context.Context, uid string, settings *meilisearch.ChatWorkspaceSettings) (*meilisearch.ChatWorkspaceSettings, error) - - // UpdateKeyFunc mocks the UpdateKey method. - UpdateKeyFunc func(keyOrUID string, request *meilisearch.Key) (*meilisearch.Key, error) - - // UpdateKeyWithContextFunc mocks the UpdateKeyWithContext method. - UpdateKeyWithContextFunc func(ctx context.Context, keyOrUID string, request *meilisearch.Key) (*meilisearch.Key, error) - - // UpdateNetworkFunc mocks the UpdateNetwork method. - UpdateNetworkFunc func(params *meilisearch.UpdateNetworkRequest) (any, error) - - // UpdateNetworkWithContextFunc mocks the UpdateNetworkWithContext method. - UpdateNetworkWithContextFunc func(ctx context.Context, params *meilisearch.UpdateNetworkRequest) (any, error) - - // UpdateSearchRuleFunc mocks the UpdateSearchRule method. - UpdateSearchRuleFunc func(uid string, params *meilisearch.SearchRulesRequest) (*meilisearch.SearchRule, error) - - // UpdateSearchRuleWithContextFunc mocks the UpdateSearchRuleWithContext method. - UpdateSearchRuleWithContextFunc func(ctx context.Context, uid string, params *meilisearch.SearchRulesRequest) (*meilisearch.SearchRule, error) - - // UpdateWebhookFunc mocks the UpdateWebhook method. - UpdateWebhookFunc func(uuid string, params *meilisearch.UpdateWebhookRequest) (*meilisearch.Webhook, error) - - // UpdateWebhookWithContextFunc mocks the UpdateWebhookWithContext method. - UpdateWebhookWithContextFunc func(ctx context.Context, uuid string, params *meilisearch.UpdateWebhookRequest) (*meilisearch.Webhook, error) - - // VersionFunc mocks the Version method. - VersionFunc func() (*meilisearch.Version, error) - - // VersionWithContextFunc mocks the VersionWithContext method. - VersionWithContextFunc func(ctx context.Context) (*meilisearch.Version, error) - - // WaitForTaskFunc mocks the WaitForTask method. - WaitForTaskFunc func(taskUID int64, interval time.Duration) (*meilisearch.Task, error) - - // WaitForTaskWithContextFunc mocks the WaitForTaskWithContext method. - WaitForTaskWithContextFunc func(ctx context.Context, taskUID int64, interval time.Duration) (*meilisearch.Task, error) - - // WebhookManagerFunc mocks the WebhookManager method. - WebhookManagerFunc func() meilisearch.WebhookManager - - // WebhookReaderFunc mocks the WebhookReader method. - WebhookReaderFunc func() meilisearch.WebhookReader - - // calls tracks calls to the methods. - calls struct { - // AddWebhook holds details about calls to the AddWebhook method. - AddWebhook []struct { - // Params is the params argument value. - Params *meilisearch.AddWebhookRequest - } - // AddWebhookWithContext holds details about calls to the AddWebhookWithContext method. - AddWebhookWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Params is the params argument value. - Params *meilisearch.AddWebhookRequest - } - // CancelTasks holds details about calls to the CancelTasks method. - CancelTasks []struct { - // Param is the param argument value. - Param *meilisearch.CancelTasksQuery - } - // CancelTasksWithContext holds details about calls to the CancelTasksWithContext method. - CancelTasksWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Param is the param argument value. - Param *meilisearch.CancelTasksQuery - } - // ChatCompletionStream holds details about calls to the ChatCompletionStream method. - ChatCompletionStream []struct { - // Workspace is the workspace argument value. - Workspace string - // Query is the query argument value. - Query *meilisearch.ChatCompletionQuery - } - // ChatCompletionStreamWithContext holds details about calls to the ChatCompletionStreamWithContext method. - ChatCompletionStreamWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Workspace is the workspace argument value. - Workspace string - // Query is the query argument value. - Query *meilisearch.ChatCompletionQuery - } - // ChatManager holds details about calls to the ChatManager method. - ChatManager []struct { - } - // ChatReader holds details about calls to the ChatReader method. - ChatReader []struct { - } - // Close holds details about calls to the Close method. - Close []struct { - } - // CreateDump holds details about calls to the CreateDump method. - CreateDump []struct { - } - // CreateDumpWithContext holds details about calls to the CreateDumpWithContext method. - CreateDumpWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // CreateIndex holds details about calls to the CreateIndex method. - CreateIndex []struct { - // Config is the config argument value. - Config *meilisearch.IndexConfig - } - // CreateIndexWithContext holds details about calls to the CreateIndexWithContext method. - CreateIndexWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Config is the config argument value. - Config *meilisearch.IndexConfig - } - // CreateKey holds details about calls to the CreateKey method. - CreateKey []struct { - // Request is the request argument value. - Request *meilisearch.Key - } - // CreateKeyWithContext holds details about calls to the CreateKeyWithContext method. - CreateKeyWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Request is the request argument value. - Request *meilisearch.Key - } - // CreateSnapshot holds details about calls to the CreateSnapshot method. - CreateSnapshot []struct { - } - // CreateSnapshotWithContext holds details about calls to the CreateSnapshotWithContext method. - CreateSnapshotWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // DeleteIndex holds details about calls to the DeleteIndex method. - DeleteIndex []struct { - // UID is the uid argument value. - UID string - } - // DeleteIndexWithContext holds details about calls to the DeleteIndexWithContext method. - DeleteIndexWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // UID is the uid argument value. - UID string - } - // DeleteKey holds details about calls to the DeleteKey method. - DeleteKey []struct { - // KeyOrUID is the keyOrUID argument value. - KeyOrUID string - } - // DeleteKeyWithContext holds details about calls to the DeleteKeyWithContext method. - DeleteKeyWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // KeyOrUID is the keyOrUID argument value. - KeyOrUID string - } - // DeleteSearchRule holds details about calls to the DeleteSearchRule method. - DeleteSearchRule []struct { - // UID is the uid argument value. - UID string - } - // DeleteSearchRuleWithContext holds details about calls to the DeleteSearchRuleWithContext method. - DeleteSearchRuleWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // UID is the uid argument value. - UID string - } - // DeleteTasks holds details about calls to the DeleteTasks method. - DeleteTasks []struct { - // Param is the param argument value. - Param *meilisearch.DeleteTasksQuery - } - // DeleteTasksWithContext holds details about calls to the DeleteTasksWithContext method. - DeleteTasksWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Param is the param argument value. - Param *meilisearch.DeleteTasksQuery - } - // DeleteWebhook holds details about calls to the DeleteWebhook method. - DeleteWebhook []struct { - // UUID is the uuid argument value. - UUID string - } - // DeleteWebhookWithContext holds details about calls to the DeleteWebhookWithContext method. - DeleteWebhookWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // UUID is the uuid argument value. - UUID string - } - // ExperimentalFeatures holds details about calls to the ExperimentalFeatures method. - ExperimentalFeatures []struct { - } - // Export holds details about calls to the Export method. - Export []struct { - // Params is the params argument value. - Params *meilisearch.ExportParams - } - // ExportWithContext holds details about calls to the ExportWithContext method. - ExportWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Params is the params argument value. - Params *meilisearch.ExportParams - } - // GenerateTenantToken holds details about calls to the GenerateTenantToken method. - GenerateTenantToken []struct { - // ApiKeyUID is the apiKeyUID argument value. - ApiKeyUID string - // SearchRules is the searchRules argument value. - SearchRules map[string]interface{} - // Options is the options argument value. - Options *meilisearch.TenantTokenOptions - } - // GetBatch holds details about calls to the GetBatch method. - GetBatch []struct { - // BatchUID is the batchUID argument value. - BatchUID int - } - // GetBatchWithContext holds details about calls to the GetBatchWithContext method. - GetBatchWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // BatchUID is the batchUID argument value. - BatchUID int - } - // GetBatches holds details about calls to the GetBatches method. - GetBatches []struct { - // Param is the param argument value. - Param *meilisearch.BatchesQuery - } - // GetBatchesWithContext holds details about calls to the GetBatchesWithContext method. - GetBatchesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Param is the param argument value. - Param *meilisearch.BatchesQuery - } - // GetChatWorkspace holds details about calls to the GetChatWorkspace method. - GetChatWorkspace []struct { - // UID is the uid argument value. - UID string - } - // GetChatWorkspaceSettings holds details about calls to the GetChatWorkspaceSettings method. - GetChatWorkspaceSettings []struct { - // UID is the uid argument value. - UID string - } - // GetChatWorkspaceSettingsWithContext holds details about calls to the GetChatWorkspaceSettingsWithContext method. - GetChatWorkspaceSettingsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // UID is the uid argument value. - UID string - } - // GetChatWorkspaceWithContext holds details about calls to the GetChatWorkspaceWithContext method. - GetChatWorkspaceWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // UID is the uid argument value. - UID string - } - // GetIndex holds details about calls to the GetIndex method. - GetIndex []struct { - // IndexID is the indexID argument value. - IndexID string - } - // GetIndexWithContext holds details about calls to the GetIndexWithContext method. - GetIndexWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // IndexID is the indexID argument value. - IndexID string - } - // GetKey holds details about calls to the GetKey method. - GetKey []struct { - // Identifier is the identifier argument value. - Identifier string - } - // GetKeyWithContext holds details about calls to the GetKeyWithContext method. - GetKeyWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Identifier is the identifier argument value. - Identifier string - } - // GetKeys holds details about calls to the GetKeys method. - GetKeys []struct { - // Param is the param argument value. - Param *meilisearch.KeysQuery - } - // GetKeysWithContext holds details about calls to the GetKeysWithContext method. - GetKeysWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Param is the param argument value. - Param *meilisearch.KeysQuery - } - // GetNetwork holds details about calls to the GetNetwork method. - GetNetwork []struct { - } - // GetNetworkWithContext holds details about calls to the GetNetworkWithContext method. - GetNetworkWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // GetRawIndex holds details about calls to the GetRawIndex method. - GetRawIndex []struct { - // UID is the uid argument value. - UID string - } - // GetRawIndexWithContext holds details about calls to the GetRawIndexWithContext method. - GetRawIndexWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // UID is the uid argument value. - UID string - } - // GetRawIndexes holds details about calls to the GetRawIndexes method. - GetRawIndexes []struct { - // Param is the param argument value. - Param *meilisearch.IndexesQuery - } - // GetRawIndexesWithContext holds details about calls to the GetRawIndexesWithContext method. - GetRawIndexesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Param is the param argument value. - Param *meilisearch.IndexesQuery - } - // GetSearchRule holds details about calls to the GetSearchRule method. - GetSearchRule []struct { - // UID is the uid argument value. - UID string - } - // GetSearchRuleWithContext holds details about calls to the GetSearchRuleWithContext method. - GetSearchRuleWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // UID is the uid argument value. - UID string - } - // GetStats holds details about calls to the GetStats method. - GetStats []struct { - // Param is the param argument value. - Param *meilisearch.StatsParams - } - // GetStatsWithContext holds details about calls to the GetStatsWithContext method. - GetStatsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Param is the param argument value. - Param *meilisearch.StatsParams - } - // GetTask holds details about calls to the GetTask method. - GetTask []struct { - // TaskUID is the taskUID argument value. - TaskUID int64 - } - // GetTaskDocuments holds details about calls to the GetTaskDocuments method. - GetTaskDocuments []struct { - // TaskUID is the taskUID argument value. - TaskUID int64 - // Dst is the dst argument value. - Dst interface{} - } - // GetTaskDocumentsWithContext holds details about calls to the GetTaskDocumentsWithContext method. - GetTaskDocumentsWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // TaskUID is the taskUID argument value. - TaskUID int64 - // Dst is the dst argument value. - Dst interface{} - } - // GetTaskWithContext holds details about calls to the GetTaskWithContext method. - GetTaskWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // TaskUID is the taskUID argument value. - TaskUID int64 - } - // GetTasks holds details about calls to the GetTasks method. - GetTasks []struct { - // Param is the param argument value. - Param *meilisearch.TasksQuery - } - // GetTasksWithContext holds details about calls to the GetTasksWithContext method. - GetTasksWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Param is the param argument value. - Param *meilisearch.TasksQuery - } - // GetWebhook holds details about calls to the GetWebhook method. - GetWebhook []struct { - // UUID is the uuid argument value. - UUID string - } - // GetWebhookWithContext holds details about calls to the GetWebhookWithContext method. - GetWebhookWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // UUID is the uuid argument value. - UUID string - } - // Health holds details about calls to the Health method. - Health []struct { - } - // HealthWithContext holds details about calls to the HealthWithContext method. - HealthWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // Index holds details about calls to the Index method. - Index []struct { - // UID is the uid argument value. - UID string - } - // IsHealthy holds details about calls to the IsHealthy method. - IsHealthy []struct { - } - // KeyManager holds details about calls to the KeyManager method. - KeyManager []struct { - } - // KeyReader holds details about calls to the KeyReader method. - KeyReader []struct { - } - // ListChatWorkspaces holds details about calls to the ListChatWorkspaces method. - ListChatWorkspaces []struct { - // Query is the query argument value. - Query *meilisearch.ListChatWorkSpaceQuery - } - // ListChatWorkspacesWithContext holds details about calls to the ListChatWorkspacesWithContext method. - ListChatWorkspacesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Query is the query argument value. - Query *meilisearch.ListChatWorkSpaceQuery - } - // ListIndexes holds details about calls to the ListIndexes method. - ListIndexes []struct { - // Param is the param argument value. - Param *meilisearch.IndexesQuery - } - // ListIndexesWithContext holds details about calls to the ListIndexesWithContext method. - ListIndexesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Param is the param argument value. - Param *meilisearch.IndexesQuery - } - // ListSearchRules holds details about calls to the ListSearchRules method. - ListSearchRules []struct { - // Params is the params argument value. - Params *meilisearch.SearchRulesParams - } - // ListSearchRulesWithContext holds details about calls to the ListSearchRulesWithContext method. - ListSearchRulesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Params is the params argument value. - Params *meilisearch.SearchRulesParams - } - // ListWebhooks holds details about calls to the ListWebhooks method. - ListWebhooks []struct { - } - // ListWebhooksWithContext holds details about calls to the ListWebhooksWithContext method. - ListWebhooksWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // MultiSearch holds details about calls to the MultiSearch method. - MultiSearch []struct { - // Queries is the queries argument value. - Queries *meilisearch.MultiSearchRequest - } - // MultiSearchWithContext holds details about calls to the MultiSearchWithContext method. - MultiSearchWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Queries is the queries argument value. - Queries *meilisearch.MultiSearchRequest - } - // ResetChatWorkspace holds details about calls to the ResetChatWorkspace method. - ResetChatWorkspace []struct { - // UID is the uid argument value. - UID string - } - // ResetChatWorkspaceWithContext holds details about calls to the ResetChatWorkspaceWithContext method. - ResetChatWorkspaceWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // UID is the uid argument value. - UID string - } - // SearchRulesManager holds details about calls to the SearchRulesManager method. - SearchRulesManager []struct { - } - // SearchRulesReader holds details about calls to the SearchRulesReader method. - SearchRulesReader []struct { - } - // ServiceReader holds details about calls to the ServiceReader method. - ServiceReader []struct { - } - // SwapIndexes holds details about calls to the SwapIndexes method. - SwapIndexes []struct { - // Param is the param argument value. - Param []*meilisearch.SwapIndexesParams - } - // SwapIndexesWithContext holds details about calls to the SwapIndexesWithContext method. - SwapIndexesWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Param is the param argument value. - Param []*meilisearch.SwapIndexesParams - } - // TaskManager holds details about calls to the TaskManager method. - TaskManager []struct { - } - // TaskReader holds details about calls to the TaskReader method. - TaskReader []struct { - } - // UpdateChatWorkspace holds details about calls to the UpdateChatWorkspace method. - UpdateChatWorkspace []struct { - // UID is the uid argument value. - UID string - // Settings is the settings argument value. - Settings *meilisearch.ChatWorkspaceSettings - } - // UpdateChatWorkspaceWithContext holds details about calls to the UpdateChatWorkspaceWithContext method. - UpdateChatWorkspaceWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // UID is the uid argument value. - UID string - // Settings is the settings argument value. - Settings *meilisearch.ChatWorkspaceSettings - } - // UpdateKey holds details about calls to the UpdateKey method. - UpdateKey []struct { - // KeyOrUID is the keyOrUID argument value. - KeyOrUID string - // Request is the request argument value. - Request *meilisearch.Key - } - // UpdateKeyWithContext holds details about calls to the UpdateKeyWithContext method. - UpdateKeyWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // KeyOrUID is the keyOrUID argument value. - KeyOrUID string - // Request is the request argument value. - Request *meilisearch.Key - } - // UpdateNetwork holds details about calls to the UpdateNetwork method. - UpdateNetwork []struct { - // Params is the params argument value. - Params *meilisearch.UpdateNetworkRequest - } - // UpdateNetworkWithContext holds details about calls to the UpdateNetworkWithContext method. - UpdateNetworkWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Params is the params argument value. - Params *meilisearch.UpdateNetworkRequest - } - // UpdateSearchRule holds details about calls to the UpdateSearchRule method. - UpdateSearchRule []struct { - // UID is the uid argument value. - UID string - // Params is the params argument value. - Params *meilisearch.SearchRulesRequest - } - // UpdateSearchRuleWithContext holds details about calls to the UpdateSearchRuleWithContext method. - UpdateSearchRuleWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // UID is the uid argument value. - UID string - // Params is the params argument value. - Params *meilisearch.SearchRulesRequest - } - // UpdateWebhook holds details about calls to the UpdateWebhook method. - UpdateWebhook []struct { - // UUID is the uuid argument value. - UUID string - // Params is the params argument value. - Params *meilisearch.UpdateWebhookRequest - } - // UpdateWebhookWithContext holds details about calls to the UpdateWebhookWithContext method. - UpdateWebhookWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // UUID is the uuid argument value. - UUID string - // Params is the params argument value. - Params *meilisearch.UpdateWebhookRequest - } - // Version holds details about calls to the Version method. - Version []struct { - } - // VersionWithContext holds details about calls to the VersionWithContext method. - VersionWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // WaitForTask holds details about calls to the WaitForTask method. - WaitForTask []struct { - // TaskUID is the taskUID argument value. - TaskUID int64 - // Interval is the interval argument value. - Interval time.Duration - } - // WaitForTaskWithContext holds details about calls to the WaitForTaskWithContext method. - WaitForTaskWithContext []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // TaskUID is the taskUID argument value. - TaskUID int64 - // Interval is the interval argument value. - Interval time.Duration - } - // WebhookManager holds details about calls to the WebhookManager method. - WebhookManager []struct { - } - // WebhookReader holds details about calls to the WebhookReader method. - WebhookReader []struct { - } - } - lockAddWebhook sync.RWMutex - lockAddWebhookWithContext sync.RWMutex - lockCancelTasks sync.RWMutex - lockCancelTasksWithContext sync.RWMutex - lockChatCompletionStream sync.RWMutex - lockChatCompletionStreamWithContext sync.RWMutex - lockChatManager sync.RWMutex - lockChatReader sync.RWMutex - lockClose sync.RWMutex - lockCreateDump sync.RWMutex - lockCreateDumpWithContext sync.RWMutex - lockCreateIndex sync.RWMutex - lockCreateIndexWithContext sync.RWMutex - lockCreateKey sync.RWMutex - lockCreateKeyWithContext sync.RWMutex - lockCreateSnapshot sync.RWMutex - lockCreateSnapshotWithContext sync.RWMutex - lockDeleteIndex sync.RWMutex - lockDeleteIndexWithContext sync.RWMutex - lockDeleteKey sync.RWMutex - lockDeleteKeyWithContext sync.RWMutex - lockDeleteSearchRule sync.RWMutex - lockDeleteSearchRuleWithContext sync.RWMutex - lockDeleteTasks sync.RWMutex - lockDeleteTasksWithContext sync.RWMutex - lockDeleteWebhook sync.RWMutex - lockDeleteWebhookWithContext sync.RWMutex - lockExperimentalFeatures sync.RWMutex - lockExport sync.RWMutex - lockExportWithContext sync.RWMutex - lockGenerateTenantToken sync.RWMutex - lockGetBatch sync.RWMutex - lockGetBatchWithContext sync.RWMutex - lockGetBatches sync.RWMutex - lockGetBatchesWithContext sync.RWMutex - lockGetChatWorkspace sync.RWMutex - lockGetChatWorkspaceSettings sync.RWMutex - lockGetChatWorkspaceSettingsWithContext sync.RWMutex - lockGetChatWorkspaceWithContext sync.RWMutex - lockGetIndex sync.RWMutex - lockGetIndexWithContext sync.RWMutex - lockGetKey sync.RWMutex - lockGetKeyWithContext sync.RWMutex - lockGetKeys sync.RWMutex - lockGetKeysWithContext sync.RWMutex - lockGetNetwork sync.RWMutex - lockGetNetworkWithContext sync.RWMutex - lockGetRawIndex sync.RWMutex - lockGetRawIndexWithContext sync.RWMutex - lockGetRawIndexes sync.RWMutex - lockGetRawIndexesWithContext sync.RWMutex - lockGetSearchRule sync.RWMutex - lockGetSearchRuleWithContext sync.RWMutex - lockGetStats sync.RWMutex - lockGetStatsWithContext sync.RWMutex - lockGetTask sync.RWMutex - lockGetTaskDocuments sync.RWMutex - lockGetTaskDocumentsWithContext sync.RWMutex - lockGetTaskWithContext sync.RWMutex - lockGetTasks sync.RWMutex - lockGetTasksWithContext sync.RWMutex - lockGetWebhook sync.RWMutex - lockGetWebhookWithContext sync.RWMutex - lockHealth sync.RWMutex - lockHealthWithContext sync.RWMutex - lockIndex sync.RWMutex - lockIsHealthy sync.RWMutex - lockKeyManager sync.RWMutex - lockKeyReader sync.RWMutex - lockListChatWorkspaces sync.RWMutex - lockListChatWorkspacesWithContext sync.RWMutex - lockListIndexes sync.RWMutex - lockListIndexesWithContext sync.RWMutex - lockListSearchRules sync.RWMutex - lockListSearchRulesWithContext sync.RWMutex - lockListWebhooks sync.RWMutex - lockListWebhooksWithContext sync.RWMutex - lockMultiSearch sync.RWMutex - lockMultiSearchWithContext sync.RWMutex - lockResetChatWorkspace sync.RWMutex - lockResetChatWorkspaceWithContext sync.RWMutex - lockSearchRulesManager sync.RWMutex - lockSearchRulesReader sync.RWMutex - lockServiceReader sync.RWMutex - lockSwapIndexes sync.RWMutex - lockSwapIndexesWithContext sync.RWMutex - lockTaskManager sync.RWMutex - lockTaskReader sync.RWMutex - lockUpdateChatWorkspace sync.RWMutex - lockUpdateChatWorkspaceWithContext sync.RWMutex - lockUpdateKey sync.RWMutex - lockUpdateKeyWithContext sync.RWMutex - lockUpdateNetwork sync.RWMutex - lockUpdateNetworkWithContext sync.RWMutex - lockUpdateSearchRule sync.RWMutex - lockUpdateSearchRuleWithContext sync.RWMutex - lockUpdateWebhook sync.RWMutex - lockUpdateWebhookWithContext sync.RWMutex - lockVersion sync.RWMutex - lockVersionWithContext sync.RWMutex - lockWaitForTask sync.RWMutex - lockWaitForTaskWithContext sync.RWMutex - lockWebhookManager sync.RWMutex - lockWebhookReader sync.RWMutex -} - -// AddWebhook calls AddWebhookFunc. -func (mock *MeiliServiceManager) AddWebhook(params *meilisearch.AddWebhookRequest) (*meilisearch.Webhook, error) { - callInfo := struct { - Params *meilisearch.AddWebhookRequest - }{ - Params: params, - } - mock.lockAddWebhook.Lock() - mock.calls.AddWebhook = append(mock.calls.AddWebhook, callInfo) - mock.lockAddWebhook.Unlock() - if mock.AddWebhookFunc == nil { - var ( - webhookOut *meilisearch.Webhook - errOut error - ) - return webhookOut, errOut - } - return mock.AddWebhookFunc(params) -} - -// AddWebhookCalls gets all the calls that were made to AddWebhook. -// Check the length with: -// -// len(mockedServiceManager.AddWebhookCalls()) -func (mock *MeiliServiceManager) AddWebhookCalls() []struct { - Params *meilisearch.AddWebhookRequest -} { - var calls []struct { - Params *meilisearch.AddWebhookRequest - } - mock.lockAddWebhook.RLock() - calls = mock.calls.AddWebhook - mock.lockAddWebhook.RUnlock() - return calls -} - -// AddWebhookWithContext calls AddWebhookWithContextFunc. -func (mock *MeiliServiceManager) AddWebhookWithContext(ctx context.Context, params *meilisearch.AddWebhookRequest) (*meilisearch.Webhook, error) { - callInfo := struct { - Ctx context.Context - Params *meilisearch.AddWebhookRequest - }{ - Ctx: ctx, - Params: params, - } - mock.lockAddWebhookWithContext.Lock() - mock.calls.AddWebhookWithContext = append(mock.calls.AddWebhookWithContext, callInfo) - mock.lockAddWebhookWithContext.Unlock() - if mock.AddWebhookWithContextFunc == nil { - var ( - webhookOut *meilisearch.Webhook - errOut error - ) - return webhookOut, errOut - } - return mock.AddWebhookWithContextFunc(ctx, params) -} - -// AddWebhookWithContextCalls gets all the calls that were made to AddWebhookWithContext. -// Check the length with: -// -// len(mockedServiceManager.AddWebhookWithContextCalls()) -func (mock *MeiliServiceManager) AddWebhookWithContextCalls() []struct { - Ctx context.Context - Params *meilisearch.AddWebhookRequest -} { - var calls []struct { - Ctx context.Context - Params *meilisearch.AddWebhookRequest - } - mock.lockAddWebhookWithContext.RLock() - calls = mock.calls.AddWebhookWithContext - mock.lockAddWebhookWithContext.RUnlock() - return calls -} - -// CancelTasks calls CancelTasksFunc. -func (mock *MeiliServiceManager) CancelTasks(param *meilisearch.CancelTasksQuery) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Param *meilisearch.CancelTasksQuery - }{ - Param: param, - } - mock.lockCancelTasks.Lock() - mock.calls.CancelTasks = append(mock.calls.CancelTasks, callInfo) - mock.lockCancelTasks.Unlock() - if mock.CancelTasksFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.CancelTasksFunc(param) -} - -// CancelTasksCalls gets all the calls that were made to CancelTasks. -// Check the length with: -// -// len(mockedServiceManager.CancelTasksCalls()) -func (mock *MeiliServiceManager) CancelTasksCalls() []struct { - Param *meilisearch.CancelTasksQuery -} { - var calls []struct { - Param *meilisearch.CancelTasksQuery - } - mock.lockCancelTasks.RLock() - calls = mock.calls.CancelTasks - mock.lockCancelTasks.RUnlock() - return calls -} - -// CancelTasksWithContext calls CancelTasksWithContextFunc. -func (mock *MeiliServiceManager) CancelTasksWithContext(ctx context.Context, param *meilisearch.CancelTasksQuery) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Param *meilisearch.CancelTasksQuery - }{ - Ctx: ctx, - Param: param, - } - mock.lockCancelTasksWithContext.Lock() - mock.calls.CancelTasksWithContext = append(mock.calls.CancelTasksWithContext, callInfo) - mock.lockCancelTasksWithContext.Unlock() - if mock.CancelTasksWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.CancelTasksWithContextFunc(ctx, param) -} - -// CancelTasksWithContextCalls gets all the calls that were made to CancelTasksWithContext. -// Check the length with: -// -// len(mockedServiceManager.CancelTasksWithContextCalls()) -func (mock *MeiliServiceManager) CancelTasksWithContextCalls() []struct { - Ctx context.Context - Param *meilisearch.CancelTasksQuery -} { - var calls []struct { - Ctx context.Context - Param *meilisearch.CancelTasksQuery - } - mock.lockCancelTasksWithContext.RLock() - calls = mock.calls.CancelTasksWithContext - mock.lockCancelTasksWithContext.RUnlock() - return calls -} - -// ChatCompletionStream calls ChatCompletionStreamFunc. -func (mock *MeiliServiceManager) ChatCompletionStream(workspace string, query *meilisearch.ChatCompletionQuery) (*meilisearch.Stream[*meilisearch.ChatCompletionStreamChunk], error) { - callInfo := struct { - Workspace string - Query *meilisearch.ChatCompletionQuery - }{ - Workspace: workspace, - Query: query, - } - mock.lockChatCompletionStream.Lock() - mock.calls.ChatCompletionStream = append(mock.calls.ChatCompletionStream, callInfo) - mock.lockChatCompletionStream.Unlock() - if mock.ChatCompletionStreamFunc == nil { - var ( - streamOut *meilisearch.Stream[*meilisearch.ChatCompletionStreamChunk] - errOut error - ) - return streamOut, errOut - } - return mock.ChatCompletionStreamFunc(workspace, query) -} - -// ChatCompletionStreamCalls gets all the calls that were made to ChatCompletionStream. -// Check the length with: -// -// len(mockedServiceManager.ChatCompletionStreamCalls()) -func (mock *MeiliServiceManager) ChatCompletionStreamCalls() []struct { - Workspace string - Query *meilisearch.ChatCompletionQuery -} { - var calls []struct { - Workspace string - Query *meilisearch.ChatCompletionQuery - } - mock.lockChatCompletionStream.RLock() - calls = mock.calls.ChatCompletionStream - mock.lockChatCompletionStream.RUnlock() - return calls -} - -// ChatCompletionStreamWithContext calls ChatCompletionStreamWithContextFunc. -func (mock *MeiliServiceManager) ChatCompletionStreamWithContext(ctx context.Context, workspace string, query *meilisearch.ChatCompletionQuery) (*meilisearch.Stream[*meilisearch.ChatCompletionStreamChunk], error) { - callInfo := struct { - Ctx context.Context - Workspace string - Query *meilisearch.ChatCompletionQuery - }{ - Ctx: ctx, - Workspace: workspace, - Query: query, - } - mock.lockChatCompletionStreamWithContext.Lock() - mock.calls.ChatCompletionStreamWithContext = append(mock.calls.ChatCompletionStreamWithContext, callInfo) - mock.lockChatCompletionStreamWithContext.Unlock() - if mock.ChatCompletionStreamWithContextFunc == nil { - var ( - streamOut *meilisearch.Stream[*meilisearch.ChatCompletionStreamChunk] - errOut error - ) - return streamOut, errOut - } - return mock.ChatCompletionStreamWithContextFunc(ctx, workspace, query) -} - -// ChatCompletionStreamWithContextCalls gets all the calls that were made to ChatCompletionStreamWithContext. -// Check the length with: -// -// len(mockedServiceManager.ChatCompletionStreamWithContextCalls()) -func (mock *MeiliServiceManager) ChatCompletionStreamWithContextCalls() []struct { - Ctx context.Context - Workspace string - Query *meilisearch.ChatCompletionQuery -} { - var calls []struct { - Ctx context.Context - Workspace string - Query *meilisearch.ChatCompletionQuery - } - mock.lockChatCompletionStreamWithContext.RLock() - calls = mock.calls.ChatCompletionStreamWithContext - mock.lockChatCompletionStreamWithContext.RUnlock() - return calls -} - -// ChatManager calls ChatManagerFunc. -func (mock *MeiliServiceManager) ChatManager() meilisearch.ChatManager { - callInfo := struct { - }{} - mock.lockChatManager.Lock() - mock.calls.ChatManager = append(mock.calls.ChatManager, callInfo) - mock.lockChatManager.Unlock() - if mock.ChatManagerFunc == nil { - var ( - chatManagerOut meilisearch.ChatManager - ) - return chatManagerOut - } - return mock.ChatManagerFunc() -} - -// ChatManagerCalls gets all the calls that were made to ChatManager. -// Check the length with: -// -// len(mockedServiceManager.ChatManagerCalls()) -func (mock *MeiliServiceManager) ChatManagerCalls() []struct { -} { - var calls []struct { - } - mock.lockChatManager.RLock() - calls = mock.calls.ChatManager - mock.lockChatManager.RUnlock() - return calls -} - -// ChatReader calls ChatReaderFunc. -func (mock *MeiliServiceManager) ChatReader() meilisearch.ChatReader { - callInfo := struct { - }{} - mock.lockChatReader.Lock() - mock.calls.ChatReader = append(mock.calls.ChatReader, callInfo) - mock.lockChatReader.Unlock() - if mock.ChatReaderFunc == nil { - var ( - chatReaderOut meilisearch.ChatReader - ) - return chatReaderOut - } - return mock.ChatReaderFunc() -} - -// ChatReaderCalls gets all the calls that were made to ChatReader. -// Check the length with: -// -// len(mockedServiceManager.ChatReaderCalls()) -func (mock *MeiliServiceManager) ChatReaderCalls() []struct { -} { - var calls []struct { - } - mock.lockChatReader.RLock() - calls = mock.calls.ChatReader - mock.lockChatReader.RUnlock() - return calls -} - -// Close calls CloseFunc. -func (mock *MeiliServiceManager) Close() { - callInfo := struct { - }{} - mock.lockClose.Lock() - mock.calls.Close = append(mock.calls.Close, callInfo) - mock.lockClose.Unlock() - if mock.CloseFunc == nil { - return - } - mock.CloseFunc() -} - -// CloseCalls gets all the calls that were made to Close. -// Check the length with: -// -// len(mockedServiceManager.CloseCalls()) -func (mock *MeiliServiceManager) CloseCalls() []struct { -} { - var calls []struct { - } - mock.lockClose.RLock() - calls = mock.calls.Close - mock.lockClose.RUnlock() - return calls -} - -// CreateDump calls CreateDumpFunc. -func (mock *MeiliServiceManager) CreateDump() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockCreateDump.Lock() - mock.calls.CreateDump = append(mock.calls.CreateDump, callInfo) - mock.lockCreateDump.Unlock() - if mock.CreateDumpFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.CreateDumpFunc() -} - -// CreateDumpCalls gets all the calls that were made to CreateDump. -// Check the length with: -// -// len(mockedServiceManager.CreateDumpCalls()) -func (mock *MeiliServiceManager) CreateDumpCalls() []struct { -} { - var calls []struct { - } - mock.lockCreateDump.RLock() - calls = mock.calls.CreateDump - mock.lockCreateDump.RUnlock() - return calls -} - -// CreateDumpWithContext calls CreateDumpWithContextFunc. -func (mock *MeiliServiceManager) CreateDumpWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockCreateDumpWithContext.Lock() - mock.calls.CreateDumpWithContext = append(mock.calls.CreateDumpWithContext, callInfo) - mock.lockCreateDumpWithContext.Unlock() - if mock.CreateDumpWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.CreateDumpWithContextFunc(ctx) -} - -// CreateDumpWithContextCalls gets all the calls that were made to CreateDumpWithContext. -// Check the length with: -// -// len(mockedServiceManager.CreateDumpWithContextCalls()) -func (mock *MeiliServiceManager) CreateDumpWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockCreateDumpWithContext.RLock() - calls = mock.calls.CreateDumpWithContext - mock.lockCreateDumpWithContext.RUnlock() - return calls -} - -// CreateIndex calls CreateIndexFunc. -func (mock *MeiliServiceManager) CreateIndex(config *meilisearch.IndexConfig) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Config *meilisearch.IndexConfig - }{ - Config: config, - } - mock.lockCreateIndex.Lock() - mock.calls.CreateIndex = append(mock.calls.CreateIndex, callInfo) - mock.lockCreateIndex.Unlock() - if mock.CreateIndexFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.CreateIndexFunc(config) -} - -// CreateIndexCalls gets all the calls that were made to CreateIndex. -// Check the length with: -// -// len(mockedServiceManager.CreateIndexCalls()) -func (mock *MeiliServiceManager) CreateIndexCalls() []struct { - Config *meilisearch.IndexConfig -} { - var calls []struct { - Config *meilisearch.IndexConfig - } - mock.lockCreateIndex.RLock() - calls = mock.calls.CreateIndex - mock.lockCreateIndex.RUnlock() - return calls -} - -// CreateIndexWithContext calls CreateIndexWithContextFunc. -func (mock *MeiliServiceManager) CreateIndexWithContext(ctx context.Context, config *meilisearch.IndexConfig) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Config *meilisearch.IndexConfig - }{ - Ctx: ctx, - Config: config, - } - mock.lockCreateIndexWithContext.Lock() - mock.calls.CreateIndexWithContext = append(mock.calls.CreateIndexWithContext, callInfo) - mock.lockCreateIndexWithContext.Unlock() - if mock.CreateIndexWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.CreateIndexWithContextFunc(ctx, config) -} - -// CreateIndexWithContextCalls gets all the calls that were made to CreateIndexWithContext. -// Check the length with: -// -// len(mockedServiceManager.CreateIndexWithContextCalls()) -func (mock *MeiliServiceManager) CreateIndexWithContextCalls() []struct { - Ctx context.Context - Config *meilisearch.IndexConfig -} { - var calls []struct { - Ctx context.Context - Config *meilisearch.IndexConfig - } - mock.lockCreateIndexWithContext.RLock() - calls = mock.calls.CreateIndexWithContext - mock.lockCreateIndexWithContext.RUnlock() - return calls -} - -// CreateKey calls CreateKeyFunc. -func (mock *MeiliServiceManager) CreateKey(request *meilisearch.Key) (*meilisearch.Key, error) { - callInfo := struct { - Request *meilisearch.Key - }{ - Request: request, - } - mock.lockCreateKey.Lock() - mock.calls.CreateKey = append(mock.calls.CreateKey, callInfo) - mock.lockCreateKey.Unlock() - if mock.CreateKeyFunc == nil { - var ( - keyOut *meilisearch.Key - errOut error - ) - return keyOut, errOut - } - return mock.CreateKeyFunc(request) -} - -// CreateKeyCalls gets all the calls that were made to CreateKey. -// Check the length with: -// -// len(mockedServiceManager.CreateKeyCalls()) -func (mock *MeiliServiceManager) CreateKeyCalls() []struct { - Request *meilisearch.Key -} { - var calls []struct { - Request *meilisearch.Key - } - mock.lockCreateKey.RLock() - calls = mock.calls.CreateKey - mock.lockCreateKey.RUnlock() - return calls -} - -// CreateKeyWithContext calls CreateKeyWithContextFunc. -func (mock *MeiliServiceManager) CreateKeyWithContext(ctx context.Context, request *meilisearch.Key) (*meilisearch.Key, error) { - callInfo := struct { - Ctx context.Context - Request *meilisearch.Key - }{ - Ctx: ctx, - Request: request, - } - mock.lockCreateKeyWithContext.Lock() - mock.calls.CreateKeyWithContext = append(mock.calls.CreateKeyWithContext, callInfo) - mock.lockCreateKeyWithContext.Unlock() - if mock.CreateKeyWithContextFunc == nil { - var ( - keyOut *meilisearch.Key - errOut error - ) - return keyOut, errOut - } - return mock.CreateKeyWithContextFunc(ctx, request) -} - -// CreateKeyWithContextCalls gets all the calls that were made to CreateKeyWithContext. -// Check the length with: -// -// len(mockedServiceManager.CreateKeyWithContextCalls()) -func (mock *MeiliServiceManager) CreateKeyWithContextCalls() []struct { - Ctx context.Context - Request *meilisearch.Key -} { - var calls []struct { - Ctx context.Context - Request *meilisearch.Key - } - mock.lockCreateKeyWithContext.RLock() - calls = mock.calls.CreateKeyWithContext - mock.lockCreateKeyWithContext.RUnlock() - return calls -} - -// CreateSnapshot calls CreateSnapshotFunc. -func (mock *MeiliServiceManager) CreateSnapshot() (*meilisearch.TaskInfo, error) { - callInfo := struct { - }{} - mock.lockCreateSnapshot.Lock() - mock.calls.CreateSnapshot = append(mock.calls.CreateSnapshot, callInfo) - mock.lockCreateSnapshot.Unlock() - if mock.CreateSnapshotFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.CreateSnapshotFunc() -} - -// CreateSnapshotCalls gets all the calls that were made to CreateSnapshot. -// Check the length with: -// -// len(mockedServiceManager.CreateSnapshotCalls()) -func (mock *MeiliServiceManager) CreateSnapshotCalls() []struct { -} { - var calls []struct { - } - mock.lockCreateSnapshot.RLock() - calls = mock.calls.CreateSnapshot - mock.lockCreateSnapshot.RUnlock() - return calls -} - -// CreateSnapshotWithContext calls CreateSnapshotWithContextFunc. -func (mock *MeiliServiceManager) CreateSnapshotWithContext(ctx context.Context) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockCreateSnapshotWithContext.Lock() - mock.calls.CreateSnapshotWithContext = append(mock.calls.CreateSnapshotWithContext, callInfo) - mock.lockCreateSnapshotWithContext.Unlock() - if mock.CreateSnapshotWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.CreateSnapshotWithContextFunc(ctx) -} - -// CreateSnapshotWithContextCalls gets all the calls that were made to CreateSnapshotWithContext. -// Check the length with: -// -// len(mockedServiceManager.CreateSnapshotWithContextCalls()) -func (mock *MeiliServiceManager) CreateSnapshotWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockCreateSnapshotWithContext.RLock() - calls = mock.calls.CreateSnapshotWithContext - mock.lockCreateSnapshotWithContext.RUnlock() - return calls -} - -// DeleteIndex calls DeleteIndexFunc. -func (mock *MeiliServiceManager) DeleteIndex(uid string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - UID string - }{ - UID: uid, - } - mock.lockDeleteIndex.Lock() - mock.calls.DeleteIndex = append(mock.calls.DeleteIndex, callInfo) - mock.lockDeleteIndex.Unlock() - if mock.DeleteIndexFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.DeleteIndexFunc(uid) -} - -// DeleteIndexCalls gets all the calls that were made to DeleteIndex. -// Check the length with: -// -// len(mockedServiceManager.DeleteIndexCalls()) -func (mock *MeiliServiceManager) DeleteIndexCalls() []struct { - UID string -} { - var calls []struct { - UID string - } - mock.lockDeleteIndex.RLock() - calls = mock.calls.DeleteIndex - mock.lockDeleteIndex.RUnlock() - return calls -} - -// DeleteIndexWithContext calls DeleteIndexWithContextFunc. -func (mock *MeiliServiceManager) DeleteIndexWithContext(ctx context.Context, uid string) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - UID string - }{ - Ctx: ctx, - UID: uid, - } - mock.lockDeleteIndexWithContext.Lock() - mock.calls.DeleteIndexWithContext = append(mock.calls.DeleteIndexWithContext, callInfo) - mock.lockDeleteIndexWithContext.Unlock() - if mock.DeleteIndexWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.DeleteIndexWithContextFunc(ctx, uid) -} - -// DeleteIndexWithContextCalls gets all the calls that were made to DeleteIndexWithContext. -// Check the length with: -// -// len(mockedServiceManager.DeleteIndexWithContextCalls()) -func (mock *MeiliServiceManager) DeleteIndexWithContextCalls() []struct { - Ctx context.Context - UID string -} { - var calls []struct { - Ctx context.Context - UID string - } - mock.lockDeleteIndexWithContext.RLock() - calls = mock.calls.DeleteIndexWithContext - mock.lockDeleteIndexWithContext.RUnlock() - return calls -} - -// DeleteKey calls DeleteKeyFunc. -func (mock *MeiliServiceManager) DeleteKey(keyOrUID string) (bool, error) { - callInfo := struct { - KeyOrUID string - }{ - KeyOrUID: keyOrUID, - } - mock.lockDeleteKey.Lock() - mock.calls.DeleteKey = append(mock.calls.DeleteKey, callInfo) - mock.lockDeleteKey.Unlock() - if mock.DeleteKeyFunc == nil { - var ( - bOut bool - errOut error - ) - return bOut, errOut - } - return mock.DeleteKeyFunc(keyOrUID) -} - -// DeleteKeyCalls gets all the calls that were made to DeleteKey. -// Check the length with: -// -// len(mockedServiceManager.DeleteKeyCalls()) -func (mock *MeiliServiceManager) DeleteKeyCalls() []struct { - KeyOrUID string -} { - var calls []struct { - KeyOrUID string - } - mock.lockDeleteKey.RLock() - calls = mock.calls.DeleteKey - mock.lockDeleteKey.RUnlock() - return calls -} - -// DeleteKeyWithContext calls DeleteKeyWithContextFunc. -func (mock *MeiliServiceManager) DeleteKeyWithContext(ctx context.Context, keyOrUID string) (bool, error) { - callInfo := struct { - Ctx context.Context - KeyOrUID string - }{ - Ctx: ctx, - KeyOrUID: keyOrUID, - } - mock.lockDeleteKeyWithContext.Lock() - mock.calls.DeleteKeyWithContext = append(mock.calls.DeleteKeyWithContext, callInfo) - mock.lockDeleteKeyWithContext.Unlock() - if mock.DeleteKeyWithContextFunc == nil { - var ( - bOut bool - errOut error - ) - return bOut, errOut - } - return mock.DeleteKeyWithContextFunc(ctx, keyOrUID) -} - -// DeleteKeyWithContextCalls gets all the calls that were made to DeleteKeyWithContext. -// Check the length with: -// -// len(mockedServiceManager.DeleteKeyWithContextCalls()) -func (mock *MeiliServiceManager) DeleteKeyWithContextCalls() []struct { - Ctx context.Context - KeyOrUID string -} { - var calls []struct { - Ctx context.Context - KeyOrUID string - } - mock.lockDeleteKeyWithContext.RLock() - calls = mock.calls.DeleteKeyWithContext - mock.lockDeleteKeyWithContext.RUnlock() - return calls -} - -// DeleteSearchRule calls DeleteSearchRuleFunc. -func (mock *MeiliServiceManager) DeleteSearchRule(uid string) error { - callInfo := struct { - UID string - }{ - UID: uid, - } - mock.lockDeleteSearchRule.Lock() - mock.calls.DeleteSearchRule = append(mock.calls.DeleteSearchRule, callInfo) - mock.lockDeleteSearchRule.Unlock() - if mock.DeleteSearchRuleFunc == nil { - var ( - errOut error - ) - return errOut - } - return mock.DeleteSearchRuleFunc(uid) -} - -// DeleteSearchRuleCalls gets all the calls that were made to DeleteSearchRule. -// Check the length with: -// -// len(mockedServiceManager.DeleteSearchRuleCalls()) -func (mock *MeiliServiceManager) DeleteSearchRuleCalls() []struct { - UID string -} { - var calls []struct { - UID string - } - mock.lockDeleteSearchRule.RLock() - calls = mock.calls.DeleteSearchRule - mock.lockDeleteSearchRule.RUnlock() - return calls -} - -// DeleteSearchRuleWithContext calls DeleteSearchRuleWithContextFunc. -func (mock *MeiliServiceManager) DeleteSearchRuleWithContext(ctx context.Context, uid string) error { - callInfo := struct { - Ctx context.Context - UID string - }{ - Ctx: ctx, - UID: uid, - } - mock.lockDeleteSearchRuleWithContext.Lock() - mock.calls.DeleteSearchRuleWithContext = append(mock.calls.DeleteSearchRuleWithContext, callInfo) - mock.lockDeleteSearchRuleWithContext.Unlock() - if mock.DeleteSearchRuleWithContextFunc == nil { - var ( - errOut error - ) - return errOut - } - return mock.DeleteSearchRuleWithContextFunc(ctx, uid) -} - -// DeleteSearchRuleWithContextCalls gets all the calls that were made to DeleteSearchRuleWithContext. -// Check the length with: -// -// len(mockedServiceManager.DeleteSearchRuleWithContextCalls()) -func (mock *MeiliServiceManager) DeleteSearchRuleWithContextCalls() []struct { - Ctx context.Context - UID string -} { - var calls []struct { - Ctx context.Context - UID string - } - mock.lockDeleteSearchRuleWithContext.RLock() - calls = mock.calls.DeleteSearchRuleWithContext - mock.lockDeleteSearchRuleWithContext.RUnlock() - return calls -} - -// DeleteTasks calls DeleteTasksFunc. -func (mock *MeiliServiceManager) DeleteTasks(param *meilisearch.DeleteTasksQuery) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Param *meilisearch.DeleteTasksQuery - }{ - Param: param, - } - mock.lockDeleteTasks.Lock() - mock.calls.DeleteTasks = append(mock.calls.DeleteTasks, callInfo) - mock.lockDeleteTasks.Unlock() - if mock.DeleteTasksFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.DeleteTasksFunc(param) -} - -// DeleteTasksCalls gets all the calls that were made to DeleteTasks. -// Check the length with: -// -// len(mockedServiceManager.DeleteTasksCalls()) -func (mock *MeiliServiceManager) DeleteTasksCalls() []struct { - Param *meilisearch.DeleteTasksQuery -} { - var calls []struct { - Param *meilisearch.DeleteTasksQuery - } - mock.lockDeleteTasks.RLock() - calls = mock.calls.DeleteTasks - mock.lockDeleteTasks.RUnlock() - return calls -} - -// DeleteTasksWithContext calls DeleteTasksWithContextFunc. -func (mock *MeiliServiceManager) DeleteTasksWithContext(ctx context.Context, param *meilisearch.DeleteTasksQuery) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Param *meilisearch.DeleteTasksQuery - }{ - Ctx: ctx, - Param: param, - } - mock.lockDeleteTasksWithContext.Lock() - mock.calls.DeleteTasksWithContext = append(mock.calls.DeleteTasksWithContext, callInfo) - mock.lockDeleteTasksWithContext.Unlock() - if mock.DeleteTasksWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.DeleteTasksWithContextFunc(ctx, param) -} - -// DeleteTasksWithContextCalls gets all the calls that were made to DeleteTasksWithContext. -// Check the length with: -// -// len(mockedServiceManager.DeleteTasksWithContextCalls()) -func (mock *MeiliServiceManager) DeleteTasksWithContextCalls() []struct { - Ctx context.Context - Param *meilisearch.DeleteTasksQuery -} { - var calls []struct { - Ctx context.Context - Param *meilisearch.DeleteTasksQuery - } - mock.lockDeleteTasksWithContext.RLock() - calls = mock.calls.DeleteTasksWithContext - mock.lockDeleteTasksWithContext.RUnlock() - return calls -} - -// DeleteWebhook calls DeleteWebhookFunc. -func (mock *MeiliServiceManager) DeleteWebhook(uuid string) error { - callInfo := struct { - UUID string - }{ - UUID: uuid, - } - mock.lockDeleteWebhook.Lock() - mock.calls.DeleteWebhook = append(mock.calls.DeleteWebhook, callInfo) - mock.lockDeleteWebhook.Unlock() - if mock.DeleteWebhookFunc == nil { - var ( - errOut error - ) - return errOut - } - return mock.DeleteWebhookFunc(uuid) -} - -// DeleteWebhookCalls gets all the calls that were made to DeleteWebhook. -// Check the length with: -// -// len(mockedServiceManager.DeleteWebhookCalls()) -func (mock *MeiliServiceManager) DeleteWebhookCalls() []struct { - UUID string -} { - var calls []struct { - UUID string - } - mock.lockDeleteWebhook.RLock() - calls = mock.calls.DeleteWebhook - mock.lockDeleteWebhook.RUnlock() - return calls -} - -// DeleteWebhookWithContext calls DeleteWebhookWithContextFunc. -func (mock *MeiliServiceManager) DeleteWebhookWithContext(ctx context.Context, uuid string) error { - callInfo := struct { - Ctx context.Context - UUID string - }{ - Ctx: ctx, - UUID: uuid, - } - mock.lockDeleteWebhookWithContext.Lock() - mock.calls.DeleteWebhookWithContext = append(mock.calls.DeleteWebhookWithContext, callInfo) - mock.lockDeleteWebhookWithContext.Unlock() - if mock.DeleteWebhookWithContextFunc == nil { - var ( - errOut error - ) - return errOut - } - return mock.DeleteWebhookWithContextFunc(ctx, uuid) -} - -// DeleteWebhookWithContextCalls gets all the calls that were made to DeleteWebhookWithContext. -// Check the length with: -// -// len(mockedServiceManager.DeleteWebhookWithContextCalls()) -func (mock *MeiliServiceManager) DeleteWebhookWithContextCalls() []struct { - Ctx context.Context - UUID string -} { - var calls []struct { - Ctx context.Context - UUID string - } - mock.lockDeleteWebhookWithContext.RLock() - calls = mock.calls.DeleteWebhookWithContext - mock.lockDeleteWebhookWithContext.RUnlock() - return calls -} - -// ExperimentalFeatures calls ExperimentalFeaturesFunc. -func (mock *MeiliServiceManager) ExperimentalFeatures() *meilisearch.ExperimentalFeatures { - callInfo := struct { - }{} - mock.lockExperimentalFeatures.Lock() - mock.calls.ExperimentalFeatures = append(mock.calls.ExperimentalFeatures, callInfo) - mock.lockExperimentalFeatures.Unlock() - if mock.ExperimentalFeaturesFunc == nil { - var ( - experimentalFeaturesOut *meilisearch.ExperimentalFeatures - ) - return experimentalFeaturesOut - } - return mock.ExperimentalFeaturesFunc() -} - -// ExperimentalFeaturesCalls gets all the calls that were made to ExperimentalFeatures. -// Check the length with: -// -// len(mockedServiceManager.ExperimentalFeaturesCalls()) -func (mock *MeiliServiceManager) ExperimentalFeaturesCalls() []struct { -} { - var calls []struct { - } - mock.lockExperimentalFeatures.RLock() - calls = mock.calls.ExperimentalFeatures - mock.lockExperimentalFeatures.RUnlock() - return calls -} - -// Export calls ExportFunc. -func (mock *MeiliServiceManager) Export(params *meilisearch.ExportParams) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Params *meilisearch.ExportParams - }{ - Params: params, - } - mock.lockExport.Lock() - mock.calls.Export = append(mock.calls.Export, callInfo) - mock.lockExport.Unlock() - if mock.ExportFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ExportFunc(params) -} - -// ExportCalls gets all the calls that were made to Export. -// Check the length with: -// -// len(mockedServiceManager.ExportCalls()) -func (mock *MeiliServiceManager) ExportCalls() []struct { - Params *meilisearch.ExportParams -} { - var calls []struct { - Params *meilisearch.ExportParams - } - mock.lockExport.RLock() - calls = mock.calls.Export - mock.lockExport.RUnlock() - return calls -} - -// ExportWithContext calls ExportWithContextFunc. -func (mock *MeiliServiceManager) ExportWithContext(ctx context.Context, params *meilisearch.ExportParams) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Params *meilisearch.ExportParams - }{ - Ctx: ctx, - Params: params, - } - mock.lockExportWithContext.Lock() - mock.calls.ExportWithContext = append(mock.calls.ExportWithContext, callInfo) - mock.lockExportWithContext.Unlock() - if mock.ExportWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.ExportWithContextFunc(ctx, params) -} - -// ExportWithContextCalls gets all the calls that were made to ExportWithContext. -// Check the length with: -// -// len(mockedServiceManager.ExportWithContextCalls()) -func (mock *MeiliServiceManager) ExportWithContextCalls() []struct { - Ctx context.Context - Params *meilisearch.ExportParams -} { - var calls []struct { - Ctx context.Context - Params *meilisearch.ExportParams - } - mock.lockExportWithContext.RLock() - calls = mock.calls.ExportWithContext - mock.lockExportWithContext.RUnlock() - return calls -} - -// GenerateTenantToken calls GenerateTenantTokenFunc. -func (mock *MeiliServiceManager) GenerateTenantToken(apiKeyUID string, searchRules map[string]interface{}, options *meilisearch.TenantTokenOptions) (string, error) { - callInfo := struct { - ApiKeyUID string - SearchRules map[string]interface{} - Options *meilisearch.TenantTokenOptions - }{ - ApiKeyUID: apiKeyUID, - SearchRules: searchRules, - Options: options, - } - mock.lockGenerateTenantToken.Lock() - mock.calls.GenerateTenantToken = append(mock.calls.GenerateTenantToken, callInfo) - mock.lockGenerateTenantToken.Unlock() - if mock.GenerateTenantTokenFunc == nil { - var ( - sOut string - errOut error - ) - return sOut, errOut - } - return mock.GenerateTenantTokenFunc(apiKeyUID, searchRules, options) -} - -// GenerateTenantTokenCalls gets all the calls that were made to GenerateTenantToken. -// Check the length with: -// -// len(mockedServiceManager.GenerateTenantTokenCalls()) -func (mock *MeiliServiceManager) GenerateTenantTokenCalls() []struct { - ApiKeyUID string - SearchRules map[string]interface{} - Options *meilisearch.TenantTokenOptions -} { - var calls []struct { - ApiKeyUID string - SearchRules map[string]interface{} - Options *meilisearch.TenantTokenOptions - } - mock.lockGenerateTenantToken.RLock() - calls = mock.calls.GenerateTenantToken - mock.lockGenerateTenantToken.RUnlock() - return calls -} - -// GetBatch calls GetBatchFunc. -func (mock *MeiliServiceManager) GetBatch(batchUID int) (*meilisearch.Batch, error) { - callInfo := struct { - BatchUID int - }{ - BatchUID: batchUID, - } - mock.lockGetBatch.Lock() - mock.calls.GetBatch = append(mock.calls.GetBatch, callInfo) - mock.lockGetBatch.Unlock() - if mock.GetBatchFunc == nil { - var ( - batchOut *meilisearch.Batch - errOut error - ) - return batchOut, errOut - } - return mock.GetBatchFunc(batchUID) -} - -// GetBatchCalls gets all the calls that were made to GetBatch. -// Check the length with: -// -// len(mockedServiceManager.GetBatchCalls()) -func (mock *MeiliServiceManager) GetBatchCalls() []struct { - BatchUID int -} { - var calls []struct { - BatchUID int - } - mock.lockGetBatch.RLock() - calls = mock.calls.GetBatch - mock.lockGetBatch.RUnlock() - return calls -} - -// GetBatchWithContext calls GetBatchWithContextFunc. -func (mock *MeiliServiceManager) GetBatchWithContext(ctx context.Context, batchUID int) (*meilisearch.Batch, error) { - callInfo := struct { - Ctx context.Context - BatchUID int - }{ - Ctx: ctx, - BatchUID: batchUID, - } - mock.lockGetBatchWithContext.Lock() - mock.calls.GetBatchWithContext = append(mock.calls.GetBatchWithContext, callInfo) - mock.lockGetBatchWithContext.Unlock() - if mock.GetBatchWithContextFunc == nil { - var ( - batchOut *meilisearch.Batch - errOut error - ) - return batchOut, errOut - } - return mock.GetBatchWithContextFunc(ctx, batchUID) -} - -// GetBatchWithContextCalls gets all the calls that were made to GetBatchWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetBatchWithContextCalls()) -func (mock *MeiliServiceManager) GetBatchWithContextCalls() []struct { - Ctx context.Context - BatchUID int -} { - var calls []struct { - Ctx context.Context - BatchUID int - } - mock.lockGetBatchWithContext.RLock() - calls = mock.calls.GetBatchWithContext - mock.lockGetBatchWithContext.RUnlock() - return calls -} - -// GetBatches calls GetBatchesFunc. -func (mock *MeiliServiceManager) GetBatches(param *meilisearch.BatchesQuery) (*meilisearch.BatchesResults, error) { - callInfo := struct { - Param *meilisearch.BatchesQuery - }{ - Param: param, - } - mock.lockGetBatches.Lock() - mock.calls.GetBatches = append(mock.calls.GetBatches, callInfo) - mock.lockGetBatches.Unlock() - if mock.GetBatchesFunc == nil { - var ( - batchesResultsOut *meilisearch.BatchesResults - errOut error - ) - return batchesResultsOut, errOut - } - return mock.GetBatchesFunc(param) -} - -// GetBatchesCalls gets all the calls that were made to GetBatches. -// Check the length with: -// -// len(mockedServiceManager.GetBatchesCalls()) -func (mock *MeiliServiceManager) GetBatchesCalls() []struct { - Param *meilisearch.BatchesQuery -} { - var calls []struct { - Param *meilisearch.BatchesQuery - } - mock.lockGetBatches.RLock() - calls = mock.calls.GetBatches - mock.lockGetBatches.RUnlock() - return calls -} - -// GetBatchesWithContext calls GetBatchesWithContextFunc. -func (mock *MeiliServiceManager) GetBatchesWithContext(ctx context.Context, param *meilisearch.BatchesQuery) (*meilisearch.BatchesResults, error) { - callInfo := struct { - Ctx context.Context - Param *meilisearch.BatchesQuery - }{ - Ctx: ctx, - Param: param, - } - mock.lockGetBatchesWithContext.Lock() - mock.calls.GetBatchesWithContext = append(mock.calls.GetBatchesWithContext, callInfo) - mock.lockGetBatchesWithContext.Unlock() - if mock.GetBatchesWithContextFunc == nil { - var ( - batchesResultsOut *meilisearch.BatchesResults - errOut error - ) - return batchesResultsOut, errOut - } - return mock.GetBatchesWithContextFunc(ctx, param) -} - -// GetBatchesWithContextCalls gets all the calls that were made to GetBatchesWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetBatchesWithContextCalls()) -func (mock *MeiliServiceManager) GetBatchesWithContextCalls() []struct { - Ctx context.Context - Param *meilisearch.BatchesQuery -} { - var calls []struct { - Ctx context.Context - Param *meilisearch.BatchesQuery - } - mock.lockGetBatchesWithContext.RLock() - calls = mock.calls.GetBatchesWithContext - mock.lockGetBatchesWithContext.RUnlock() - return calls -} - -// GetChatWorkspace calls GetChatWorkspaceFunc. -func (mock *MeiliServiceManager) GetChatWorkspace(uid string) (*meilisearch.ChatWorkspace, error) { - callInfo := struct { - UID string - }{ - UID: uid, - } - mock.lockGetChatWorkspace.Lock() - mock.calls.GetChatWorkspace = append(mock.calls.GetChatWorkspace, callInfo) - mock.lockGetChatWorkspace.Unlock() - if mock.GetChatWorkspaceFunc == nil { - var ( - chatWorkspaceOut *meilisearch.ChatWorkspace - errOut error - ) - return chatWorkspaceOut, errOut - } - return mock.GetChatWorkspaceFunc(uid) -} - -// GetChatWorkspaceCalls gets all the calls that were made to GetChatWorkspace. -// Check the length with: -// -// len(mockedServiceManager.GetChatWorkspaceCalls()) -func (mock *MeiliServiceManager) GetChatWorkspaceCalls() []struct { - UID string -} { - var calls []struct { - UID string - } - mock.lockGetChatWorkspace.RLock() - calls = mock.calls.GetChatWorkspace - mock.lockGetChatWorkspace.RUnlock() - return calls -} - -// GetChatWorkspaceSettings calls GetChatWorkspaceSettingsFunc. -func (mock *MeiliServiceManager) GetChatWorkspaceSettings(uid string) (*meilisearch.ChatWorkspaceSettings, error) { - callInfo := struct { - UID string - }{ - UID: uid, - } - mock.lockGetChatWorkspaceSettings.Lock() - mock.calls.GetChatWorkspaceSettings = append(mock.calls.GetChatWorkspaceSettings, callInfo) - mock.lockGetChatWorkspaceSettings.Unlock() - if mock.GetChatWorkspaceSettingsFunc == nil { - var ( - chatWorkspaceSettingsOut *meilisearch.ChatWorkspaceSettings - errOut error - ) - return chatWorkspaceSettingsOut, errOut - } - return mock.GetChatWorkspaceSettingsFunc(uid) -} - -// GetChatWorkspaceSettingsCalls gets all the calls that were made to GetChatWorkspaceSettings. -// Check the length with: -// -// len(mockedServiceManager.GetChatWorkspaceSettingsCalls()) -func (mock *MeiliServiceManager) GetChatWorkspaceSettingsCalls() []struct { - UID string -} { - var calls []struct { - UID string - } - mock.lockGetChatWorkspaceSettings.RLock() - calls = mock.calls.GetChatWorkspaceSettings - mock.lockGetChatWorkspaceSettings.RUnlock() - return calls -} - -// GetChatWorkspaceSettingsWithContext calls GetChatWorkspaceSettingsWithContextFunc. -func (mock *MeiliServiceManager) GetChatWorkspaceSettingsWithContext(ctx context.Context, uid string) (*meilisearch.ChatWorkspaceSettings, error) { - callInfo := struct { - Ctx context.Context - UID string - }{ - Ctx: ctx, - UID: uid, - } - mock.lockGetChatWorkspaceSettingsWithContext.Lock() - mock.calls.GetChatWorkspaceSettingsWithContext = append(mock.calls.GetChatWorkspaceSettingsWithContext, callInfo) - mock.lockGetChatWorkspaceSettingsWithContext.Unlock() - if mock.GetChatWorkspaceSettingsWithContextFunc == nil { - var ( - chatWorkspaceSettingsOut *meilisearch.ChatWorkspaceSettings - errOut error - ) - return chatWorkspaceSettingsOut, errOut - } - return mock.GetChatWorkspaceSettingsWithContextFunc(ctx, uid) -} - -// GetChatWorkspaceSettingsWithContextCalls gets all the calls that were made to GetChatWorkspaceSettingsWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetChatWorkspaceSettingsWithContextCalls()) -func (mock *MeiliServiceManager) GetChatWorkspaceSettingsWithContextCalls() []struct { - Ctx context.Context - UID string -} { - var calls []struct { - Ctx context.Context - UID string - } - mock.lockGetChatWorkspaceSettingsWithContext.RLock() - calls = mock.calls.GetChatWorkspaceSettingsWithContext - mock.lockGetChatWorkspaceSettingsWithContext.RUnlock() - return calls -} - -// GetChatWorkspaceWithContext calls GetChatWorkspaceWithContextFunc. -func (mock *MeiliServiceManager) GetChatWorkspaceWithContext(ctx context.Context, uid string) (*meilisearch.ChatWorkspace, error) { - callInfo := struct { - Ctx context.Context - UID string - }{ - Ctx: ctx, - UID: uid, - } - mock.lockGetChatWorkspaceWithContext.Lock() - mock.calls.GetChatWorkspaceWithContext = append(mock.calls.GetChatWorkspaceWithContext, callInfo) - mock.lockGetChatWorkspaceWithContext.Unlock() - if mock.GetChatWorkspaceWithContextFunc == nil { - var ( - chatWorkspaceOut *meilisearch.ChatWorkspace - errOut error - ) - return chatWorkspaceOut, errOut - } - return mock.GetChatWorkspaceWithContextFunc(ctx, uid) -} - -// GetChatWorkspaceWithContextCalls gets all the calls that were made to GetChatWorkspaceWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetChatWorkspaceWithContextCalls()) -func (mock *MeiliServiceManager) GetChatWorkspaceWithContextCalls() []struct { - Ctx context.Context - UID string -} { - var calls []struct { - Ctx context.Context - UID string - } - mock.lockGetChatWorkspaceWithContext.RLock() - calls = mock.calls.GetChatWorkspaceWithContext - mock.lockGetChatWorkspaceWithContext.RUnlock() - return calls -} - -// GetIndex calls GetIndexFunc. -func (mock *MeiliServiceManager) GetIndex(indexID string) (*meilisearch.IndexResult, error) { - callInfo := struct { - IndexID string - }{ - IndexID: indexID, - } - mock.lockGetIndex.Lock() - mock.calls.GetIndex = append(mock.calls.GetIndex, callInfo) - mock.lockGetIndex.Unlock() - if mock.GetIndexFunc == nil { - var ( - indexResultOut *meilisearch.IndexResult - errOut error - ) - return indexResultOut, errOut - } - return mock.GetIndexFunc(indexID) -} - -// GetIndexCalls gets all the calls that were made to GetIndex. -// Check the length with: -// -// len(mockedServiceManager.GetIndexCalls()) -func (mock *MeiliServiceManager) GetIndexCalls() []struct { - IndexID string -} { - var calls []struct { - IndexID string - } - mock.lockGetIndex.RLock() - calls = mock.calls.GetIndex - mock.lockGetIndex.RUnlock() - return calls -} - -// GetIndexWithContext calls GetIndexWithContextFunc. -func (mock *MeiliServiceManager) GetIndexWithContext(ctx context.Context, indexID string) (*meilisearch.IndexResult, error) { - callInfo := struct { - Ctx context.Context - IndexID string - }{ - Ctx: ctx, - IndexID: indexID, - } - mock.lockGetIndexWithContext.Lock() - mock.calls.GetIndexWithContext = append(mock.calls.GetIndexWithContext, callInfo) - mock.lockGetIndexWithContext.Unlock() - if mock.GetIndexWithContextFunc == nil { - var ( - indexResultOut *meilisearch.IndexResult - errOut error - ) - return indexResultOut, errOut - } - return mock.GetIndexWithContextFunc(ctx, indexID) -} - -// GetIndexWithContextCalls gets all the calls that were made to GetIndexWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetIndexWithContextCalls()) -func (mock *MeiliServiceManager) GetIndexWithContextCalls() []struct { - Ctx context.Context - IndexID string -} { - var calls []struct { - Ctx context.Context - IndexID string - } - mock.lockGetIndexWithContext.RLock() - calls = mock.calls.GetIndexWithContext - mock.lockGetIndexWithContext.RUnlock() - return calls -} - -// GetKey calls GetKeyFunc. -func (mock *MeiliServiceManager) GetKey(identifier string) (*meilisearch.Key, error) { - callInfo := struct { - Identifier string - }{ - Identifier: identifier, - } - mock.lockGetKey.Lock() - mock.calls.GetKey = append(mock.calls.GetKey, callInfo) - mock.lockGetKey.Unlock() - if mock.GetKeyFunc == nil { - var ( - keyOut *meilisearch.Key - errOut error - ) - return keyOut, errOut - } - return mock.GetKeyFunc(identifier) -} - -// GetKeyCalls gets all the calls that were made to GetKey. -// Check the length with: -// -// len(mockedServiceManager.GetKeyCalls()) -func (mock *MeiliServiceManager) GetKeyCalls() []struct { - Identifier string -} { - var calls []struct { - Identifier string - } - mock.lockGetKey.RLock() - calls = mock.calls.GetKey - mock.lockGetKey.RUnlock() - return calls -} - -// GetKeyWithContext calls GetKeyWithContextFunc. -func (mock *MeiliServiceManager) GetKeyWithContext(ctx context.Context, identifier string) (*meilisearch.Key, error) { - callInfo := struct { - Ctx context.Context - Identifier string - }{ - Ctx: ctx, - Identifier: identifier, - } - mock.lockGetKeyWithContext.Lock() - mock.calls.GetKeyWithContext = append(mock.calls.GetKeyWithContext, callInfo) - mock.lockGetKeyWithContext.Unlock() - if mock.GetKeyWithContextFunc == nil { - var ( - keyOut *meilisearch.Key - errOut error - ) - return keyOut, errOut - } - return mock.GetKeyWithContextFunc(ctx, identifier) -} - -// GetKeyWithContextCalls gets all the calls that were made to GetKeyWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetKeyWithContextCalls()) -func (mock *MeiliServiceManager) GetKeyWithContextCalls() []struct { - Ctx context.Context - Identifier string -} { - var calls []struct { - Ctx context.Context - Identifier string - } - mock.lockGetKeyWithContext.RLock() - calls = mock.calls.GetKeyWithContext - mock.lockGetKeyWithContext.RUnlock() - return calls -} - -// GetKeys calls GetKeysFunc. -func (mock *MeiliServiceManager) GetKeys(param *meilisearch.KeysQuery) (*meilisearch.KeysResults, error) { - callInfo := struct { - Param *meilisearch.KeysQuery - }{ - Param: param, - } - mock.lockGetKeys.Lock() - mock.calls.GetKeys = append(mock.calls.GetKeys, callInfo) - mock.lockGetKeys.Unlock() - if mock.GetKeysFunc == nil { - var ( - keysResultsOut *meilisearch.KeysResults - errOut error - ) - return keysResultsOut, errOut - } - return mock.GetKeysFunc(param) -} - -// GetKeysCalls gets all the calls that were made to GetKeys. -// Check the length with: -// -// len(mockedServiceManager.GetKeysCalls()) -func (mock *MeiliServiceManager) GetKeysCalls() []struct { - Param *meilisearch.KeysQuery -} { - var calls []struct { - Param *meilisearch.KeysQuery - } - mock.lockGetKeys.RLock() - calls = mock.calls.GetKeys - mock.lockGetKeys.RUnlock() - return calls -} - -// GetKeysWithContext calls GetKeysWithContextFunc. -func (mock *MeiliServiceManager) GetKeysWithContext(ctx context.Context, param *meilisearch.KeysQuery) (*meilisearch.KeysResults, error) { - callInfo := struct { - Ctx context.Context - Param *meilisearch.KeysQuery - }{ - Ctx: ctx, - Param: param, - } - mock.lockGetKeysWithContext.Lock() - mock.calls.GetKeysWithContext = append(mock.calls.GetKeysWithContext, callInfo) - mock.lockGetKeysWithContext.Unlock() - if mock.GetKeysWithContextFunc == nil { - var ( - keysResultsOut *meilisearch.KeysResults - errOut error - ) - return keysResultsOut, errOut - } - return mock.GetKeysWithContextFunc(ctx, param) -} - -// GetKeysWithContextCalls gets all the calls that were made to GetKeysWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetKeysWithContextCalls()) -func (mock *MeiliServiceManager) GetKeysWithContextCalls() []struct { - Ctx context.Context - Param *meilisearch.KeysQuery -} { - var calls []struct { - Ctx context.Context - Param *meilisearch.KeysQuery - } - mock.lockGetKeysWithContext.RLock() - calls = mock.calls.GetKeysWithContext - mock.lockGetKeysWithContext.RUnlock() - return calls -} - -// GetNetwork calls GetNetworkFunc. -func (mock *MeiliServiceManager) GetNetwork() (*meilisearch.Network, error) { - callInfo := struct { - }{} - mock.lockGetNetwork.Lock() - mock.calls.GetNetwork = append(mock.calls.GetNetwork, callInfo) - mock.lockGetNetwork.Unlock() - if mock.GetNetworkFunc == nil { - var ( - networkOut *meilisearch.Network - errOut error - ) - return networkOut, errOut - } - return mock.GetNetworkFunc() -} - -// GetNetworkCalls gets all the calls that were made to GetNetwork. -// Check the length with: -// -// len(mockedServiceManager.GetNetworkCalls()) -func (mock *MeiliServiceManager) GetNetworkCalls() []struct { -} { - var calls []struct { - } - mock.lockGetNetwork.RLock() - calls = mock.calls.GetNetwork - mock.lockGetNetwork.RUnlock() - return calls -} - -// GetNetworkWithContext calls GetNetworkWithContextFunc. -func (mock *MeiliServiceManager) GetNetworkWithContext(ctx context.Context) (*meilisearch.Network, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockGetNetworkWithContext.Lock() - mock.calls.GetNetworkWithContext = append(mock.calls.GetNetworkWithContext, callInfo) - mock.lockGetNetworkWithContext.Unlock() - if mock.GetNetworkWithContextFunc == nil { - var ( - networkOut *meilisearch.Network - errOut error - ) - return networkOut, errOut - } - return mock.GetNetworkWithContextFunc(ctx) -} - -// GetNetworkWithContextCalls gets all the calls that were made to GetNetworkWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetNetworkWithContextCalls()) -func (mock *MeiliServiceManager) GetNetworkWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockGetNetworkWithContext.RLock() - calls = mock.calls.GetNetworkWithContext - mock.lockGetNetworkWithContext.RUnlock() - return calls -} - -// GetRawIndex calls GetRawIndexFunc. -func (mock *MeiliServiceManager) GetRawIndex(uid string) (map[string]interface{}, error) { - callInfo := struct { - UID string - }{ - UID: uid, - } - mock.lockGetRawIndex.Lock() - mock.calls.GetRawIndex = append(mock.calls.GetRawIndex, callInfo) - mock.lockGetRawIndex.Unlock() - if mock.GetRawIndexFunc == nil { - var ( - stringToIfaceValOut map[string]interface{} - errOut error - ) - return stringToIfaceValOut, errOut - } - return mock.GetRawIndexFunc(uid) -} - -// GetRawIndexCalls gets all the calls that were made to GetRawIndex. -// Check the length with: -// -// len(mockedServiceManager.GetRawIndexCalls()) -func (mock *MeiliServiceManager) GetRawIndexCalls() []struct { - UID string -} { - var calls []struct { - UID string - } - mock.lockGetRawIndex.RLock() - calls = mock.calls.GetRawIndex - mock.lockGetRawIndex.RUnlock() - return calls -} - -// GetRawIndexWithContext calls GetRawIndexWithContextFunc. -func (mock *MeiliServiceManager) GetRawIndexWithContext(ctx context.Context, uid string) (map[string]interface{}, error) { - callInfo := struct { - Ctx context.Context - UID string - }{ - Ctx: ctx, - UID: uid, - } - mock.lockGetRawIndexWithContext.Lock() - mock.calls.GetRawIndexWithContext = append(mock.calls.GetRawIndexWithContext, callInfo) - mock.lockGetRawIndexWithContext.Unlock() - if mock.GetRawIndexWithContextFunc == nil { - var ( - stringToIfaceValOut map[string]interface{} - errOut error - ) - return stringToIfaceValOut, errOut - } - return mock.GetRawIndexWithContextFunc(ctx, uid) -} - -// GetRawIndexWithContextCalls gets all the calls that were made to GetRawIndexWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetRawIndexWithContextCalls()) -func (mock *MeiliServiceManager) GetRawIndexWithContextCalls() []struct { - Ctx context.Context - UID string -} { - var calls []struct { - Ctx context.Context - UID string - } - mock.lockGetRawIndexWithContext.RLock() - calls = mock.calls.GetRawIndexWithContext - mock.lockGetRawIndexWithContext.RUnlock() - return calls -} - -// GetRawIndexes calls GetRawIndexesFunc. -func (mock *MeiliServiceManager) GetRawIndexes(param *meilisearch.IndexesQuery) (map[string]interface{}, error) { - callInfo := struct { - Param *meilisearch.IndexesQuery - }{ - Param: param, - } - mock.lockGetRawIndexes.Lock() - mock.calls.GetRawIndexes = append(mock.calls.GetRawIndexes, callInfo) - mock.lockGetRawIndexes.Unlock() - if mock.GetRawIndexesFunc == nil { - var ( - stringToIfaceValOut map[string]interface{} - errOut error - ) - return stringToIfaceValOut, errOut - } - return mock.GetRawIndexesFunc(param) -} - -// GetRawIndexesCalls gets all the calls that were made to GetRawIndexes. -// Check the length with: -// -// len(mockedServiceManager.GetRawIndexesCalls()) -func (mock *MeiliServiceManager) GetRawIndexesCalls() []struct { - Param *meilisearch.IndexesQuery -} { - var calls []struct { - Param *meilisearch.IndexesQuery - } - mock.lockGetRawIndexes.RLock() - calls = mock.calls.GetRawIndexes - mock.lockGetRawIndexes.RUnlock() - return calls -} - -// GetRawIndexesWithContext calls GetRawIndexesWithContextFunc. -func (mock *MeiliServiceManager) GetRawIndexesWithContext(ctx context.Context, param *meilisearch.IndexesQuery) (map[string]interface{}, error) { - callInfo := struct { - Ctx context.Context - Param *meilisearch.IndexesQuery - }{ - Ctx: ctx, - Param: param, - } - mock.lockGetRawIndexesWithContext.Lock() - mock.calls.GetRawIndexesWithContext = append(mock.calls.GetRawIndexesWithContext, callInfo) - mock.lockGetRawIndexesWithContext.Unlock() - if mock.GetRawIndexesWithContextFunc == nil { - var ( - stringToIfaceValOut map[string]interface{} - errOut error - ) - return stringToIfaceValOut, errOut - } - return mock.GetRawIndexesWithContextFunc(ctx, param) -} - -// GetRawIndexesWithContextCalls gets all the calls that were made to GetRawIndexesWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetRawIndexesWithContextCalls()) -func (mock *MeiliServiceManager) GetRawIndexesWithContextCalls() []struct { - Ctx context.Context - Param *meilisearch.IndexesQuery -} { - var calls []struct { - Ctx context.Context - Param *meilisearch.IndexesQuery - } - mock.lockGetRawIndexesWithContext.RLock() - calls = mock.calls.GetRawIndexesWithContext - mock.lockGetRawIndexesWithContext.RUnlock() - return calls -} - -// GetSearchRule calls GetSearchRuleFunc. -func (mock *MeiliServiceManager) GetSearchRule(uid string) (*meilisearch.SearchRule, error) { - callInfo := struct { - UID string - }{ - UID: uid, - } - mock.lockGetSearchRule.Lock() - mock.calls.GetSearchRule = append(mock.calls.GetSearchRule, callInfo) - mock.lockGetSearchRule.Unlock() - if mock.GetSearchRuleFunc == nil { - var ( - searchRuleOut *meilisearch.SearchRule - errOut error - ) - return searchRuleOut, errOut - } - return mock.GetSearchRuleFunc(uid) -} - -// GetSearchRuleCalls gets all the calls that were made to GetSearchRule. -// Check the length with: -// -// len(mockedServiceManager.GetSearchRuleCalls()) -func (mock *MeiliServiceManager) GetSearchRuleCalls() []struct { - UID string -} { - var calls []struct { - UID string - } - mock.lockGetSearchRule.RLock() - calls = mock.calls.GetSearchRule - mock.lockGetSearchRule.RUnlock() - return calls -} - -// GetSearchRuleWithContext calls GetSearchRuleWithContextFunc. -func (mock *MeiliServiceManager) GetSearchRuleWithContext(ctx context.Context, uid string) (*meilisearch.SearchRule, error) { - callInfo := struct { - Ctx context.Context - UID string - }{ - Ctx: ctx, - UID: uid, - } - mock.lockGetSearchRuleWithContext.Lock() - mock.calls.GetSearchRuleWithContext = append(mock.calls.GetSearchRuleWithContext, callInfo) - mock.lockGetSearchRuleWithContext.Unlock() - if mock.GetSearchRuleWithContextFunc == nil { - var ( - searchRuleOut *meilisearch.SearchRule - errOut error - ) - return searchRuleOut, errOut - } - return mock.GetSearchRuleWithContextFunc(ctx, uid) -} - -// GetSearchRuleWithContextCalls gets all the calls that were made to GetSearchRuleWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetSearchRuleWithContextCalls()) -func (mock *MeiliServiceManager) GetSearchRuleWithContextCalls() []struct { - Ctx context.Context - UID string -} { - var calls []struct { - Ctx context.Context - UID string - } - mock.lockGetSearchRuleWithContext.RLock() - calls = mock.calls.GetSearchRuleWithContext - mock.lockGetSearchRuleWithContext.RUnlock() - return calls -} - -// GetStats calls GetStatsFunc. -func (mock *MeiliServiceManager) GetStats(param *meilisearch.StatsParams) (*meilisearch.Stats, error) { - callInfo := struct { - Param *meilisearch.StatsParams - }{ - Param: param, - } - mock.lockGetStats.Lock() - mock.calls.GetStats = append(mock.calls.GetStats, callInfo) - mock.lockGetStats.Unlock() - if mock.GetStatsFunc == nil { - var ( - statsOut *meilisearch.Stats - errOut error - ) - return statsOut, errOut - } - return mock.GetStatsFunc(param) -} - -// GetStatsCalls gets all the calls that were made to GetStats. -// Check the length with: -// -// len(mockedServiceManager.GetStatsCalls()) -func (mock *MeiliServiceManager) GetStatsCalls() []struct { - Param *meilisearch.StatsParams -} { - var calls []struct { - Param *meilisearch.StatsParams - } - mock.lockGetStats.RLock() - calls = mock.calls.GetStats - mock.lockGetStats.RUnlock() - return calls -} - -// GetStatsWithContext calls GetStatsWithContextFunc. -func (mock *MeiliServiceManager) GetStatsWithContext(ctx context.Context, param *meilisearch.StatsParams) (*meilisearch.Stats, error) { - callInfo := struct { - Ctx context.Context - Param *meilisearch.StatsParams - }{ - Ctx: ctx, - Param: param, - } - mock.lockGetStatsWithContext.Lock() - mock.calls.GetStatsWithContext = append(mock.calls.GetStatsWithContext, callInfo) - mock.lockGetStatsWithContext.Unlock() - if mock.GetStatsWithContextFunc == nil { - var ( - statsOut *meilisearch.Stats - errOut error - ) - return statsOut, errOut - } - return mock.GetStatsWithContextFunc(ctx, param) -} - -// GetStatsWithContextCalls gets all the calls that were made to GetStatsWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetStatsWithContextCalls()) -func (mock *MeiliServiceManager) GetStatsWithContextCalls() []struct { - Ctx context.Context - Param *meilisearch.StatsParams -} { - var calls []struct { - Ctx context.Context - Param *meilisearch.StatsParams - } - mock.lockGetStatsWithContext.RLock() - calls = mock.calls.GetStatsWithContext - mock.lockGetStatsWithContext.RUnlock() - return calls -} - -// GetTask calls GetTaskFunc. -func (mock *MeiliServiceManager) GetTask(taskUID int64) (*meilisearch.Task, error) { - callInfo := struct { - TaskUID int64 - }{ - TaskUID: taskUID, - } - mock.lockGetTask.Lock() - mock.calls.GetTask = append(mock.calls.GetTask, callInfo) - mock.lockGetTask.Unlock() - if mock.GetTaskFunc == nil { - var ( - taskOut *meilisearch.Task - errOut error - ) - return taskOut, errOut - } - return mock.GetTaskFunc(taskUID) -} - -// GetTaskCalls gets all the calls that were made to GetTask. -// Check the length with: -// -// len(mockedServiceManager.GetTaskCalls()) -func (mock *MeiliServiceManager) GetTaskCalls() []struct { - TaskUID int64 -} { - var calls []struct { - TaskUID int64 - } - mock.lockGetTask.RLock() - calls = mock.calls.GetTask - mock.lockGetTask.RUnlock() - return calls -} - -// GetTaskDocuments calls GetTaskDocumentsFunc. -func (mock *MeiliServiceManager) GetTaskDocuments(taskUID int64, dst interface{}) error { - callInfo := struct { - TaskUID int64 - Dst interface{} - }{ - TaskUID: taskUID, - Dst: dst, - } - mock.lockGetTaskDocuments.Lock() - mock.calls.GetTaskDocuments = append(mock.calls.GetTaskDocuments, callInfo) - mock.lockGetTaskDocuments.Unlock() - if mock.GetTaskDocumentsFunc == nil { - var ( - errOut error - ) - return errOut - } - return mock.GetTaskDocumentsFunc(taskUID, dst) -} - -// GetTaskDocumentsCalls gets all the calls that were made to GetTaskDocuments. -// Check the length with: -// -// len(mockedServiceManager.GetTaskDocumentsCalls()) -func (mock *MeiliServiceManager) GetTaskDocumentsCalls() []struct { - TaskUID int64 - Dst interface{} -} { - var calls []struct { - TaskUID int64 - Dst interface{} - } - mock.lockGetTaskDocuments.RLock() - calls = mock.calls.GetTaskDocuments - mock.lockGetTaskDocuments.RUnlock() - return calls -} - -// GetTaskDocumentsWithContext calls GetTaskDocumentsWithContextFunc. -func (mock *MeiliServiceManager) GetTaskDocumentsWithContext(ctx context.Context, taskUID int64, dst interface{}) error { - callInfo := struct { - Ctx context.Context - TaskUID int64 - Dst interface{} - }{ - Ctx: ctx, - TaskUID: taskUID, - Dst: dst, - } - mock.lockGetTaskDocumentsWithContext.Lock() - mock.calls.GetTaskDocumentsWithContext = append(mock.calls.GetTaskDocumentsWithContext, callInfo) - mock.lockGetTaskDocumentsWithContext.Unlock() - if mock.GetTaskDocumentsWithContextFunc == nil { - var ( - errOut error - ) - return errOut - } - return mock.GetTaskDocumentsWithContextFunc(ctx, taskUID, dst) -} - -// GetTaskDocumentsWithContextCalls gets all the calls that were made to GetTaskDocumentsWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetTaskDocumentsWithContextCalls()) -func (mock *MeiliServiceManager) GetTaskDocumentsWithContextCalls() []struct { - Ctx context.Context - TaskUID int64 - Dst interface{} -} { - var calls []struct { - Ctx context.Context - TaskUID int64 - Dst interface{} - } - mock.lockGetTaskDocumentsWithContext.RLock() - calls = mock.calls.GetTaskDocumentsWithContext - mock.lockGetTaskDocumentsWithContext.RUnlock() - return calls -} - -// GetTaskWithContext calls GetTaskWithContextFunc. -func (mock *MeiliServiceManager) GetTaskWithContext(ctx context.Context, taskUID int64) (*meilisearch.Task, error) { - callInfo := struct { - Ctx context.Context - TaskUID int64 - }{ - Ctx: ctx, - TaskUID: taskUID, - } - mock.lockGetTaskWithContext.Lock() - mock.calls.GetTaskWithContext = append(mock.calls.GetTaskWithContext, callInfo) - mock.lockGetTaskWithContext.Unlock() - if mock.GetTaskWithContextFunc == nil { - var ( - taskOut *meilisearch.Task - errOut error - ) - return taskOut, errOut - } - return mock.GetTaskWithContextFunc(ctx, taskUID) -} - -// GetTaskWithContextCalls gets all the calls that were made to GetTaskWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetTaskWithContextCalls()) -func (mock *MeiliServiceManager) GetTaskWithContextCalls() []struct { - Ctx context.Context - TaskUID int64 -} { - var calls []struct { - Ctx context.Context - TaskUID int64 - } - mock.lockGetTaskWithContext.RLock() - calls = mock.calls.GetTaskWithContext - mock.lockGetTaskWithContext.RUnlock() - return calls -} - -// GetTasks calls GetTasksFunc. -func (mock *MeiliServiceManager) GetTasks(param *meilisearch.TasksQuery) (*meilisearch.TaskResult, error) { - callInfo := struct { - Param *meilisearch.TasksQuery - }{ - Param: param, - } - mock.lockGetTasks.Lock() - mock.calls.GetTasks = append(mock.calls.GetTasks, callInfo) - mock.lockGetTasks.Unlock() - if mock.GetTasksFunc == nil { - var ( - taskResultOut *meilisearch.TaskResult - errOut error - ) - return taskResultOut, errOut - } - return mock.GetTasksFunc(param) -} - -// GetTasksCalls gets all the calls that were made to GetTasks. -// Check the length with: -// -// len(mockedServiceManager.GetTasksCalls()) -func (mock *MeiliServiceManager) GetTasksCalls() []struct { - Param *meilisearch.TasksQuery -} { - var calls []struct { - Param *meilisearch.TasksQuery - } - mock.lockGetTasks.RLock() - calls = mock.calls.GetTasks - mock.lockGetTasks.RUnlock() - return calls -} - -// GetTasksWithContext calls GetTasksWithContextFunc. -func (mock *MeiliServiceManager) GetTasksWithContext(ctx context.Context, param *meilisearch.TasksQuery) (*meilisearch.TaskResult, error) { - callInfo := struct { - Ctx context.Context - Param *meilisearch.TasksQuery - }{ - Ctx: ctx, - Param: param, - } - mock.lockGetTasksWithContext.Lock() - mock.calls.GetTasksWithContext = append(mock.calls.GetTasksWithContext, callInfo) - mock.lockGetTasksWithContext.Unlock() - if mock.GetTasksWithContextFunc == nil { - var ( - taskResultOut *meilisearch.TaskResult - errOut error - ) - return taskResultOut, errOut - } - return mock.GetTasksWithContextFunc(ctx, param) -} - -// GetTasksWithContextCalls gets all the calls that were made to GetTasksWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetTasksWithContextCalls()) -func (mock *MeiliServiceManager) GetTasksWithContextCalls() []struct { - Ctx context.Context - Param *meilisearch.TasksQuery -} { - var calls []struct { - Ctx context.Context - Param *meilisearch.TasksQuery - } - mock.lockGetTasksWithContext.RLock() - calls = mock.calls.GetTasksWithContext - mock.lockGetTasksWithContext.RUnlock() - return calls -} - -// GetWebhook calls GetWebhookFunc. -func (mock *MeiliServiceManager) GetWebhook(uuid string) (*meilisearch.Webhook, error) { - callInfo := struct { - UUID string - }{ - UUID: uuid, - } - mock.lockGetWebhook.Lock() - mock.calls.GetWebhook = append(mock.calls.GetWebhook, callInfo) - mock.lockGetWebhook.Unlock() - if mock.GetWebhookFunc == nil { - var ( - webhookOut *meilisearch.Webhook - errOut error - ) - return webhookOut, errOut - } - return mock.GetWebhookFunc(uuid) -} - -// GetWebhookCalls gets all the calls that were made to GetWebhook. -// Check the length with: -// -// len(mockedServiceManager.GetWebhookCalls()) -func (mock *MeiliServiceManager) GetWebhookCalls() []struct { - UUID string -} { - var calls []struct { - UUID string - } - mock.lockGetWebhook.RLock() - calls = mock.calls.GetWebhook - mock.lockGetWebhook.RUnlock() - return calls -} - -// GetWebhookWithContext calls GetWebhookWithContextFunc. -func (mock *MeiliServiceManager) GetWebhookWithContext(ctx context.Context, uuid string) (*meilisearch.Webhook, error) { - callInfo := struct { - Ctx context.Context - UUID string - }{ - Ctx: ctx, - UUID: uuid, - } - mock.lockGetWebhookWithContext.Lock() - mock.calls.GetWebhookWithContext = append(mock.calls.GetWebhookWithContext, callInfo) - mock.lockGetWebhookWithContext.Unlock() - if mock.GetWebhookWithContextFunc == nil { - var ( - webhookOut *meilisearch.Webhook - errOut error - ) - return webhookOut, errOut - } - return mock.GetWebhookWithContextFunc(ctx, uuid) -} - -// GetWebhookWithContextCalls gets all the calls that were made to GetWebhookWithContext. -// Check the length with: -// -// len(mockedServiceManager.GetWebhookWithContextCalls()) -func (mock *MeiliServiceManager) GetWebhookWithContextCalls() []struct { - Ctx context.Context - UUID string -} { - var calls []struct { - Ctx context.Context - UUID string - } - mock.lockGetWebhookWithContext.RLock() - calls = mock.calls.GetWebhookWithContext - mock.lockGetWebhookWithContext.RUnlock() - return calls -} - -// Health calls HealthFunc. -func (mock *MeiliServiceManager) Health() (*meilisearch.Health, error) { - callInfo := struct { - }{} - mock.lockHealth.Lock() - mock.calls.Health = append(mock.calls.Health, callInfo) - mock.lockHealth.Unlock() - if mock.HealthFunc == nil { - var ( - healthOut *meilisearch.Health - errOut error - ) - return healthOut, errOut - } - return mock.HealthFunc() -} - -// HealthCalls gets all the calls that were made to Health. -// Check the length with: -// -// len(mockedServiceManager.HealthCalls()) -func (mock *MeiliServiceManager) HealthCalls() []struct { -} { - var calls []struct { - } - mock.lockHealth.RLock() - calls = mock.calls.Health - mock.lockHealth.RUnlock() - return calls -} - -// HealthWithContext calls HealthWithContextFunc. -func (mock *MeiliServiceManager) HealthWithContext(ctx context.Context) (*meilisearch.Health, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockHealthWithContext.Lock() - mock.calls.HealthWithContext = append(mock.calls.HealthWithContext, callInfo) - mock.lockHealthWithContext.Unlock() - if mock.HealthWithContextFunc == nil { - var ( - healthOut *meilisearch.Health - errOut error - ) - return healthOut, errOut - } - return mock.HealthWithContextFunc(ctx) -} - -// HealthWithContextCalls gets all the calls that were made to HealthWithContext. -// Check the length with: -// -// len(mockedServiceManager.HealthWithContextCalls()) -func (mock *MeiliServiceManager) HealthWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockHealthWithContext.RLock() - calls = mock.calls.HealthWithContext - mock.lockHealthWithContext.RUnlock() - return calls -} - -// Index calls IndexFunc. -func (mock *MeiliServiceManager) Index(uid string) meilisearch.IndexManager { - callInfo := struct { - UID string - }{ - UID: uid, - } - mock.lockIndex.Lock() - mock.calls.Index = append(mock.calls.Index, callInfo) - mock.lockIndex.Unlock() - if mock.IndexFunc == nil { - var ( - indexManagerOut meilisearch.IndexManager - ) - return indexManagerOut - } - return mock.IndexFunc(uid) -} - -// IndexCalls gets all the calls that were made to Index. -// Check the length with: -// -// len(mockedServiceManager.IndexCalls()) -func (mock *MeiliServiceManager) IndexCalls() []struct { - UID string -} { - var calls []struct { - UID string - } - mock.lockIndex.RLock() - calls = mock.calls.Index - mock.lockIndex.RUnlock() - return calls -} - -// IsHealthy calls IsHealthyFunc. -func (mock *MeiliServiceManager) IsHealthy() bool { - callInfo := struct { - }{} - mock.lockIsHealthy.Lock() - mock.calls.IsHealthy = append(mock.calls.IsHealthy, callInfo) - mock.lockIsHealthy.Unlock() - if mock.IsHealthyFunc == nil { - var ( - bOut bool - ) - return bOut - } - return mock.IsHealthyFunc() -} - -// IsHealthyCalls gets all the calls that were made to IsHealthy. -// Check the length with: -// -// len(mockedServiceManager.IsHealthyCalls()) -func (mock *MeiliServiceManager) IsHealthyCalls() []struct { -} { - var calls []struct { - } - mock.lockIsHealthy.RLock() - calls = mock.calls.IsHealthy - mock.lockIsHealthy.RUnlock() - return calls -} - -// KeyManager calls KeyManagerFunc. -func (mock *MeiliServiceManager) KeyManager() meilisearch.KeyManager { - callInfo := struct { - }{} - mock.lockKeyManager.Lock() - mock.calls.KeyManager = append(mock.calls.KeyManager, callInfo) - mock.lockKeyManager.Unlock() - if mock.KeyManagerFunc == nil { - var ( - keyManagerOut meilisearch.KeyManager - ) - return keyManagerOut - } - return mock.KeyManagerFunc() -} - -// KeyManagerCalls gets all the calls that were made to KeyManager. -// Check the length with: -// -// len(mockedServiceManager.KeyManagerCalls()) -func (mock *MeiliServiceManager) KeyManagerCalls() []struct { -} { - var calls []struct { - } - mock.lockKeyManager.RLock() - calls = mock.calls.KeyManager - mock.lockKeyManager.RUnlock() - return calls -} - -// KeyReader calls KeyReaderFunc. -func (mock *MeiliServiceManager) KeyReader() meilisearch.KeyReader { - callInfo := struct { - }{} - mock.lockKeyReader.Lock() - mock.calls.KeyReader = append(mock.calls.KeyReader, callInfo) - mock.lockKeyReader.Unlock() - if mock.KeyReaderFunc == nil { - var ( - keyReaderOut meilisearch.KeyReader - ) - return keyReaderOut - } - return mock.KeyReaderFunc() -} - -// KeyReaderCalls gets all the calls that were made to KeyReader. -// Check the length with: -// -// len(mockedServiceManager.KeyReaderCalls()) -func (mock *MeiliServiceManager) KeyReaderCalls() []struct { -} { - var calls []struct { - } - mock.lockKeyReader.RLock() - calls = mock.calls.KeyReader - mock.lockKeyReader.RUnlock() - return calls -} - -// ListChatWorkspaces calls ListChatWorkspacesFunc. -func (mock *MeiliServiceManager) ListChatWorkspaces(query *meilisearch.ListChatWorkSpaceQuery) (*meilisearch.ListChatWorkspace, error) { - callInfo := struct { - Query *meilisearch.ListChatWorkSpaceQuery - }{ - Query: query, - } - mock.lockListChatWorkspaces.Lock() - mock.calls.ListChatWorkspaces = append(mock.calls.ListChatWorkspaces, callInfo) - mock.lockListChatWorkspaces.Unlock() - if mock.ListChatWorkspacesFunc == nil { - var ( - listChatWorkspaceOut *meilisearch.ListChatWorkspace - errOut error - ) - return listChatWorkspaceOut, errOut - } - return mock.ListChatWorkspacesFunc(query) -} - -// ListChatWorkspacesCalls gets all the calls that were made to ListChatWorkspaces. -// Check the length with: -// -// len(mockedServiceManager.ListChatWorkspacesCalls()) -func (mock *MeiliServiceManager) ListChatWorkspacesCalls() []struct { - Query *meilisearch.ListChatWorkSpaceQuery -} { - var calls []struct { - Query *meilisearch.ListChatWorkSpaceQuery - } - mock.lockListChatWorkspaces.RLock() - calls = mock.calls.ListChatWorkspaces - mock.lockListChatWorkspaces.RUnlock() - return calls -} - -// ListChatWorkspacesWithContext calls ListChatWorkspacesWithContextFunc. -func (mock *MeiliServiceManager) ListChatWorkspacesWithContext(ctx context.Context, query *meilisearch.ListChatWorkSpaceQuery) (*meilisearch.ListChatWorkspace, error) { - callInfo := struct { - Ctx context.Context - Query *meilisearch.ListChatWorkSpaceQuery - }{ - Ctx: ctx, - Query: query, - } - mock.lockListChatWorkspacesWithContext.Lock() - mock.calls.ListChatWorkspacesWithContext = append(mock.calls.ListChatWorkspacesWithContext, callInfo) - mock.lockListChatWorkspacesWithContext.Unlock() - if mock.ListChatWorkspacesWithContextFunc == nil { - var ( - listChatWorkspaceOut *meilisearch.ListChatWorkspace - errOut error - ) - return listChatWorkspaceOut, errOut - } - return mock.ListChatWorkspacesWithContextFunc(ctx, query) -} - -// ListChatWorkspacesWithContextCalls gets all the calls that were made to ListChatWorkspacesWithContext. -// Check the length with: -// -// len(mockedServiceManager.ListChatWorkspacesWithContextCalls()) -func (mock *MeiliServiceManager) ListChatWorkspacesWithContextCalls() []struct { - Ctx context.Context - Query *meilisearch.ListChatWorkSpaceQuery -} { - var calls []struct { - Ctx context.Context - Query *meilisearch.ListChatWorkSpaceQuery - } - mock.lockListChatWorkspacesWithContext.RLock() - calls = mock.calls.ListChatWorkspacesWithContext - mock.lockListChatWorkspacesWithContext.RUnlock() - return calls -} - -// ListIndexes calls ListIndexesFunc. -func (mock *MeiliServiceManager) ListIndexes(param *meilisearch.IndexesQuery) (*meilisearch.IndexesResults, error) { - callInfo := struct { - Param *meilisearch.IndexesQuery - }{ - Param: param, - } - mock.lockListIndexes.Lock() - mock.calls.ListIndexes = append(mock.calls.ListIndexes, callInfo) - mock.lockListIndexes.Unlock() - if mock.ListIndexesFunc == nil { - var ( - indexesResultsOut *meilisearch.IndexesResults - errOut error - ) - return indexesResultsOut, errOut - } - return mock.ListIndexesFunc(param) -} - -// ListIndexesCalls gets all the calls that were made to ListIndexes. -// Check the length with: -// -// len(mockedServiceManager.ListIndexesCalls()) -func (mock *MeiliServiceManager) ListIndexesCalls() []struct { - Param *meilisearch.IndexesQuery -} { - var calls []struct { - Param *meilisearch.IndexesQuery - } - mock.lockListIndexes.RLock() - calls = mock.calls.ListIndexes - mock.lockListIndexes.RUnlock() - return calls -} - -// ListIndexesWithContext calls ListIndexesWithContextFunc. -func (mock *MeiliServiceManager) ListIndexesWithContext(ctx context.Context, param *meilisearch.IndexesQuery) (*meilisearch.IndexesResults, error) { - callInfo := struct { - Ctx context.Context - Param *meilisearch.IndexesQuery - }{ - Ctx: ctx, - Param: param, - } - mock.lockListIndexesWithContext.Lock() - mock.calls.ListIndexesWithContext = append(mock.calls.ListIndexesWithContext, callInfo) - mock.lockListIndexesWithContext.Unlock() - if mock.ListIndexesWithContextFunc == nil { - var ( - indexesResultsOut *meilisearch.IndexesResults - errOut error - ) - return indexesResultsOut, errOut - } - return mock.ListIndexesWithContextFunc(ctx, param) -} - -// ListIndexesWithContextCalls gets all the calls that were made to ListIndexesWithContext. -// Check the length with: -// -// len(mockedServiceManager.ListIndexesWithContextCalls()) -func (mock *MeiliServiceManager) ListIndexesWithContextCalls() []struct { - Ctx context.Context - Param *meilisearch.IndexesQuery -} { - var calls []struct { - Ctx context.Context - Param *meilisearch.IndexesQuery - } - mock.lockListIndexesWithContext.RLock() - calls = mock.calls.ListIndexesWithContext - mock.lockListIndexesWithContext.RUnlock() - return calls -} - -// ListSearchRules calls ListSearchRulesFunc. -func (mock *MeiliServiceManager) ListSearchRules(params *meilisearch.SearchRulesParams) (*meilisearch.SearchRulesResults, error) { - callInfo := struct { - Params *meilisearch.SearchRulesParams - }{ - Params: params, - } - mock.lockListSearchRules.Lock() - mock.calls.ListSearchRules = append(mock.calls.ListSearchRules, callInfo) - mock.lockListSearchRules.Unlock() - if mock.ListSearchRulesFunc == nil { - var ( - searchRulesResultsOut *meilisearch.SearchRulesResults - errOut error - ) - return searchRulesResultsOut, errOut - } - return mock.ListSearchRulesFunc(params) -} - -// ListSearchRulesCalls gets all the calls that were made to ListSearchRules. -// Check the length with: -// -// len(mockedServiceManager.ListSearchRulesCalls()) -func (mock *MeiliServiceManager) ListSearchRulesCalls() []struct { - Params *meilisearch.SearchRulesParams -} { - var calls []struct { - Params *meilisearch.SearchRulesParams - } - mock.lockListSearchRules.RLock() - calls = mock.calls.ListSearchRules - mock.lockListSearchRules.RUnlock() - return calls -} - -// ListSearchRulesWithContext calls ListSearchRulesWithContextFunc. -func (mock *MeiliServiceManager) ListSearchRulesWithContext(ctx context.Context, params *meilisearch.SearchRulesParams) (*meilisearch.SearchRulesResults, error) { - callInfo := struct { - Ctx context.Context - Params *meilisearch.SearchRulesParams - }{ - Ctx: ctx, - Params: params, - } - mock.lockListSearchRulesWithContext.Lock() - mock.calls.ListSearchRulesWithContext = append(mock.calls.ListSearchRulesWithContext, callInfo) - mock.lockListSearchRulesWithContext.Unlock() - if mock.ListSearchRulesWithContextFunc == nil { - var ( - searchRulesResultsOut *meilisearch.SearchRulesResults - errOut error - ) - return searchRulesResultsOut, errOut - } - return mock.ListSearchRulesWithContextFunc(ctx, params) -} - -// ListSearchRulesWithContextCalls gets all the calls that were made to ListSearchRulesWithContext. -// Check the length with: -// -// len(mockedServiceManager.ListSearchRulesWithContextCalls()) -func (mock *MeiliServiceManager) ListSearchRulesWithContextCalls() []struct { - Ctx context.Context - Params *meilisearch.SearchRulesParams -} { - var calls []struct { - Ctx context.Context - Params *meilisearch.SearchRulesParams - } - mock.lockListSearchRulesWithContext.RLock() - calls = mock.calls.ListSearchRulesWithContext - mock.lockListSearchRulesWithContext.RUnlock() - return calls -} - -// ListWebhooks calls ListWebhooksFunc. -func (mock *MeiliServiceManager) ListWebhooks() (*meilisearch.WebhookResults, error) { - callInfo := struct { - }{} - mock.lockListWebhooks.Lock() - mock.calls.ListWebhooks = append(mock.calls.ListWebhooks, callInfo) - mock.lockListWebhooks.Unlock() - if mock.ListWebhooksFunc == nil { - var ( - webhookResultsOut *meilisearch.WebhookResults - errOut error - ) - return webhookResultsOut, errOut - } - return mock.ListWebhooksFunc() -} - -// ListWebhooksCalls gets all the calls that were made to ListWebhooks. -// Check the length with: -// -// len(mockedServiceManager.ListWebhooksCalls()) -func (mock *MeiliServiceManager) ListWebhooksCalls() []struct { -} { - var calls []struct { - } - mock.lockListWebhooks.RLock() - calls = mock.calls.ListWebhooks - mock.lockListWebhooks.RUnlock() - return calls -} - -// ListWebhooksWithContext calls ListWebhooksWithContextFunc. -func (mock *MeiliServiceManager) ListWebhooksWithContext(ctx context.Context) (*meilisearch.WebhookResults, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockListWebhooksWithContext.Lock() - mock.calls.ListWebhooksWithContext = append(mock.calls.ListWebhooksWithContext, callInfo) - mock.lockListWebhooksWithContext.Unlock() - if mock.ListWebhooksWithContextFunc == nil { - var ( - webhookResultsOut *meilisearch.WebhookResults - errOut error - ) - return webhookResultsOut, errOut - } - return mock.ListWebhooksWithContextFunc(ctx) -} - -// ListWebhooksWithContextCalls gets all the calls that were made to ListWebhooksWithContext. -// Check the length with: -// -// len(mockedServiceManager.ListWebhooksWithContextCalls()) -func (mock *MeiliServiceManager) ListWebhooksWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockListWebhooksWithContext.RLock() - calls = mock.calls.ListWebhooksWithContext - mock.lockListWebhooksWithContext.RUnlock() - return calls -} - -// MultiSearch calls MultiSearchFunc. -func (mock *MeiliServiceManager) MultiSearch(queries *meilisearch.MultiSearchRequest) (*meilisearch.MultiSearchResponse, error) { - callInfo := struct { - Queries *meilisearch.MultiSearchRequest - }{ - Queries: queries, - } - mock.lockMultiSearch.Lock() - mock.calls.MultiSearch = append(mock.calls.MultiSearch, callInfo) - mock.lockMultiSearch.Unlock() - if mock.MultiSearchFunc == nil { - var ( - multiSearchResponseOut *meilisearch.MultiSearchResponse - errOut error - ) - return multiSearchResponseOut, errOut - } - return mock.MultiSearchFunc(queries) -} - -// MultiSearchCalls gets all the calls that were made to MultiSearch. -// Check the length with: -// -// len(mockedServiceManager.MultiSearchCalls()) -func (mock *MeiliServiceManager) MultiSearchCalls() []struct { - Queries *meilisearch.MultiSearchRequest -} { - var calls []struct { - Queries *meilisearch.MultiSearchRequest - } - mock.lockMultiSearch.RLock() - calls = mock.calls.MultiSearch - mock.lockMultiSearch.RUnlock() - return calls -} - -// MultiSearchWithContext calls MultiSearchWithContextFunc. -func (mock *MeiliServiceManager) MultiSearchWithContext(ctx context.Context, queries *meilisearch.MultiSearchRequest) (*meilisearch.MultiSearchResponse, error) { - callInfo := struct { - Ctx context.Context - Queries *meilisearch.MultiSearchRequest - }{ - Ctx: ctx, - Queries: queries, - } - mock.lockMultiSearchWithContext.Lock() - mock.calls.MultiSearchWithContext = append(mock.calls.MultiSearchWithContext, callInfo) - mock.lockMultiSearchWithContext.Unlock() - if mock.MultiSearchWithContextFunc == nil { - var ( - multiSearchResponseOut *meilisearch.MultiSearchResponse - errOut error - ) - return multiSearchResponseOut, errOut - } - return mock.MultiSearchWithContextFunc(ctx, queries) -} - -// MultiSearchWithContextCalls gets all the calls that were made to MultiSearchWithContext. -// Check the length with: -// -// len(mockedServiceManager.MultiSearchWithContextCalls()) -func (mock *MeiliServiceManager) MultiSearchWithContextCalls() []struct { - Ctx context.Context - Queries *meilisearch.MultiSearchRequest -} { - var calls []struct { - Ctx context.Context - Queries *meilisearch.MultiSearchRequest - } - mock.lockMultiSearchWithContext.RLock() - calls = mock.calls.MultiSearchWithContext - mock.lockMultiSearchWithContext.RUnlock() - return calls -} - -// ResetChatWorkspace calls ResetChatWorkspaceFunc. -func (mock *MeiliServiceManager) ResetChatWorkspace(uid string) (*meilisearch.ChatWorkspaceSettings, error) { - callInfo := struct { - UID string - }{ - UID: uid, - } - mock.lockResetChatWorkspace.Lock() - mock.calls.ResetChatWorkspace = append(mock.calls.ResetChatWorkspace, callInfo) - mock.lockResetChatWorkspace.Unlock() - if mock.ResetChatWorkspaceFunc == nil { - var ( - chatWorkspaceSettingsOut *meilisearch.ChatWorkspaceSettings - errOut error - ) - return chatWorkspaceSettingsOut, errOut - } - return mock.ResetChatWorkspaceFunc(uid) -} - -// ResetChatWorkspaceCalls gets all the calls that were made to ResetChatWorkspace. -// Check the length with: -// -// len(mockedServiceManager.ResetChatWorkspaceCalls()) -func (mock *MeiliServiceManager) ResetChatWorkspaceCalls() []struct { - UID string -} { - var calls []struct { - UID string - } - mock.lockResetChatWorkspace.RLock() - calls = mock.calls.ResetChatWorkspace - mock.lockResetChatWorkspace.RUnlock() - return calls -} - -// ResetChatWorkspaceWithContext calls ResetChatWorkspaceWithContextFunc. -func (mock *MeiliServiceManager) ResetChatWorkspaceWithContext(ctx context.Context, uid string) (*meilisearch.ChatWorkspaceSettings, error) { - callInfo := struct { - Ctx context.Context - UID string - }{ - Ctx: ctx, - UID: uid, - } - mock.lockResetChatWorkspaceWithContext.Lock() - mock.calls.ResetChatWorkspaceWithContext = append(mock.calls.ResetChatWorkspaceWithContext, callInfo) - mock.lockResetChatWorkspaceWithContext.Unlock() - if mock.ResetChatWorkspaceWithContextFunc == nil { - var ( - chatWorkspaceSettingsOut *meilisearch.ChatWorkspaceSettings - errOut error - ) - return chatWorkspaceSettingsOut, errOut - } - return mock.ResetChatWorkspaceWithContextFunc(ctx, uid) -} - -// ResetChatWorkspaceWithContextCalls gets all the calls that were made to ResetChatWorkspaceWithContext. -// Check the length with: -// -// len(mockedServiceManager.ResetChatWorkspaceWithContextCalls()) -func (mock *MeiliServiceManager) ResetChatWorkspaceWithContextCalls() []struct { - Ctx context.Context - UID string -} { - var calls []struct { - Ctx context.Context - UID string - } - mock.lockResetChatWorkspaceWithContext.RLock() - calls = mock.calls.ResetChatWorkspaceWithContext - mock.lockResetChatWorkspaceWithContext.RUnlock() - return calls -} - -// SearchRulesManager calls SearchRulesManagerFunc. -func (mock *MeiliServiceManager) SearchRulesManager() meilisearch.SearchRulesManager { - callInfo := struct { - }{} - mock.lockSearchRulesManager.Lock() - mock.calls.SearchRulesManager = append(mock.calls.SearchRulesManager, callInfo) - mock.lockSearchRulesManager.Unlock() - if mock.SearchRulesManagerFunc == nil { - var ( - searchRulesManagerOut meilisearch.SearchRulesManager - ) - return searchRulesManagerOut - } - return mock.SearchRulesManagerFunc() -} - -// SearchRulesManagerCalls gets all the calls that were made to SearchRulesManager. -// Check the length with: -// -// len(mockedServiceManager.SearchRulesManagerCalls()) -func (mock *MeiliServiceManager) SearchRulesManagerCalls() []struct { -} { - var calls []struct { - } - mock.lockSearchRulesManager.RLock() - calls = mock.calls.SearchRulesManager - mock.lockSearchRulesManager.RUnlock() - return calls -} - -// SearchRulesReader calls SearchRulesReaderFunc. -func (mock *MeiliServiceManager) SearchRulesReader() meilisearch.SearchRulesReader { - callInfo := struct { - }{} - mock.lockSearchRulesReader.Lock() - mock.calls.SearchRulesReader = append(mock.calls.SearchRulesReader, callInfo) - mock.lockSearchRulesReader.Unlock() - if mock.SearchRulesReaderFunc == nil { - var ( - searchRulesReaderOut meilisearch.SearchRulesReader - ) - return searchRulesReaderOut - } - return mock.SearchRulesReaderFunc() -} - -// SearchRulesReaderCalls gets all the calls that were made to SearchRulesReader. -// Check the length with: -// -// len(mockedServiceManager.SearchRulesReaderCalls()) -func (mock *MeiliServiceManager) SearchRulesReaderCalls() []struct { -} { - var calls []struct { - } - mock.lockSearchRulesReader.RLock() - calls = mock.calls.SearchRulesReader - mock.lockSearchRulesReader.RUnlock() - return calls -} - -// ServiceReader calls ServiceReaderFunc. -func (mock *MeiliServiceManager) ServiceReader() meilisearch.ServiceReader { - callInfo := struct { - }{} - mock.lockServiceReader.Lock() - mock.calls.ServiceReader = append(mock.calls.ServiceReader, callInfo) - mock.lockServiceReader.Unlock() - if mock.ServiceReaderFunc == nil { - var ( - serviceReaderOut meilisearch.ServiceReader - ) - return serviceReaderOut - } - return mock.ServiceReaderFunc() -} - -// ServiceReaderCalls gets all the calls that were made to ServiceReader. -// Check the length with: -// -// len(mockedServiceManager.ServiceReaderCalls()) -func (mock *MeiliServiceManager) ServiceReaderCalls() []struct { -} { - var calls []struct { - } - mock.lockServiceReader.RLock() - calls = mock.calls.ServiceReader - mock.lockServiceReader.RUnlock() - return calls -} - -// SwapIndexes calls SwapIndexesFunc. -func (mock *MeiliServiceManager) SwapIndexes(param []*meilisearch.SwapIndexesParams) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Param []*meilisearch.SwapIndexesParams - }{ - Param: param, - } - mock.lockSwapIndexes.Lock() - mock.calls.SwapIndexes = append(mock.calls.SwapIndexes, callInfo) - mock.lockSwapIndexes.Unlock() - if mock.SwapIndexesFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.SwapIndexesFunc(param) -} - -// SwapIndexesCalls gets all the calls that were made to SwapIndexes. -// Check the length with: -// -// len(mockedServiceManager.SwapIndexesCalls()) -func (mock *MeiliServiceManager) SwapIndexesCalls() []struct { - Param []*meilisearch.SwapIndexesParams -} { - var calls []struct { - Param []*meilisearch.SwapIndexesParams - } - mock.lockSwapIndexes.RLock() - calls = mock.calls.SwapIndexes - mock.lockSwapIndexes.RUnlock() - return calls -} - -// SwapIndexesWithContext calls SwapIndexesWithContextFunc. -func (mock *MeiliServiceManager) SwapIndexesWithContext(ctx context.Context, param []*meilisearch.SwapIndexesParams) (*meilisearch.TaskInfo, error) { - callInfo := struct { - Ctx context.Context - Param []*meilisearch.SwapIndexesParams - }{ - Ctx: ctx, - Param: param, - } - mock.lockSwapIndexesWithContext.Lock() - mock.calls.SwapIndexesWithContext = append(mock.calls.SwapIndexesWithContext, callInfo) - mock.lockSwapIndexesWithContext.Unlock() - if mock.SwapIndexesWithContextFunc == nil { - var ( - taskInfoOut *meilisearch.TaskInfo - errOut error - ) - return taskInfoOut, errOut - } - return mock.SwapIndexesWithContextFunc(ctx, param) -} - -// SwapIndexesWithContextCalls gets all the calls that were made to SwapIndexesWithContext. -// Check the length with: -// -// len(mockedServiceManager.SwapIndexesWithContextCalls()) -func (mock *MeiliServiceManager) SwapIndexesWithContextCalls() []struct { - Ctx context.Context - Param []*meilisearch.SwapIndexesParams -} { - var calls []struct { - Ctx context.Context - Param []*meilisearch.SwapIndexesParams - } - mock.lockSwapIndexesWithContext.RLock() - calls = mock.calls.SwapIndexesWithContext - mock.lockSwapIndexesWithContext.RUnlock() - return calls -} - -// TaskManager calls TaskManagerFunc. -func (mock *MeiliServiceManager) TaskManager() meilisearch.TaskManager { - callInfo := struct { - }{} - mock.lockTaskManager.Lock() - mock.calls.TaskManager = append(mock.calls.TaskManager, callInfo) - mock.lockTaskManager.Unlock() - if mock.TaskManagerFunc == nil { - var ( - taskManagerOut meilisearch.TaskManager - ) - return taskManagerOut - } - return mock.TaskManagerFunc() -} - -// TaskManagerCalls gets all the calls that were made to TaskManager. -// Check the length with: -// -// len(mockedServiceManager.TaskManagerCalls()) -func (mock *MeiliServiceManager) TaskManagerCalls() []struct { -} { - var calls []struct { - } - mock.lockTaskManager.RLock() - calls = mock.calls.TaskManager - mock.lockTaskManager.RUnlock() - return calls -} - -// TaskReader calls TaskReaderFunc. -func (mock *MeiliServiceManager) TaskReader() meilisearch.TaskReader { - callInfo := struct { - }{} - mock.lockTaskReader.Lock() - mock.calls.TaskReader = append(mock.calls.TaskReader, callInfo) - mock.lockTaskReader.Unlock() - if mock.TaskReaderFunc == nil { - var ( - taskReaderOut meilisearch.TaskReader - ) - return taskReaderOut - } - return mock.TaskReaderFunc() -} - -// TaskReaderCalls gets all the calls that were made to TaskReader. -// Check the length with: -// -// len(mockedServiceManager.TaskReaderCalls()) -func (mock *MeiliServiceManager) TaskReaderCalls() []struct { -} { - var calls []struct { - } - mock.lockTaskReader.RLock() - calls = mock.calls.TaskReader - mock.lockTaskReader.RUnlock() - return calls -} - -// UpdateChatWorkspace calls UpdateChatWorkspaceFunc. -func (mock *MeiliServiceManager) UpdateChatWorkspace(uid string, settings *meilisearch.ChatWorkspaceSettings) (*meilisearch.ChatWorkspaceSettings, error) { - callInfo := struct { - UID string - Settings *meilisearch.ChatWorkspaceSettings - }{ - UID: uid, - Settings: settings, - } - mock.lockUpdateChatWorkspace.Lock() - mock.calls.UpdateChatWorkspace = append(mock.calls.UpdateChatWorkspace, callInfo) - mock.lockUpdateChatWorkspace.Unlock() - if mock.UpdateChatWorkspaceFunc == nil { - var ( - chatWorkspaceSettingsOut *meilisearch.ChatWorkspaceSettings - errOut error - ) - return chatWorkspaceSettingsOut, errOut - } - return mock.UpdateChatWorkspaceFunc(uid, settings) -} - -// UpdateChatWorkspaceCalls gets all the calls that were made to UpdateChatWorkspace. -// Check the length with: -// -// len(mockedServiceManager.UpdateChatWorkspaceCalls()) -func (mock *MeiliServiceManager) UpdateChatWorkspaceCalls() []struct { - UID string - Settings *meilisearch.ChatWorkspaceSettings -} { - var calls []struct { - UID string - Settings *meilisearch.ChatWorkspaceSettings - } - mock.lockUpdateChatWorkspace.RLock() - calls = mock.calls.UpdateChatWorkspace - mock.lockUpdateChatWorkspace.RUnlock() - return calls -} - -// UpdateChatWorkspaceWithContext calls UpdateChatWorkspaceWithContextFunc. -func (mock *MeiliServiceManager) UpdateChatWorkspaceWithContext(ctx context.Context, uid string, settings *meilisearch.ChatWorkspaceSettings) (*meilisearch.ChatWorkspaceSettings, error) { - callInfo := struct { - Ctx context.Context - UID string - Settings *meilisearch.ChatWorkspaceSettings - }{ - Ctx: ctx, - UID: uid, - Settings: settings, - } - mock.lockUpdateChatWorkspaceWithContext.Lock() - mock.calls.UpdateChatWorkspaceWithContext = append(mock.calls.UpdateChatWorkspaceWithContext, callInfo) - mock.lockUpdateChatWorkspaceWithContext.Unlock() - if mock.UpdateChatWorkspaceWithContextFunc == nil { - var ( - chatWorkspaceSettingsOut *meilisearch.ChatWorkspaceSettings - errOut error - ) - return chatWorkspaceSettingsOut, errOut - } - return mock.UpdateChatWorkspaceWithContextFunc(ctx, uid, settings) -} - -// UpdateChatWorkspaceWithContextCalls gets all the calls that were made to UpdateChatWorkspaceWithContext. -// Check the length with: -// -// len(mockedServiceManager.UpdateChatWorkspaceWithContextCalls()) -func (mock *MeiliServiceManager) UpdateChatWorkspaceWithContextCalls() []struct { - Ctx context.Context - UID string - Settings *meilisearch.ChatWorkspaceSettings -} { - var calls []struct { - Ctx context.Context - UID string - Settings *meilisearch.ChatWorkspaceSettings - } - mock.lockUpdateChatWorkspaceWithContext.RLock() - calls = mock.calls.UpdateChatWorkspaceWithContext - mock.lockUpdateChatWorkspaceWithContext.RUnlock() - return calls -} - -// UpdateKey calls UpdateKeyFunc. -func (mock *MeiliServiceManager) UpdateKey(keyOrUID string, request *meilisearch.Key) (*meilisearch.Key, error) { - callInfo := struct { - KeyOrUID string - Request *meilisearch.Key - }{ - KeyOrUID: keyOrUID, - Request: request, - } - mock.lockUpdateKey.Lock() - mock.calls.UpdateKey = append(mock.calls.UpdateKey, callInfo) - mock.lockUpdateKey.Unlock() - if mock.UpdateKeyFunc == nil { - var ( - keyOut *meilisearch.Key - errOut error - ) - return keyOut, errOut - } - return mock.UpdateKeyFunc(keyOrUID, request) -} - -// UpdateKeyCalls gets all the calls that were made to UpdateKey. -// Check the length with: -// -// len(mockedServiceManager.UpdateKeyCalls()) -func (mock *MeiliServiceManager) UpdateKeyCalls() []struct { - KeyOrUID string - Request *meilisearch.Key -} { - var calls []struct { - KeyOrUID string - Request *meilisearch.Key - } - mock.lockUpdateKey.RLock() - calls = mock.calls.UpdateKey - mock.lockUpdateKey.RUnlock() - return calls -} - -// UpdateKeyWithContext calls UpdateKeyWithContextFunc. -func (mock *MeiliServiceManager) UpdateKeyWithContext(ctx context.Context, keyOrUID string, request *meilisearch.Key) (*meilisearch.Key, error) { - callInfo := struct { - Ctx context.Context - KeyOrUID string - Request *meilisearch.Key - }{ - Ctx: ctx, - KeyOrUID: keyOrUID, - Request: request, - } - mock.lockUpdateKeyWithContext.Lock() - mock.calls.UpdateKeyWithContext = append(mock.calls.UpdateKeyWithContext, callInfo) - mock.lockUpdateKeyWithContext.Unlock() - if mock.UpdateKeyWithContextFunc == nil { - var ( - keyOut *meilisearch.Key - errOut error - ) - return keyOut, errOut - } - return mock.UpdateKeyWithContextFunc(ctx, keyOrUID, request) -} - -// UpdateKeyWithContextCalls gets all the calls that were made to UpdateKeyWithContext. -// Check the length with: -// -// len(mockedServiceManager.UpdateKeyWithContextCalls()) -func (mock *MeiliServiceManager) UpdateKeyWithContextCalls() []struct { - Ctx context.Context - KeyOrUID string - Request *meilisearch.Key -} { - var calls []struct { - Ctx context.Context - KeyOrUID string - Request *meilisearch.Key - } - mock.lockUpdateKeyWithContext.RLock() - calls = mock.calls.UpdateKeyWithContext - mock.lockUpdateKeyWithContext.RUnlock() - return calls -} - -// UpdateNetwork calls UpdateNetworkFunc. -func (mock *MeiliServiceManager) UpdateNetwork(params *meilisearch.UpdateNetworkRequest) (any, error) { - callInfo := struct { - Params *meilisearch.UpdateNetworkRequest - }{ - Params: params, - } - mock.lockUpdateNetwork.Lock() - mock.calls.UpdateNetwork = append(mock.calls.UpdateNetwork, callInfo) - mock.lockUpdateNetwork.Unlock() - if mock.UpdateNetworkFunc == nil { - var ( - vOut any - errOut error - ) - return vOut, errOut - } - return mock.UpdateNetworkFunc(params) -} - -// UpdateNetworkCalls gets all the calls that were made to UpdateNetwork. -// Check the length with: -// -// len(mockedServiceManager.UpdateNetworkCalls()) -func (mock *MeiliServiceManager) UpdateNetworkCalls() []struct { - Params *meilisearch.UpdateNetworkRequest -} { - var calls []struct { - Params *meilisearch.UpdateNetworkRequest - } - mock.lockUpdateNetwork.RLock() - calls = mock.calls.UpdateNetwork - mock.lockUpdateNetwork.RUnlock() - return calls -} - -// UpdateNetworkWithContext calls UpdateNetworkWithContextFunc. -func (mock *MeiliServiceManager) UpdateNetworkWithContext(ctx context.Context, params *meilisearch.UpdateNetworkRequest) (any, error) { - callInfo := struct { - Ctx context.Context - Params *meilisearch.UpdateNetworkRequest - }{ - Ctx: ctx, - Params: params, - } - mock.lockUpdateNetworkWithContext.Lock() - mock.calls.UpdateNetworkWithContext = append(mock.calls.UpdateNetworkWithContext, callInfo) - mock.lockUpdateNetworkWithContext.Unlock() - if mock.UpdateNetworkWithContextFunc == nil { - var ( - vOut any - errOut error - ) - return vOut, errOut - } - return mock.UpdateNetworkWithContextFunc(ctx, params) -} - -// UpdateNetworkWithContextCalls gets all the calls that were made to UpdateNetworkWithContext. -// Check the length with: -// -// len(mockedServiceManager.UpdateNetworkWithContextCalls()) -func (mock *MeiliServiceManager) UpdateNetworkWithContextCalls() []struct { - Ctx context.Context - Params *meilisearch.UpdateNetworkRequest -} { - var calls []struct { - Ctx context.Context - Params *meilisearch.UpdateNetworkRequest - } - mock.lockUpdateNetworkWithContext.RLock() - calls = mock.calls.UpdateNetworkWithContext - mock.lockUpdateNetworkWithContext.RUnlock() - return calls -} - -// UpdateSearchRule calls UpdateSearchRuleFunc. -func (mock *MeiliServiceManager) UpdateSearchRule(uid string, params *meilisearch.SearchRulesRequest) (*meilisearch.SearchRule, error) { - callInfo := struct { - UID string - Params *meilisearch.SearchRulesRequest - }{ - UID: uid, - Params: params, - } - mock.lockUpdateSearchRule.Lock() - mock.calls.UpdateSearchRule = append(mock.calls.UpdateSearchRule, callInfo) - mock.lockUpdateSearchRule.Unlock() - if mock.UpdateSearchRuleFunc == nil { - var ( - searchRuleOut *meilisearch.SearchRule - errOut error - ) - return searchRuleOut, errOut - } - return mock.UpdateSearchRuleFunc(uid, params) -} - -// UpdateSearchRuleCalls gets all the calls that were made to UpdateSearchRule. -// Check the length with: -// -// len(mockedServiceManager.UpdateSearchRuleCalls()) -func (mock *MeiliServiceManager) UpdateSearchRuleCalls() []struct { - UID string - Params *meilisearch.SearchRulesRequest -} { - var calls []struct { - UID string - Params *meilisearch.SearchRulesRequest - } - mock.lockUpdateSearchRule.RLock() - calls = mock.calls.UpdateSearchRule - mock.lockUpdateSearchRule.RUnlock() - return calls -} - -// UpdateSearchRuleWithContext calls UpdateSearchRuleWithContextFunc. -func (mock *MeiliServiceManager) UpdateSearchRuleWithContext(ctx context.Context, uid string, params *meilisearch.SearchRulesRequest) (*meilisearch.SearchRule, error) { - callInfo := struct { - Ctx context.Context - UID string - Params *meilisearch.SearchRulesRequest - }{ - Ctx: ctx, - UID: uid, - Params: params, - } - mock.lockUpdateSearchRuleWithContext.Lock() - mock.calls.UpdateSearchRuleWithContext = append(mock.calls.UpdateSearchRuleWithContext, callInfo) - mock.lockUpdateSearchRuleWithContext.Unlock() - if mock.UpdateSearchRuleWithContextFunc == nil { - var ( - searchRuleOut *meilisearch.SearchRule - errOut error - ) - return searchRuleOut, errOut - } - return mock.UpdateSearchRuleWithContextFunc(ctx, uid, params) -} - -// UpdateSearchRuleWithContextCalls gets all the calls that were made to UpdateSearchRuleWithContext. -// Check the length with: -// -// len(mockedServiceManager.UpdateSearchRuleWithContextCalls()) -func (mock *MeiliServiceManager) UpdateSearchRuleWithContextCalls() []struct { - Ctx context.Context - UID string - Params *meilisearch.SearchRulesRequest -} { - var calls []struct { - Ctx context.Context - UID string - Params *meilisearch.SearchRulesRequest - } - mock.lockUpdateSearchRuleWithContext.RLock() - calls = mock.calls.UpdateSearchRuleWithContext - mock.lockUpdateSearchRuleWithContext.RUnlock() - return calls -} - -// UpdateWebhook calls UpdateWebhookFunc. -func (mock *MeiliServiceManager) UpdateWebhook(uuid string, params *meilisearch.UpdateWebhookRequest) (*meilisearch.Webhook, error) { - callInfo := struct { - UUID string - Params *meilisearch.UpdateWebhookRequest - }{ - UUID: uuid, - Params: params, - } - mock.lockUpdateWebhook.Lock() - mock.calls.UpdateWebhook = append(mock.calls.UpdateWebhook, callInfo) - mock.lockUpdateWebhook.Unlock() - if mock.UpdateWebhookFunc == nil { - var ( - webhookOut *meilisearch.Webhook - errOut error - ) - return webhookOut, errOut - } - return mock.UpdateWebhookFunc(uuid, params) -} - -// UpdateWebhookCalls gets all the calls that were made to UpdateWebhook. -// Check the length with: -// -// len(mockedServiceManager.UpdateWebhookCalls()) -func (mock *MeiliServiceManager) UpdateWebhookCalls() []struct { - UUID string - Params *meilisearch.UpdateWebhookRequest -} { - var calls []struct { - UUID string - Params *meilisearch.UpdateWebhookRequest - } - mock.lockUpdateWebhook.RLock() - calls = mock.calls.UpdateWebhook - mock.lockUpdateWebhook.RUnlock() - return calls -} - -// UpdateWebhookWithContext calls UpdateWebhookWithContextFunc. -func (mock *MeiliServiceManager) UpdateWebhookWithContext(ctx context.Context, uuid string, params *meilisearch.UpdateWebhookRequest) (*meilisearch.Webhook, error) { - callInfo := struct { - Ctx context.Context - UUID string - Params *meilisearch.UpdateWebhookRequest - }{ - Ctx: ctx, - UUID: uuid, - Params: params, - } - mock.lockUpdateWebhookWithContext.Lock() - mock.calls.UpdateWebhookWithContext = append(mock.calls.UpdateWebhookWithContext, callInfo) - mock.lockUpdateWebhookWithContext.Unlock() - if mock.UpdateWebhookWithContextFunc == nil { - var ( - webhookOut *meilisearch.Webhook - errOut error - ) - return webhookOut, errOut - } - return mock.UpdateWebhookWithContextFunc(ctx, uuid, params) -} - -// UpdateWebhookWithContextCalls gets all the calls that were made to UpdateWebhookWithContext. -// Check the length with: -// -// len(mockedServiceManager.UpdateWebhookWithContextCalls()) -func (mock *MeiliServiceManager) UpdateWebhookWithContextCalls() []struct { - Ctx context.Context - UUID string - Params *meilisearch.UpdateWebhookRequest -} { - var calls []struct { - Ctx context.Context - UUID string - Params *meilisearch.UpdateWebhookRequest - } - mock.lockUpdateWebhookWithContext.RLock() - calls = mock.calls.UpdateWebhookWithContext - mock.lockUpdateWebhookWithContext.RUnlock() - return calls -} - -// Version calls VersionFunc. -func (mock *MeiliServiceManager) Version() (*meilisearch.Version, error) { - callInfo := struct { - }{} - mock.lockVersion.Lock() - mock.calls.Version = append(mock.calls.Version, callInfo) - mock.lockVersion.Unlock() - if mock.VersionFunc == nil { - var ( - versionOut *meilisearch.Version - errOut error - ) - return versionOut, errOut - } - return mock.VersionFunc() -} - -// VersionCalls gets all the calls that were made to Version. -// Check the length with: -// -// len(mockedServiceManager.VersionCalls()) -func (mock *MeiliServiceManager) VersionCalls() []struct { -} { - var calls []struct { - } - mock.lockVersion.RLock() - calls = mock.calls.Version - mock.lockVersion.RUnlock() - return calls -} - -// VersionWithContext calls VersionWithContextFunc. -func (mock *MeiliServiceManager) VersionWithContext(ctx context.Context) (*meilisearch.Version, error) { - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockVersionWithContext.Lock() - mock.calls.VersionWithContext = append(mock.calls.VersionWithContext, callInfo) - mock.lockVersionWithContext.Unlock() - if mock.VersionWithContextFunc == nil { - var ( - versionOut *meilisearch.Version - errOut error - ) - return versionOut, errOut - } - return mock.VersionWithContextFunc(ctx) -} - -// VersionWithContextCalls gets all the calls that were made to VersionWithContext. -// Check the length with: -// -// len(mockedServiceManager.VersionWithContextCalls()) -func (mock *MeiliServiceManager) VersionWithContextCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockVersionWithContext.RLock() - calls = mock.calls.VersionWithContext - mock.lockVersionWithContext.RUnlock() - return calls -} - -// WaitForTask calls WaitForTaskFunc. -func (mock *MeiliServiceManager) WaitForTask(taskUID int64, interval time.Duration) (*meilisearch.Task, error) { - callInfo := struct { - TaskUID int64 - Interval time.Duration - }{ - TaskUID: taskUID, - Interval: interval, - } - mock.lockWaitForTask.Lock() - mock.calls.WaitForTask = append(mock.calls.WaitForTask, callInfo) - mock.lockWaitForTask.Unlock() - if mock.WaitForTaskFunc == nil { - var ( - taskOut *meilisearch.Task - errOut error - ) - return taskOut, errOut - } - return mock.WaitForTaskFunc(taskUID, interval) -} - -// WaitForTaskCalls gets all the calls that were made to WaitForTask. -// Check the length with: -// -// len(mockedServiceManager.WaitForTaskCalls()) -func (mock *MeiliServiceManager) WaitForTaskCalls() []struct { - TaskUID int64 - Interval time.Duration -} { - var calls []struct { - TaskUID int64 - Interval time.Duration - } - mock.lockWaitForTask.RLock() - calls = mock.calls.WaitForTask - mock.lockWaitForTask.RUnlock() - return calls -} - -// WaitForTaskWithContext calls WaitForTaskWithContextFunc. -func (mock *MeiliServiceManager) WaitForTaskWithContext(ctx context.Context, taskUID int64, interval time.Duration) (*meilisearch.Task, error) { - callInfo := struct { - Ctx context.Context - TaskUID int64 - Interval time.Duration - }{ - Ctx: ctx, - TaskUID: taskUID, - Interval: interval, - } - mock.lockWaitForTaskWithContext.Lock() - mock.calls.WaitForTaskWithContext = append(mock.calls.WaitForTaskWithContext, callInfo) - mock.lockWaitForTaskWithContext.Unlock() - if mock.WaitForTaskWithContextFunc == nil { - var ( - taskOut *meilisearch.Task - errOut error - ) - return taskOut, errOut - } - return mock.WaitForTaskWithContextFunc(ctx, taskUID, interval) -} - -// WaitForTaskWithContextCalls gets all the calls that were made to WaitForTaskWithContext. -// Check the length with: -// -// len(mockedServiceManager.WaitForTaskWithContextCalls()) -func (mock *MeiliServiceManager) WaitForTaskWithContextCalls() []struct { - Ctx context.Context - TaskUID int64 - Interval time.Duration -} { - var calls []struct { - Ctx context.Context - TaskUID int64 - Interval time.Duration - } - mock.lockWaitForTaskWithContext.RLock() - calls = mock.calls.WaitForTaskWithContext - mock.lockWaitForTaskWithContext.RUnlock() - return calls -} - -// WebhookManager calls WebhookManagerFunc. -func (mock *MeiliServiceManager) WebhookManager() meilisearch.WebhookManager { - callInfo := struct { - }{} - mock.lockWebhookManager.Lock() - mock.calls.WebhookManager = append(mock.calls.WebhookManager, callInfo) - mock.lockWebhookManager.Unlock() - if mock.WebhookManagerFunc == nil { - var ( - webhookManagerOut meilisearch.WebhookManager - ) - return webhookManagerOut - } - return mock.WebhookManagerFunc() -} - -// WebhookManagerCalls gets all the calls that were made to WebhookManager. -// Check the length with: -// -// len(mockedServiceManager.WebhookManagerCalls()) -func (mock *MeiliServiceManager) WebhookManagerCalls() []struct { -} { - var calls []struct { - } - mock.lockWebhookManager.RLock() - calls = mock.calls.WebhookManager - mock.lockWebhookManager.RUnlock() - return calls -} - -// WebhookReader calls WebhookReaderFunc. -func (mock *MeiliServiceManager) WebhookReader() meilisearch.WebhookReader { - callInfo := struct { - }{} - mock.lockWebhookReader.Lock() - mock.calls.WebhookReader = append(mock.calls.WebhookReader, callInfo) - mock.lockWebhookReader.Unlock() - if mock.WebhookReaderFunc == nil { - var ( - webhookReaderOut meilisearch.WebhookReader - ) - return webhookReaderOut - } - return mock.WebhookReaderFunc() -} - -// WebhookReaderCalls gets all the calls that were made to WebhookReader. -// Check the length with: -// -// len(mockedServiceManager.WebhookReaderCalls()) -func (mock *MeiliServiceManager) WebhookReaderCalls() []struct { -} { - var calls []struct { - } - mock.lockWebhookReader.RLock() - calls = mock.calls.WebhookReader - mock.lockWebhookReader.RUnlock() - return calls -} diff --git a/server/core/internal/assistant/manager.go b/server/core/internal/assistant/manager.go index c9d9f679..f73fbeb5 100644 --- a/server/core/internal/assistant/manager.go +++ b/server/core/internal/assistant/manager.go @@ -28,7 +28,6 @@ import ( "github.com/oxynote/oxynote/server/core/internal/assistant/persist" "github.com/oxynote/oxynote/server/core/internal/assistant/protocol" "github.com/oxynote/oxynote/server/core/internal/assistant/tools" - "github.com/oxynote/oxynote/server/core/internal/search" "github.com/oxynote/oxynote/server/core/pkg/errutil" "github.com/oxynote/oxynote/server/core/pkg/memkit" "github.com/oxynote/oxynote/server/core/pkg/metricutil" @@ -46,17 +45,17 @@ const _sessionExpiration = time.Hour * 24 * 7 // Manager holds dependencies shared across assistant sessions. type Manager struct { - log *slog.Logger - db tools.DB - search tools.Searcher - jobs *search.Jobs - runners tools.DataSourceRunners - model model.ToolCallingChatModel - summary model.ToolCallingChatModel - applier tools.EditApplier - tree tools.TreeNotifier - tags tools.TagNotifier - hooks tools.HookNotifier + log *slog.Logger + db tools.DB + search tools.Searcher + searchTrigger tools.SearchTrigger + runners tools.DataSourceRunners + model model.ToolCallingChatModel + summary model.ToolCallingChatModel + applier tools.EditApplier + tree tools.TreeNotifier + tags tools.TagNotifier + hooks tools.HookNotifier githubMan *github.Manager webchangeClient *webchange.Client @@ -88,8 +87,8 @@ type Manager struct { // the provider package from the operator's configuration; summaryModel // backs context summarisation and may be the same model. The editClient // is the edit pipe to the Node hocuspocus service; the search client -// backs the search_documents tool and searchJobs is the queue document -// writes announce themselves to; providerName labels token metrics so +// backs the search_documents tool and searchTrigger runs the search-job +// worker once a document write has committed; providerName labels token metrics so // usage stays readable across a provider change; githubMan and // webchangeClient are the integrations the hook tools create watchers // through; the tree notifier broadcasts sidebar refresh events after @@ -105,7 +104,7 @@ func NewManager( fc metricutil.Factory, editClient tools.EditApplier, searcher tools.Searcher, - searchJobs *search.Jobs, + searchTrigger tools.SearchTrigger, runners tools.DataSourceRunners, githubMan *github.Manager, webchangeClient *webchange.Client, @@ -137,14 +136,14 @@ func NewManager( } m := &Manager{ - log: log, - db: db, - search: searcher, - jobs: searchJobs, - runners: runners, - model: chatModel, - summary: summaryModel, - applier: editClient, + log: log, + db: db, + search: searcher, + searchTrigger: searchTrigger, + runners: runners, + model: chatModel, + summary: summaryModel, + applier: editClient, githubMan: githubMan, webchangeClient: webchangeClient, @@ -217,7 +216,7 @@ func (m *Manager) ToolSet(orgID, userID string) *tools.Set { m.log, m.db, m.search, - m.jobs, + m.searchTrigger, m.runners, m.githubMan, m.webchangeClient, diff --git a/server/core/internal/assistant/manager_test.go b/server/core/internal/assistant/manager_test.go index 93bcac29..d0b2143b 100644 --- a/server/core/internal/assistant/manager_test.go +++ b/server/core/internal/assistant/manager_test.go @@ -18,7 +18,6 @@ import ( persistMock "github.com/oxynote/oxynote/server/core/internal/assistant/persist/_mock" protocolMock "github.com/oxynote/oxynote/server/core/internal/assistant/protocol/_mock" toolsMock "github.com/oxynote/oxynote/server/core/internal/assistant/tools/_mock" - "github.com/oxynote/oxynote/server/core/internal/search" "github.com/oxynote/oxynote/server/core/pkg/errutil" "github.com/oxynote/oxynote/server/core/pkg/memkit" "github.com/oxynote/oxynote/server/core/pkg/metricutil" @@ -31,7 +30,7 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, testutil.IgnoreBleveWorkers()) } // discardLog returns a logger that writes nowhere. @@ -39,6 +38,11 @@ func discardLog() *slog.Logger { return slog.New(slog.DiscardHandler) } +// stubSearchTrigger satisfies the tools' SearchTrigger with a no-op. +type stubSearchTrigger struct{} + +func (*stubSearchTrigger) Trigger() {} + // stubChatModel builds a chat model that answers with the given // messages in order. The last one repeats once the script runs out, so // a test that under-specifies gets a terminating answer rather than a @@ -186,20 +190,18 @@ func testManagerStores() (*Manager, *stores) { log := discardLog() m := &Manager{ - log: log, - db: &toolsMock.DB{}, - search: &toolsMock.Searcher{ - ConfiguredFunc: func() bool { return true }, - }, - jobs: search.NewJobs(true), - applier: &toolsMock.EditApplier{}, - history: persist.NewHistory(log, st.history), - checkpoints: persist.NewCheckpoints(log, st.blobs), - pendings: persist.NewPendings(log, st.pendings), - offload: persist.NewOffload(st.blobs), - metrics: newMetrics(metricutil.NewFactory("test", prometheus.NewRegistry()), "claude"), - model: stubChatModel(), - summary: stubChatModel(), + log: log, + db: &toolsMock.DB{}, + search: &toolsMock.Searcher{}, + searchTrigger: &stubSearchTrigger{}, + applier: &toolsMock.EditApplier{}, + history: persist.NewHistory(log, st.history), + checkpoints: persist.NewCheckpoints(log, st.blobs), + pendings: persist.NewPendings(log, st.pendings), + offload: persist.NewOffload(st.blobs), + metrics: newMetrics(metricutil.NewFactory("test", prometheus.NewRegistry()), "claude"), + model: stubChatModel(), + summary: stubChatModel(), } m.turns.m = make(map[string]struct{}) @@ -238,7 +240,7 @@ func Test_NewManager(t *testing.T) { fc := metricutil.NewFactory("test", prometheus.NewRegistry()) gh := &github.Manager{} wc := &webchange.Client{} - m := NewManager(discardLog(), nil, c.Pool, nil, nil, fc, nil, nil, search.NewJobs(false), nil, gh, wc, "claude") + m := NewManager(discardLog(), nil, c.Pool, nil, nil, fc, nil, nil, &stubSearchTrigger{}, nil, gh, wc, "claude") require.NotNil(t, m) assert.NotNil(t, m.log) diff --git a/server/core/internal/assistant/middleware/observer_test.go b/server/core/internal/assistant/middleware/observer_test.go index e8412bc7..ac452581 100644 --- a/server/core/internal/assistant/middleware/observer_test.go +++ b/server/core/internal/assistant/middleware/observer_test.go @@ -19,7 +19,7 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, testutil.IgnoreBleveWorkers()) } func Test_NewObserver(t *testing.T) { diff --git a/server/core/internal/assistant/tools/0mock_search_trigger_test.go b/server/core/internal/assistant/tools/0mock_search_trigger_test.go new file mode 100644 index 00000000..07a7fd1d --- /dev/null +++ b/server/core/internal/assistant/tools/0mock_search_trigger_test.go @@ -0,0 +1,67 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package tools + +import ( + "sync" +) + +// Ensure, that SearchTriggerMock does implement SearchTrigger. +// If this is not the case, regenerate this file with moq. +var _ SearchTrigger = &SearchTriggerMock{} + +// SearchTriggerMock is a mock implementation of SearchTrigger. +// +// func TestSomethingThatUsesSearchTrigger(t *testing.T) { +// +// // make and configure a mocked SearchTrigger +// mockedSearchTrigger := &SearchTriggerMock{ +// TriggerFunc: func() { +// panic("mock out the Trigger method") +// }, +// } +// +// // use mockedSearchTrigger in code that requires SearchTrigger +// // and then make assertions. +// +// } +type SearchTriggerMock struct { + // TriggerFunc mocks the Trigger method. + TriggerFunc func() + + // calls tracks calls to the methods. + calls struct { + // Trigger holds details about calls to the Trigger method. + Trigger []struct { + } + } + lockTrigger sync.RWMutex +} + +// Trigger calls TriggerFunc. +func (mock *SearchTriggerMock) Trigger() { + callInfo := struct { + }{} + mock.lockTrigger.Lock() + mock.calls.Trigger = append(mock.calls.Trigger, callInfo) + mock.lockTrigger.Unlock() + if mock.TriggerFunc == nil { + return + } + mock.TriggerFunc() +} + +// TriggerCalls gets all the calls that were made to Trigger. +// Check the length with: +// +// len(mockedSearchTrigger.TriggerCalls()) +func (mock *SearchTriggerMock) TriggerCalls() []struct { +} { + var calls []struct { + } + mock.lockTrigger.RLock() + calls = mock.calls.Trigger + mock.lockTrigger.RUnlock() + return calls +} diff --git a/server/core/internal/assistant/tools/0mock_searcher_test.go b/server/core/internal/assistant/tools/0mock_searcher_test.go index 9e62efdd..19ef5c45 100644 --- a/server/core/internal/assistant/tools/0mock_searcher_test.go +++ b/server/core/internal/assistant/tools/0mock_searcher_test.go @@ -30,17 +30,11 @@ var _ Searcher = &SearcherMock{} // // } type SearcherMock struct { - // ConfiguredFunc mocks the Configured method. - ConfiguredFunc func() bool - // SearchDocumentBlocksFunc mocks the SearchDocumentBlocks method. SearchDocumentBlocksFunc func(ctx context.Context, organizationID string, query string, limit int) ([]search.Block, error) // calls tracks calls to the methods. calls struct { - // Configured holds details about calls to the Configured method. - Configured []struct { - } // SearchDocumentBlocks holds details about calls to the SearchDocumentBlocks method. SearchDocumentBlocks []struct { // Ctx is the ctx argument value. @@ -53,7 +47,6 @@ type SearcherMock struct { Limit int } } - lockConfigured sync.RWMutex lockSearchDocumentBlocks sync.RWMutex } @@ -104,33 +97,3 @@ func (mock *SearcherMock) SearchDocumentBlocksCalls() []struct { mock.lockSearchDocumentBlocks.RUnlock() return calls } - -// Configured calls ConfiguredFunc. -func (mock *SearcherMock) Configured() bool { - callInfo := struct { - }{} - mock.lockConfigured.Lock() - mock.calls.Configured = append(mock.calls.Configured, callInfo) - mock.lockConfigured.Unlock() - if mock.ConfiguredFunc == nil { - var ( - bOut bool - ) - return bOut - } - return mock.ConfiguredFunc() -} - -// ConfiguredCalls gets all the calls that were made to Configured. -// Check the length with: -// -// len(mockedSearcher.ConfiguredCalls()) -func (mock *SearcherMock) ConfiguredCalls() []struct { -} { - var calls []struct { - } - mock.lockConfigured.RLock() - calls = mock.calls.Configured - mock.lockConfigured.RUnlock() - return calls -} diff --git a/server/core/internal/assistant/tools/0mock_tx_test.go b/server/core/internal/assistant/tools/0mock_tx_test.go index 06621da9..cd187018 100644 --- a/server/core/internal/assistant/tools/0mock_tx_test.go +++ b/server/core/internal/assistant/tools/0mock_tx_test.go @@ -28,8 +28,8 @@ var _ Tx = &TxMock{} // InsertDocumentFunc: func(ctx context.Context, doc document.Document) error { // panic("mock out the InsertDocument method") // }, -// InsertDocumentSearchJobFunc: func(ctx context.Context, diff search.BlocksDifference) error { -// panic("mock out the InsertDocumentSearchJob method") +// InsertSearchJobFunc: func(ctx context.Context, job search.Job) error { +// panic("mock out the InsertSearchJob method") // }, // RollbackFunc: func() error { // panic("mock out the Rollback method") @@ -53,8 +53,8 @@ type TxMock struct { // InsertDocumentFunc mocks the InsertDocument method. InsertDocumentFunc func(ctx context.Context, doc document.Document) error - // InsertDocumentSearchJobFunc mocks the InsertDocumentSearchJob method. - InsertDocumentSearchJobFunc func(ctx context.Context, diff search.BlocksDifference) error + // InsertSearchJobFunc mocks the InsertSearchJob method. + InsertSearchJobFunc func(ctx context.Context, job search.Job) error // RollbackFunc mocks the Rollback method. RollbackFunc func() error @@ -83,12 +83,12 @@ type TxMock struct { // Doc is the doc argument value. Doc document.Document } - // InsertDocumentSearchJob holds details about calls to the InsertDocumentSearchJob method. - InsertDocumentSearchJob []struct { + // InsertSearchJob holds details about calls to the InsertSearchJob method. + InsertSearchJob []struct { // Ctx is the ctx argument value. Ctx context.Context - // Diff is the diff argument value. - Diff search.BlocksDifference + // Job is the job argument value. + Job search.Job } // Rollback holds details about calls to the Rollback method. Rollback []struct { @@ -108,7 +108,7 @@ type TxMock struct { lockCommit sync.RWMutex lockDeleteDocument sync.RWMutex lockInsertDocument sync.RWMutex - lockInsertDocumentSearchJob sync.RWMutex + lockInsertSearchJob sync.RWMutex lockRollback sync.RWMutex lockUpsertDocumentMaintainers sync.RWMutex } @@ -182,42 +182,42 @@ func (mock *TxMock) InsertDocumentCalls() []struct { return calls } -// InsertDocumentSearchJob calls InsertDocumentSearchJobFunc. -func (mock *TxMock) InsertDocumentSearchJob(ctx context.Context, diff search.BlocksDifference) error { +// InsertSearchJob calls InsertSearchJobFunc. +func (mock *TxMock) InsertSearchJob(ctx context.Context, job search.Job) error { callInfo := struct { - Ctx context.Context - Diff search.BlocksDifference + Ctx context.Context + Job search.Job }{ - Ctx: ctx, - Diff: diff, + Ctx: ctx, + Job: job, } - mock.lockInsertDocumentSearchJob.Lock() - mock.calls.InsertDocumentSearchJob = append(mock.calls.InsertDocumentSearchJob, callInfo) - mock.lockInsertDocumentSearchJob.Unlock() - if mock.InsertDocumentSearchJobFunc == nil { + mock.lockInsertSearchJob.Lock() + mock.calls.InsertSearchJob = append(mock.calls.InsertSearchJob, callInfo) + mock.lockInsertSearchJob.Unlock() + if mock.InsertSearchJobFunc == nil { var ( errOut error ) return errOut } - return mock.InsertDocumentSearchJobFunc(ctx, diff) + return mock.InsertSearchJobFunc(ctx, job) } -// InsertDocumentSearchJobCalls gets all the calls that were made to InsertDocumentSearchJob. +// InsertSearchJobCalls gets all the calls that were made to InsertSearchJob. // Check the length with: // -// len(mockedTx.InsertDocumentSearchJobCalls()) -func (mock *TxMock) InsertDocumentSearchJobCalls() []struct { - Ctx context.Context - Diff search.BlocksDifference +// len(mockedTx.InsertSearchJobCalls()) +func (mock *TxMock) InsertSearchJobCalls() []struct { + Ctx context.Context + Job search.Job } { var calls []struct { - Ctx context.Context - Diff search.BlocksDifference + Ctx context.Context + Job search.Job } - mock.lockInsertDocumentSearchJob.RLock() - calls = mock.calls.InsertDocumentSearchJob - mock.lockInsertDocumentSearchJob.RUnlock() + mock.lockInsertSearchJob.RLock() + calls = mock.calls.InsertSearchJob + mock.lockInsertSearchJob.RUnlock() return calls } diff --git a/server/core/internal/assistant/tools/_mock/searcher.go b/server/core/internal/assistant/tools/_mock/searcher.go index 0c8385a5..f3cf72fb 100644 --- a/server/core/internal/assistant/tools/_mock/searcher.go +++ b/server/core/internal/assistant/tools/_mock/searcher.go @@ -5,10 +5,9 @@ package mock import ( "context" - "sync" - "github.com/oxynote/oxynote/server/core/internal/assistant/tools" "github.com/oxynote/oxynote/server/core/internal/search" + "sync" ) // Ensure, that Searcher does implement tools.Searcher. @@ -19,29 +18,23 @@ var _ tools.Searcher = &Searcher{} // // func TestSomethingThatUsesSearcher(t *testing.T) { // -// // make and configure a mocked tools.Searcher +// // make and configure a mocked Searcher // mockedSearcher := &Searcher{ // SearchDocumentBlocksFunc: func(ctx context.Context, organizationID string, query string, limit int) ([]search.Block, error) { // panic("mock out the SearchDocumentBlocks method") // }, // } // -// // use mockedSearcher in code that requires tools.Searcher +// // use mockedSearcher in code that requires Searcher // // and then make assertions. // // } type Searcher struct { - // ConfiguredFunc mocks the Configured method. - ConfiguredFunc func() bool - // SearchDocumentBlocksFunc mocks the SearchDocumentBlocks method. SearchDocumentBlocksFunc func(ctx context.Context, organizationID string, query string, limit int) ([]search.Block, error) // calls tracks calls to the methods. calls struct { - // Configured holds details about calls to the Configured method. - Configured []struct { - } // SearchDocumentBlocks holds details about calls to the SearchDocumentBlocks method. SearchDocumentBlocks []struct { // Ctx is the ctx argument value. @@ -54,7 +47,6 @@ type Searcher struct { Limit int } } - lockConfigured sync.RWMutex lockSearchDocumentBlocks sync.RWMutex } @@ -76,10 +68,10 @@ func (mock *Searcher) SearchDocumentBlocks(ctx context.Context, organizationID s mock.lockSearchDocumentBlocks.Unlock() if mock.SearchDocumentBlocksFunc == nil { var ( - blocksOut []search.Block - errOut error + out0 []search.Block + errOut error ) - return blocksOut, errOut + return out0, errOut } return mock.SearchDocumentBlocksFunc(ctx, organizationID, query, limit) } @@ -105,33 +97,3 @@ func (mock *Searcher) SearchDocumentBlocksCalls() []struct { mock.lockSearchDocumentBlocks.RUnlock() return calls } - -// Configured calls ConfiguredFunc. -func (mock *Searcher) Configured() bool { - callInfo := struct { - }{} - mock.lockConfigured.Lock() - mock.calls.Configured = append(mock.calls.Configured, callInfo) - mock.lockConfigured.Unlock() - if mock.ConfiguredFunc == nil { - var ( - bOut bool - ) - return bOut - } - return mock.ConfiguredFunc() -} - -// ConfiguredCalls gets all the calls that were made to Configured. -// Check the length with: -// -// len(mockedSearcher.ConfiguredCalls()) -func (mock *Searcher) ConfiguredCalls() []struct { -} { - var calls []struct { - } - mock.lockConfigured.RLock() - calls = mock.calls.Configured - mock.lockConfigured.RUnlock() - return calls -} diff --git a/server/core/internal/assistant/tools/document_test.go b/server/core/internal/assistant/tools/document_test.go index 4dd68121..443e8f71 100644 --- a/server/core/internal/assistant/tools/document_test.go +++ b/server/core/internal/assistant/tools/document_test.go @@ -29,7 +29,7 @@ func stubCreateDB(checkErr error) *DBMock { UpsertDocumentMaintainersFunc: func(context.Context, xid.ID, string, []string) error { return nil }, - InsertDocumentSearchJobFunc: func(context.Context, search.BlocksDifference) error { + InsertSearchJobFunc: func(context.Context, search.Job) error { return nil }, })) @@ -601,7 +601,7 @@ func Test_deleteDocument_Execute(t *testing.T) { DeleteDocumentFunc: func(_ context.Context, id xid.ID, _ string) ([]xid.ID, error) { return []xid.ID{id}, deleteErr }, - InsertDocumentSearchJobFunc: func(context.Context, search.BlocksDifference) error { + InsertSearchJobFunc: func(context.Context, search.Job) error { return nil }, })) diff --git a/server/core/internal/assistant/tools/input.go b/server/core/internal/assistant/tools/input.go index b63cdb6c..9b5ac619 100644 --- a/server/core/internal/assistant/tools/input.go +++ b/server/core/internal/assistant/tools/input.go @@ -59,10 +59,9 @@ type Deps struct { // search is the full-text index behind search_documents. search Searcher - // jobs is the way into the search-job queue: it decides whether a - // deployment indexes at all, so writes queue through it instead of - // hitting the database directly. - jobs *search.Jobs + // searchTrigger runs the search-job worker once a write that queued a + // job has committed. + searchTrigger SearchTrigger // runners hands out the runner a data-source tool reads through. runners DataSourceRunners @@ -112,7 +111,7 @@ func NewDeps( log *slog.Logger, db DB, searcher Searcher, - jobs *search.Jobs, + searchTrigger SearchTrigger, runners DataSourceRunners, githubMan *github.Manager, webchangeClient *webchange.Client, @@ -131,7 +130,7 @@ func NewDeps( ), db: db, search: searcher, - jobs: jobs, + searchTrigger: searchTrigger, runners: runners, githubMan: githubMan, webchangeClient: webchangeClient, @@ -451,7 +450,7 @@ func (i *input) CreateDocument(doc document.Document) error { // without this the document is invisible to search until someone // edits it, since only the persist path queues a job. - if err := i.jobs.Enqueue(i.ctx, tx, search.BlocksDiff(nil, doc.Search())); err != nil { + if err := tx.InsertSearchJob(i.ctx, search.BranchScope(i.orgID, doc.ID, doc.BranchID)); err != nil { return fmt.Errorf("insert search job: %w", err) } @@ -459,6 +458,7 @@ func (i *input) CreateDocument(doc document.Document) error { return fmt.Errorf("commit: %w", err) } + i.searchTrigger.Trigger() i.recordTouched(doc.ID, doc.BranchID) return nil @@ -511,13 +511,19 @@ func (i *input) DeleteDocument(id xid.ID) error { return ErrUnknownDocument } - if err := i.jobs.Enqueue(i.ctx, tx, search.BlocksDifference{ - RemovedDocuments: ids, - }); err != nil { - return fmt.Errorf("insert search job: %w", err) + for _, id := range ids { + if err := tx.InsertSearchJob(i.ctx, search.DocumentScope(i.orgID, id)); err != nil { + return fmt.Errorf("insert search job: %w", err) + } } - return tx.Commit() + if err := tx.Commit(); err != nil { + return fmt.Errorf("commit: %w", err) + } + + i.searchTrigger.Trigger() + + return nil } // MoveDocument re-parents the document doc describes. @@ -1317,9 +1323,9 @@ type Tx interface { // document's maintainer set. Used by create_document. UpsertDocumentMaintainers(ctx context.Context, documentID xid.ID, organizationID string, maintainerIDs []string) error - // InsertDocumentSearchJob should queue the search index update for a - // document. Used by create_document and delete_document. - InsertDocumentSearchJob(ctx context.Context, diff search.BlocksDifference) error + // InsertSearchJob should queue the search job's scope. Used by + // create_document and delete_document. + InsertSearchJob(ctx context.Context, job search.Job) error // DeleteDocument should remove a document and report the ids of the // document and of every cascade-deleted descendant. Used by @@ -1327,15 +1333,19 @@ type Tx interface { DeleteDocument(ctx context.Context, id xid.ID, organizationID string) ([]xid.ID, error) } +// SearchTrigger runs the search-job worker once a job has committed. +// +//go:generate ../../../scripts/codegen/mock -t internal SearchTrigger search_trigger +type SearchTrigger interface { + // Trigger should run a search-job pass right away. + Trigger() +} + // Searcher is the full-text search surface search_documents uses. -// The document/search Meilisearch client satisfies it. +// The search index satisfies it. // //go:generate ../../../scripts/codegen/mock -t both Searcher searcher type Searcher interface { - // Configured should report whether search is configured on this - // deployment. - Configured() bool - // SearchDocumentBlocks should return blocks whose text matches the // query, scoped to the organization and capped at limit hits. SearchDocumentBlocks(ctx context.Context, organizationID, query string, limit int) ([]search.Block, error) diff --git a/server/core/internal/assistant/tools/input_test.go b/server/core/internal/assistant/tools/input_test.go index dff335db..550c9ca9 100644 --- a/server/core/internal/assistant/tools/input_test.go +++ b/server/core/internal/assistant/tools/input_test.go @@ -34,7 +34,7 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, testutil.IgnoreBleveWorkers()) } // _testDocID is the document id the tool tests address. @@ -72,12 +72,10 @@ func testDeps(db *DBMock, applier *EditApplierMock, tree *TreeNotifierMock) *Dep } d := &Deps{ - log: discardLog(), - db: db, - search: &SearcherMock{ - ConfiguredFunc: func() bool { return true }, - }, - jobs: search.NewJobs(true), + log: discardLog(), + db: db, + search: &SearcherMock{}, + searchTrigger: &SearchTriggerMock{}, runners: &DataSourceRunnersMock{ RunnerFunc: func(datasource.DataSource) datasource.Runner { return &datasourceMock.Runner{} @@ -405,15 +403,15 @@ func Test_NewDeps(t *testing.T) { RunnerFunc: func(datasource.DataSource) datasource.Runner { return runner }, } - jobs := search.NewJobs(true) + trigger := &SearchTriggerMock{} - d := NewDeps(discardLog(), db, searcher, jobs, runners, gh, wc, applier, tree, tags, hooks, offload, "org", "user") + d := NewDeps(discardLog(), db, searcher, trigger, runners, gh, wc, applier, tree, tags, hooks, offload, "org", "user") require.NotNil(t, d) assert.NotNil(t, d.log) assert.Same(t, db, d.db) assert.Same(t, searcher, d.search) - assert.Same(t, jobs, d.jobs) + assert.Same(t, trigger, d.searchTrigger) assert.Same(t, runners, d.runners) assert.Same(t, gh, d.githubMan) assert.Same(t, wc, d.webchangeClient) @@ -520,7 +518,7 @@ func Test_input_CreateDocument(t *testing.T) { UpsertDocumentMaintainersFunc: func(context.Context, xid.ID, string, []string) error { return upsertErr }, - InsertDocumentSearchJobFunc: func(context.Context, search.BlocksDifference) error { + InsertSearchJobFunc: func(context.Context, search.Job) error { return jobErr }, CommitFunc: func() error { return commitErr }, @@ -631,7 +629,7 @@ func Test_input_DeleteDocument(t *testing.T) { DeleteDocumentFunc: func(context.Context, xid.ID, string) ([]xid.ID, error) { return ids, deleteErr }, - InsertDocumentSearchJobFunc: func(context.Context, search.BlocksDifference) error { + InsertSearchJobFunc: func(context.Context, search.Job) error { return jobErr }, CommitFunc: func() error { return commitErr }, @@ -681,7 +679,8 @@ func Test_input_DeleteDocument(t *testing.T) { "Delete and search removal land together": func() tcase { tx := stubTx([]xid.ID{docID, xid.New()}, nil, nil, nil) - return tcase{DB: stubDB(tx, nil), Tx: tx, Commits: 1, Jobs: 1} + // one job per cascade-deleted document. + return tcase{DB: stubDB(tx, nil), Tx: tx, Commits: 1, Jobs: 2} }(), } @@ -706,11 +705,12 @@ func Test_input_DeleteDocument(t *testing.T) { assert.Len(t, c.Tx.CommitCalls(), c.Commits) assert.Len(t, c.Tx.RollbackCalls(), 1) - ff := c.Tx.InsertDocumentSearchJobCalls() + ff := c.Tx.InsertSearchJobCalls() require.Len(t, ff, c.Jobs) if c.Jobs != 0 { - assert.NotEmpty(t, ff[0].Diff.RemovedDocuments) + assert.True(t, ff[0].Job.DocumentID.Valid) + assert.False(t, ff[0].Job.BranchID.Valid) } }) } diff --git a/server/core/internal/assistant/tools/tools.go b/server/core/internal/assistant/tools/tools.go index 60632f78..881f7e94 100644 --- a/server/core/internal/assistant/tools/tools.go +++ b/server/core/internal/assistant/tools/tools.go @@ -106,16 +106,7 @@ func New(deps *Deps) *Set { readBlock{}, listTags{}, listHooks{}, - } - - // a deployment without search has no index behind search_documents, - // so the tool is left out of the registry entirely — neither the - // model nor the MCP surface is offered a tool that cannot work. - if deps.search.Configured() { - all = append(all, searchDocuments{}) - } - - all = append(all, + searchDocuments{}, listDataSources{}, getPrometheusMetadata{}, listPrometheusLabelNames{}, @@ -147,7 +138,7 @@ func New(deps *Deps) *Set { deleteHook{}, readToolOutput{}, - ) + } s := &Set{tools: make(map[Name]registryTool, len(all))} diff --git a/server/core/internal/assistant/tools/tools_test.go b/server/core/internal/assistant/tools/tools_test.go index ef798d4e..ecb3a6d3 100644 --- a/server/core/internal/assistant/tools/tools_test.go +++ b/server/core/internal/assistant/tools/tools_test.go @@ -121,26 +121,6 @@ func Test_New(t *testing.T) { } } -func Test_New_withoutSearch(t *testing.T) { - t.Parallel() - - d := testDeps(nil, nil, nil) - d.search = &SearcherMock{} - - s := New(d) - - // without search there is no index behind search_documents, so the - // registry offers it to no surface at all; everything else stays. - require.Len(t, s.tools, len(allToolNames())-1) - - _, ok := s.tools[NameSearchDocuments] - assert.False(t, ok) - - for _, e := range s.Entries() { - assert.NotEqual(t, string(NameSearchDocuments), e.Name) - } -} - func Test_Set_Tools(t *testing.T) { t.Parallel() diff --git a/server/core/internal/db/document_branch.go b/server/core/internal/db/document_branch.go index 85f8c531..01166897 100644 --- a/server/core/internal/db/document_branch.go +++ b/server/core/internal/db/document_branch.go @@ -187,6 +187,29 @@ func (a *agent) FetchDocumentUnsafeByBranchID(ctx context.Context, branchID xid. return doc, nil } +// FetchDocumentBranchesAfter fetches up to limit branches whose id sorts +// after the given one, joined against their document, in id order and +// across every organization. +func (a *agent) FetchDocumentBranchesAfter(ctx context.Context, after xid.ID, limit int) ([]document.Document, error) { + // a zero id is compared as its string form, since its driver value + // would be a null the comparison cannot take. + q, args := a.selectDocumentBranch(a.builder.Select()). + Where(sq.Gt{ + "db.id": after.String(), + }). + OrderBy("db.id ASC"). + Limit(uint64(limit)). + MustSql() + + docs := []document.Document{} + + if err := sqlx.SelectContext(ctx, a.sql, &docs, q, args...); err != nil { + return nil, err + } + + return docs, nil +} + // selectDocumentBranch prepares a select statement joining a document against // one of its branches. The organization scope is left to the caller, since // the unsafe variants exist precisely to go without it. diff --git a/server/core/internal/db/document_branch_test.go b/server/core/internal/db/document_branch_test.go index 4ae2b0f3..025146da 100644 --- a/server/core/internal/db/document_branch_test.go +++ b/server/core/internal/db/document_branch_test.go @@ -600,6 +600,59 @@ func Test_agent_FetchDocumentUnsafeByBranchID(t *testing.T) { testutil.AssertFilterEqual(t, branch, res) } +func Test_agent_FetchDocumentBranchesAfter(t *testing.T) { + db := prepTempDB(t) + + // error - cancelled context + ctx, cancel := context.WithCancel(context.Background()) + cancel() + + res, err := db.FetchDocumentBranchesAfter(ctx, xid.ID{}, 10) + require.Error(t, err) + assert.Nil(t, res) + + // success - no branches + res, err = db.FetchDocumentBranchesAfter(context.Background(), xid.ID{}, 10) + require.NoError(t, err) + assert.Empty(t, res) + + // success - every branch across organizations, in id order. Each + // prepared document comes with its own default branch, so two documents + // and three extra branches make five. + branches := prepDocumentBranches(t, db, 3, func(i int, doc *document.Document) { + if i == 2 { + other := prepDocuments(t, db, 1, nil)[0] + doc.ID = other.ID + doc.OrganizationID = other.OrganizationID + } + }) + + all, err := db.FetchDocumentBranchesAfter(context.Background(), xid.ID{}, 10) + require.NoError(t, err) + require.Len(t, all, 5) + + ids := make([]string, 0, len(all)) + + for _, doc := range all { + ids = append(ids, doc.BranchID.String()) + } + + assert.IsIncreasing(t, ids) + + for _, branch := range branches { + assert.Contains(t, ids, branch.BranchID.String()) + } + + // success - a page, then the rest after the page's last id + res, err = db.FetchDocumentBranchesAfter(context.Background(), xid.ID{}, 2) + require.NoError(t, err) + testutil.AssertFilterEqual(t, all[:2], res, null.Value[xid.ID]{}) + + res, err = db.FetchDocumentBranchesAfter(context.Background(), all[1].BranchID, 10) + require.NoError(t, err) + testutil.AssertFilterEqual(t, all[2:], res, null.Value[xid.ID]{}) +} + // prepHistoryEntries writes count entries of the document's branch, one per // aggregation bucket so each lands as its own entry, oldest first. func prepHistoryEntries(t *testing.T, db *DB, doc *document.Document, count int) []document.HistoryEntry { diff --git a/server/core/internal/db/document_search_job.go b/server/core/internal/db/document_search_job.go deleted file mode 100644 index feb27253..00000000 --- a/server/core/internal/db/document_search_job.go +++ /dev/null @@ -1,65 +0,0 @@ -package db - -import ( - "context" - - sq "github.com/Masterminds/squirrel" - "github.com/jmoiron/sqlx" - "github.com/oxynote/oxynote/server/core/internal/search" -) - -// InsertDocumentSearchJob inserts a new document search job into the database. -func (a *agent) InsertDocumentSearchJob(ctx context.Context, blockDiff search.BlocksDifference) error { - return a.insertDocumentSearchJob(ctx, a.sql, blockDiff) -} - -// insertDocumentSearchJob inserts a search job through the given executor so -// an agent method that already opened a transaction can queue one inside it. -func (a *agent) insertDocumentSearchJob( - ctx context.Context, - ex sqlx.ExecerContext, - blockDiff search.BlocksDifference, -) error { - q, args := a.builder.Insert("document_search_jobs"). - SetMap(map[string]any{ - "block_diff": blockDiff, - }).MustSql() - - _, err := ex.ExecContext(ctx, q, args...) - - return err -} - -// FetchDocumentSearchJobs retrieves a batch of document search jobs with IDs -// greater than the given offset ID. -func (a *agent) FetchDocumentSearchJobs(ctx context.Context, offsetID, limit int64) ([]search.DocumentSearchJob, error) { - q, args := a.builder.Select( - "id", - "block_diff", - ).From("document_search_jobs"). - Where(sq.Gt{"id": offsetID}). - OrderBy("id ASC"). - Limit(uint64(limit)). - MustSql() - - var jobs []search.DocumentSearchJob - - err := sqlx.SelectContext(ctx, a.sql, &jobs, q, args...) - if err != nil { - return nil, err - } - - return jobs, nil -} - -// DeleteDocumentSearchJob deletes a document search job from the database. -func (a *agent) DeleteDocumentSearchJob(ctx context.Context, id int64) error { - q, args := a.builder.Delete("document_search_jobs"). - Where(sq.Eq{ - "id": id, - }).MustSql() - - _, err := a.sql.ExecContext(ctx, q, args...) - - return err -} diff --git a/server/core/internal/db/document_search_job_test.go b/server/core/internal/db/document_search_job_test.go deleted file mode 100644 index 6d78e87e..00000000 --- a/server/core/internal/db/document_search_job_test.go +++ /dev/null @@ -1,221 +0,0 @@ -package db - -import ( - "context" - "database/sql" - "strconv" - "testing" - - sq "github.com/Masterminds/squirrel" - "github.com/oxynote/oxynote/server/core/internal/search" - "github.com/oxynote/oxynote/server/core/pkg/testutil" - "github.com/rs/xid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func prepDocumentSearchJobs(t *testing.T, db *DB, count int, fn func(int, *search.DocumentSearchJob)) []search.DocumentSearchJob { - t.Helper() - - res := make([]search.DocumentSearchJob, count) - - for i := range count { - job := search.DocumentSearchJob{ - BlockDiff: search.BlocksDifference{ - Updated: []search.Block{ - { - ID: "block-" + strconv.Itoa(i), - OrganizationID: "org-" + strconv.Itoa(i), - DocumentID: xid.New(), - Type: "paragraph", - Text: "Updated block " + strconv.Itoa(i), - }, - }, - }, - } - - if fn != nil { - fn(i, &job) - } - - // the id column is a serial; let the database assign it so - // the sequence stays usable for production inserts. - q, args := db.builder.Insert("document_search_jobs"). - SetMap(map[string]any{ - "block_diff": job.BlockDiff, - }). - Suffix("RETURNING id"). - MustSql() - - err := db.sql.Get(&job.ID, q, args...) - require.NoError(t, err) - - res[i] = job - } - - return res -} - -func Test_agent_InsertDocumentSearchJob(t *testing.T) { - type tcase struct { - CancelledContext bool - BlockDiff search.BlocksDifference - Err error - } - - cc := map[string]func(*testing.T, *DB) tcase{ - "Cancelled context": func(_ *testing.T, _ *DB) tcase { - return tcase{ - CancelledContext: true, - Err: assert.AnError, - } - }, - "Successful insert": func(_ *testing.T, _ *DB) tcase { - return tcase{ - BlockDiff: search.BlocksDifference{ - Added: []search.Block{ - { - ID: "block-added", - OrganizationID: "org-added", - DocumentID: xid.New(), - Type: "heading", - Text: "Added block", - }, - }, - Removed: []search.Block{ - { - ID: "block-removed", - OrganizationID: "org-removed", - DocumentID: xid.New(), - Type: "paragraph", - Text: "Removed block", - }, - }, - }, - } - }, - } - - for cn, cfn := range cc { - t.Run(cn, func(t *testing.T) { - t.Parallel() - - db := prepTempDB(t) - c := cfn(t, db) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - if c.CancelledContext { - cancel() - } - - err := db.InsertDocumentSearchJob(ctx, c.BlockDiff) - testutil.RequireEqualError(t, c.Err, err) - - if err != nil { - return - } - - var blockDiff search.BlocksDifference - - q, args := db.builder.Select("block_diff"). - From("document_search_jobs"). - MustSql() - - err = db.sql.Get(&blockDiff, q, args...) - require.NoError(t, err) - assert.Equal(t, c.BlockDiff, blockDiff) - }) - } -} - -func Test_agent_FetchDocumentSearchJobs(t *testing.T) { - db := prepTempDB(t) - - // error - cancelled context - ctx, cancel := context.WithCancel(context.Background()) - cancel() - - res, err := db.FetchDocumentSearchJobs(ctx, 0, 10) - require.Error(t, err) - assert.Nil(t, res) - - // success - no jobs - res, err = db.FetchDocumentSearchJobs(context.Background(), 0, 10) - require.NoError(t, err) - assert.Empty(t, res) - - // success - limited batch in id order - jobs := prepDocumentSearchJobs(t, db, 3, nil) - - res, err = db.FetchDocumentSearchJobs(context.Background(), 0, 2) - assert.NoError(t, err) - assert.Equal(t, jobs[:2], res) - - // success - offset skips earlier jobs - res, err = db.FetchDocumentSearchJobs(context.Background(), jobs[0].ID, 10) - assert.NoError(t, err) - assert.Equal(t, jobs[1:], res) -} - -func Test_agent_DeleteDocumentSearchJob(t *testing.T) { - type tcase struct { - CancelledContext bool - ID int64 - Err error - } - - cc := map[string]func(*testing.T, *DB) tcase{ - "Cancelled context": func(t *testing.T, db *DB) tcase { - jobs := prepDocumentSearchJobs(t, db, 1, nil) - - return tcase{ - CancelledContext: true, - ID: jobs[0].ID, - Err: assert.AnError, - } - }, - "Successful delete": func(t *testing.T, db *DB) tcase { - jobs := prepDocumentSearchJobs(t, db, 1, nil) - - return tcase{ - ID: jobs[0].ID, - } - }, - } - - for cn, cfn := range cc { - t.Run(cn, func(t *testing.T) { - t.Parallel() - - db := prepTempDB(t) - c := cfn(t, db) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - if c.CancelledContext { - cancel() - } - - err := db.DeleteDocumentSearchJob(ctx, c.ID) - testutil.RequireEqualError(t, c.Err, err) - - if err != nil { - return - } - - var id int64 - - q, args := db.builder.Select("id"). - From("document_search_jobs"). - Where(sq.Eq{ - "id": c.ID, - }).MustSql() - - err = db.sql.Get(&id, q, args...) - testutil.AssertEqualError(t, sql.ErrNoRows, err) - }) - } -} diff --git a/server/core/internal/db/document_test.go b/server/core/internal/db/document_test.go index 49b5e4e4..07f79b96 100644 --- a/server/core/internal/db/document_test.go +++ b/server/core/internal/db/document_test.go @@ -1025,7 +1025,7 @@ func Test_agent_DeleteDocument(t *testing.T) { // the delete itself queues nothing: the caller owns the // search-index removal. - jobs, err := db.FetchDocumentSearchJobs(context.Background(), 0, 10) + jobs, err := db.FetchSearchJobs(context.Background(), 0, 10) require.NoError(t, err) assert.Empty(t, jobs) diff --git a/server/core/internal/db/migrations/001_initial.sql b/server/core/internal/db/migrations/001_initial.sql index f32bc9e4..75c316d5 100644 --- a/server/core/internal/db/migrations/001_initial.sql +++ b/server/core/internal/db/migrations/001_initial.sql @@ -420,9 +420,18 @@ CREATE TABLE document_files ( CREATE INDEX document_files_fk_document_id_idx ON document_files (fk_document_id); CREATE INDEX document_files_fk_organization_id_idx ON document_files (fk_organization_id); -CREATE TABLE document_search_jobs ( - id SERIAL PRIMARY KEY, - block_diff JSONB NOT NULL +-- Search-index resync jobs. A job names a scope (an organization, one of +-- its documents, or one branch) whose entries the worker rebuilds from the +-- rows; there are no foreign keys, since a job must outlive the rows it +-- removes from the index. Queuing a pending scope again bumps its version +-- instead of adding a row. +CREATE TABLE search_jobs ( + id BIGSERIAL PRIMARY KEY, + version BIGINT NOT NULL DEFAULT 1, + organization_id TEXT NOT NULL, + document_id TEXT, + branch_id TEXT, + UNIQUE NULLS NOT DISTINCT (organization_id, document_id, branch_id) ); -- Slack / GitHub integrations and the per-org notification queue. @@ -477,7 +486,7 @@ DROP TABLE slack_messages; DROP TABLE github_installations; DROP TABLE slack_user_links; DROP TABLE slack_apps; -DROP TABLE document_search_jobs; +DROP TABLE search_jobs; DROP TABLE document_files; DROP TABLE branch_reviewers; DROP TABLE user_tag_settings; diff --git a/server/core/internal/db/search_job.go b/server/core/internal/db/search_job.go new file mode 100644 index 00000000..3529c8ac --- /dev/null +++ b/server/core/internal/db/search_job.go @@ -0,0 +1,66 @@ +package db + +import ( + "context" + + sq "github.com/Masterminds/squirrel" + "github.com/jmoiron/sqlx" + "github.com/oxynote/oxynote/server/core/internal/search" +) + +// InsertSearchJob queues the job's scope. A scope already pending has its +// version bumped instead, so the worker applies it once more if it was +// mid-application. +func (a *agent) InsertSearchJob(ctx context.Context, job search.Job) error { + q, args := a.builder.Insert("search_jobs"). + SetMap(map[string]any{ + "organization_id": job.OrganizationID, + "document_id": job.DocumentID, + "branch_id": job.BranchID, + }). + Suffix("ON CONFLICT (organization_id, document_id, branch_id) DO UPDATE SET version = search_jobs.version + 1"). + MustSql() + + _, err := a.sql.ExecContext(ctx, q, args...) + + return err +} + +// FetchSearchJobs retrieves a batch of search jobs with IDs greater than the +// given offset ID. +func (a *agent) FetchSearchJobs(ctx context.Context, offsetID, limit int64) ([]search.Job, error) { + q, args := a.builder.Select( + "id", + "version", + "organization_id", + "document_id", + "branch_id", + ).From("search_jobs"). + Where(sq.Gt{"id": offsetID}). + OrderBy("id ASC"). + Limit(uint64(limit)). + MustSql() + + jobs := []search.Job{} + + err := sqlx.SelectContext(ctx, a.sql, &jobs, q, args...) + if err != nil { + return nil, err + } + + return jobs, nil +} + +// DeleteSearchJob deletes the job at the given version. A job queued again +// meanwhile carries a newer version and stays. +func (a *agent) DeleteSearchJob(ctx context.Context, id, version int64) error { + q, args := a.builder.Delete("search_jobs"). + Where(sq.Eq{ + "id": id, + "version": version, + }).MustSql() + + _, err := a.sql.ExecContext(ctx, q, args...) + + return err +} diff --git a/server/core/internal/db/search_job_test.go b/server/core/internal/db/search_job_test.go new file mode 100644 index 00000000..aa2f48fd --- /dev/null +++ b/server/core/internal/db/search_job_test.go @@ -0,0 +1,302 @@ +package db + +import ( + "context" + "database/sql" + "strconv" + "testing" + + sq "github.com/Masterminds/squirrel" + "github.com/guregu/null/v5" + "github.com/oxynote/oxynote/server/core/internal/search" + "github.com/oxynote/oxynote/server/core/pkg/testutil" + "github.com/rs/xid" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func prepSearchJobs(t *testing.T, db *DB, count int, fn func(int, *search.Job)) []search.Job { + t.Helper() + + res := make([]search.Job, count) + + for i := range count { + job := search.BranchScope("org-"+strconv.Itoa(i), xid.New(), xid.New()) + job.Version = 1 + + if fn != nil { + fn(i, &job) + } + + // the id column is a serial; let the database assign it so + // the sequence stays usable for production inserts. + q, args := db.builder.Insert("search_jobs"). + SetMap(map[string]any{ + "version": job.Version, + "organization_id": job.OrganizationID, + "document_id": job.DocumentID, + "branch_id": job.BranchID, + }). + Suffix("RETURNING id"). + MustSql() + + err := db.sql.Get(&job.ID, q, args...) + require.NoError(t, err) + + res[i] = job + } + + return res +} + +// fetchSearchJobs reads every queued job in id order. +func fetchSearchJobs(t *testing.T, db *DB) []search.Job { + t.Helper() + + q, args := db.builder.Select( + "id", + "version", + "organization_id", + "document_id", + "branch_id", + ).From("search_jobs"). + OrderBy("id ASC"). + MustSql() + + var jobs []search.Job + + require.NoError(t, db.sql.Select(&jobs, q, args...)) + + return jobs +} + +func Test_agent_InsertSearchJob(t *testing.T) { + type tcase struct { + CancelledContext bool + Job search.Job + Result []search.Job + Err error + } + + documentID, branchID := xid.New(), xid.New() + + cc := map[string]func(*testing.T, *DB) tcase{ + "Cancelled context": func(_ *testing.T, _ *DB) tcase { + return tcase{ + CancelledContext: true, + Job: search.BranchScope("org-1", documentID, branchID), + Err: assert.AnError, + } + }, + "Successful insert of a branch scope": func(_ *testing.T, _ *DB) tcase { + job := search.BranchScope("org-1", documentID, branchID) + job.Version = 1 + + return tcase{ + Job: job, + Result: []search.Job{job}, + } + }, + "Successful insert of a document scope": func(_ *testing.T, _ *DB) tcase { + job := search.DocumentScope("org-1", documentID) + job.Version = 1 + + return tcase{ + Job: job, + Result: []search.Job{job}, + } + }, + "Successful insert of an organization scope": func(_ *testing.T, _ *DB) tcase { + job := search.OrganizationScope("org-1") + job.Version = 1 + + return tcase{ + Job: job, + Result: []search.Job{job}, + } + }, + "Pending scope gets its version bumped": func(t *testing.T, db *DB) tcase { + pending := prepSearchJobs(t, db, 1, func(_ int, job *search.Job) { + *job = search.BranchScope("org-1", documentID, branchID) + job.Version = 1 + })[0] + pending.Version = 2 + + return tcase{ + Job: search.BranchScope("org-1", documentID, branchID), + Result: []search.Job{pending}, + } + }, + "Pending scope with nulls gets its version bumped": func(t *testing.T, db *DB) tcase { + pending := prepSearchJobs(t, db, 1, func(_ int, job *search.Job) { + *job = search.OrganizationScope("org-1") + job.Version = 1 + })[0] + pending.Version = 2 + + return tcase{ + Job: search.OrganizationScope("org-1"), + Result: []search.Job{pending}, + } + }, + "Different scope of the same organization is its own job": func(t *testing.T, db *DB) tcase { + pending := prepSearchJobs(t, db, 1, func(_ int, job *search.Job) { + *job = search.OrganizationScope("org-1") + job.Version = 1 + })[0] + + job := search.DocumentScope("org-1", documentID) + job.Version = 1 + + return tcase{ + Job: job, + Result: []search.Job{pending, job}, + } + }, + } + + for cn, cfn := range cc { + t.Run(cn, func(t *testing.T) { + t.Parallel() + + db := prepTempDB(t) + c := cfn(t, db) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + if c.CancelledContext { + cancel() + } + + err := db.InsertSearchJob(ctx, c.Job) + testutil.RequireEqualError(t, c.Err, err) + + if err != nil { + return + } + + testutil.AssertFilterEqual(t, c.Result, fetchSearchJobs(t, db), int64(0)) + }) + } +} + +func Test_agent_FetchSearchJobs(t *testing.T) { + db := prepTempDB(t) + + // error - cancelled context + ctx, cancel := context.WithCancel(context.Background()) + cancel() + + res, err := db.FetchSearchJobs(ctx, 0, 10) + require.Error(t, err) + assert.Nil(t, res) + + // success - no jobs + res, err = db.FetchSearchJobs(context.Background(), 0, 10) + require.NoError(t, err) + assert.Equal(t, []search.Job{}, res) + + // success - limited batch in id order, nullable scopes included + jobs := prepSearchJobs(t, db, 3, func(i int, job *search.Job) { + switch i { + case 1: + job.BranchID = null.Value[xid.ID]{} + case 2: + job.DocumentID = null.Value[xid.ID]{} + job.BranchID = null.Value[xid.ID]{} + } + }) + + res, err = db.FetchSearchJobs(context.Background(), 0, 2) + assert.NoError(t, err) + assert.Equal(t, jobs[:2], res) + + // success - offset skips earlier jobs + res, err = db.FetchSearchJobs(context.Background(), jobs[0].ID, 10) + assert.NoError(t, err) + assert.Equal(t, jobs[1:], res) +} + +func Test_agent_DeleteSearchJob(t *testing.T) { + type tcase struct { + CancelledContext bool + ID int64 + Version int64 + Deleted bool + Err error + } + + cc := map[string]func(*testing.T, *DB) tcase{ + "Cancelled context": func(t *testing.T, db *DB) tcase { + jobs := prepSearchJobs(t, db, 1, nil) + + return tcase{ + CancelledContext: true, + ID: jobs[0].ID, + Version: jobs[0].Version, + Err: assert.AnError, + } + }, + "Newer version keeps the job": func(t *testing.T, db *DB) tcase { + jobs := prepSearchJobs(t, db, 1, func(_ int, job *search.Job) { + job.Version = 2 + }) + + return tcase{ + ID: jobs[0].ID, + Version: 1, + Deleted: false, + } + }, + "Successful delete": func(t *testing.T, db *DB) tcase { + jobs := prepSearchJobs(t, db, 1, nil) + + return tcase{ + ID: jobs[0].ID, + Version: jobs[0].Version, + Deleted: true, + } + }, + } + + for cn, cfn := range cc { + t.Run(cn, func(t *testing.T) { + t.Parallel() + + db := prepTempDB(t) + c := cfn(t, db) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + if c.CancelledContext { + cancel() + } + + err := db.DeleteSearchJob(ctx, c.ID, c.Version) + testutil.RequireEqualError(t, c.Err, err) + + if err != nil { + return + } + + var id int64 + + q, args := db.builder.Select("id"). + From("search_jobs"). + Where(sq.Eq{ + "id": c.ID, + }).MustSql() + + err = db.sql.Get(&id, q, args...) + + if c.Deleted { + testutil.AssertEqualError(t, sql.ErrNoRows, err) + return + } + + require.NoError(t, err) + }) + } +} diff --git a/server/core/internal/document/document.go b/server/core/internal/document/document.go index 83ce8044..bdd98bcc 100644 --- a/server/core/internal/document/document.go +++ b/server/core/internal/document/document.go @@ -10,7 +10,6 @@ import ( "time" "github.com/guregu/null/v5" - "github.com/oxynote/oxynote/server/core/internal/search" "github.com/oxynote/oxynote/server/core/pkg/httpserver" "github.com/oxynote/oxynote/server/core/pkg/strutil" "github.com/oxynote/oxynote/server/core/pkg/timeutil" @@ -299,25 +298,6 @@ func (d Document) HistoryEntry() HistoryEntry { } } -// Search converts the document's branch to search blocks for indexing. -func (d Document) Search() map[string]search.Block { - scope := search.Scope{ - OrganizationID: d.OrganizationID, - DocumentID: d.ID, - BranchID: d.BranchID, - BranchName: d.BranchName, - BranchDefault: d.Default, - } - - res := d.Content.Search(scope) - - // a special block carrying the document name. The map is keyed by the - // document ID, which no content block shares. - res[d.ID.String()] = scope.Block("docname", "document", d.DocumentName) - - return res -} - // HistoryEntry represents one entry in a document's history. type HistoryEntry struct { // ID is the unique identifier for the entry. diff --git a/server/core/internal/document/document_test.go b/server/core/internal/document/document_test.go index 7f525af6..f0b75245 100644 --- a/server/core/internal/document/document_test.go +++ b/server/core/internal/document/document_test.go @@ -5,7 +5,6 @@ import ( "time" "github.com/guregu/null/v5" - "github.com/oxynote/oxynote/server/core/internal/search" "github.com/oxynote/oxynote/server/core/pkg/httpserver" "github.com/rs/xid" "github.com/stretchr/testify/assert" @@ -286,36 +285,6 @@ func Test_Document_HistoryEntry(t *testing.T) { assert.NotEqual(t, entry.ID, other.HistoryEntry().ID) } -func Test_Document_Search(t *testing.T) { - t.Parallel() - - doc := stubDocument() - - res := doc.Search() - - // the content block plus the synthetic document-name block. - require.Len(t, res, 2) - - nameBlock, ok := res[doc.ID.String()] - require.True(t, ok) - assert.Equal(t, search.Block{ - ID: doc.BranchID.String() + "-docname", - OrganizationID: "org-1", - DocumentID: doc.ID, - BranchID: doc.BranchID, - BranchName: DefaultBranch, - BranchDefault: true, - Type: "document", - Text: "Runbook", - }, nameBlock) - - contentBlock, ok := res["p1"] - require.True(t, ok) - assert.Equal(t, doc.BranchID.String()+"-p1", contentBlock.ID) - assert.Equal(t, doc.BranchID, contentBlock.BranchID) - assert.Equal(t, "hello", contentBlock.Text) -} - func Test_Document_Duplicate(t *testing.T) { t.Parallel() diff --git a/server/core/internal/document/node.go b/server/core/internal/document/node.go index 08c480fd..14101156 100644 --- a/server/core/internal/document/node.go +++ b/server/core/internal/document/node.go @@ -5,11 +5,9 @@ import ( "encoding/json" "errors" "fmt" - "maps" "net/url" "strings" - "github.com/oxynote/oxynote/server/core/internal/search" "github.com/oxynote/oxynote/server/core/pkg/strutil" "github.com/rs/xid" ) @@ -77,19 +75,6 @@ func (rb RootBlock) HasBlock(blockID string) bool { return false } -// Search transforms RootBlock into a search compatible type. -func (rb RootBlock) Search(scope search.Scope) map[string]search.Block { - res := make(map[string]search.Block) - - for _, b := range rb.Content { - content := b.Search(scope) - - maps.Insert(res, maps.All(content)) - } - - return res -} - // Value transforms stopper type into a database entry. func (rb RootBlock) Value() (driver.Value, error) { return json.Marshal(rb) @@ -217,48 +202,6 @@ func (b Block) HasBlock(blockID string) bool { return ok } -// Search transforms Block into a search compatible type. -func (b Block) Search(scope search.Scope) map[string]search.Block { - res := make(map[string]search.Block) - - var text strings.Builder - - for _, cb := range b.Content { - // All parent nodes that contain text have a content element - // with the text type. This includes Headings, Paragraphs, - // CodeBlock, CodeBlockTitle, ListItem and so on. - if cb.Type == BlockNodeText { - text.WriteString(cb.Text) - continue - } - - content := cb.Search(scope) - - maps.Insert(res, maps.All(content)) - } - - // a metric block and a file block have no text children; the title - // and the file name are attributes. - switch b.Type { //nolint:exhaustive // the other types index their text children - case BlockNodeMetricBlock: - if title, ok := b.Attrs[AttrTitle].(string); ok { - text.WriteString(title) - } - case BlockNodeFileBlock: - if name, ok := b.Attrs[AttrName].(string); ok { - text.WriteString(name) - } - } - - if text.Len() != 0 { - if id, ok := b.UID(); ok && id != "" { - res[id] = scope.Block(id, string(b.Type), text.String()) - } - } - - return res -} - // Mark represents a mark, such as bold or italic. type Mark struct { // Type is the type of the mark, such as "bold", "italic", etc. diff --git a/server/core/internal/document/node_test.go b/server/core/internal/document/node_test.go index 798f2c9c..744eba23 100644 --- a/server/core/internal/document/node_test.go +++ b/server/core/internal/document/node_test.go @@ -4,7 +4,6 @@ import ( "encoding/json" "testing" - "github.com/oxynote/oxynote/server/core/internal/search" "github.com/rs/xid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -247,99 +246,6 @@ func Test_Block_Flatten(t *testing.T) { } } -func Test_RootBlock_Search(t *testing.T) { - t.Parallel() - - documentID := xid.New() - - rb := RootBlock{ - Type: BlockNodeDoc, - Content: []Block{ - { - Type: BlockNodeParagraph, - Attrs: Attributes{"uid": "p1"}, - Content: []Block{ - {Type: BlockNodeText, Text: "first"}, - }, - }, - { - Type: BlockNodeBulletList, - Attrs: Attributes{"uid": "l1"}, - Content: []Block{ - { - Type: BlockNodeListItem, - Attrs: Attributes{"uid": "li1"}, - Content: []Block{ - {Type: BlockNodeText, Text: "nested"}, - }, - }, - }, - }, - // marks split the text into multiple fragments; all of - // them must be indexed, not just the last one. - { - Type: BlockNodeParagraph, - Attrs: Attributes{"uid": "p2"}, - Content: []Block{ - {Type: BlockNodeText, Text: "plain "}, - {Type: BlockNodeText, Text: "bold", Marks: []Mark{{Type: "bold"}}}, - {Type: BlockNodeText, Text: " tail"}, - }, - }, - // no uid: the text is not indexable. - { - Type: BlockNodeParagraph, - Content: []Block{ - {Type: BlockNodeText, Text: "orphan"}, - }, - }, - // no text: nothing to index. - {Type: BlockNodeHorizontalRule, Attrs: Attributes{"uid": "hr1"}}, - // a metric block's title is an attribute, not a text child. - { - Type: BlockNodeMetricBlock, - Attrs: Attributes{"uid": "m1", "title": "Pizza Fridays"}, - }, - // an untitled metric block has nothing to index. - { - Type: BlockNodeMetricBlock, - Attrs: Attributes{"uid": "m2", "title": ""}, - }, - { - Type: BlockNodeMetricBlock, - Attrs: Attributes{"uid": "m3"}, - }, - // a file block's name is an attribute, not a text child. - { - Type: BlockNodeFileBlock, - Attrs: Attributes{"uid": "f1", "name": "quarterly-report.pdf", "size": 2048}, - }, - // a file block still uploading has no name to index. - { - Type: BlockNodeFileBlock, - Attrs: Attributes{"uid": "f2"}, - }, - }, - } - - scope := search.Scope{ - OrganizationID: "org-1", - DocumentID: documentID, - BranchID: xid.New(), - BranchName: "draft", - } - - res := rb.Search(scope) - - assert.Equal(t, map[string]search.Block{ - "p1": scope.Block("p1", "paragraph", "first"), - "li1": scope.Block("li1", "listItem", "nested"), - "p2": scope.Block("p2", "paragraph", "plain bold tail"), - "m1": scope.Block("m1", "metricBlock", "Pizza Fridays"), - "f1": scope.Block("f1", "fileBlock", "quarterly-report.pdf"), - }, res) -} - func Test_RootBlock_StripCommentMarks(t *testing.T) { t.Parallel() diff --git a/server/core/internal/search/client.go b/server/core/internal/search/client.go deleted file mode 100644 index a92457f4..00000000 --- a/server/core/internal/search/client.go +++ /dev/null @@ -1,399 +0,0 @@ -// Package search indexes and searches documents through Meilisearch. -package search - -import ( - "context" - _ "embed" - "encoding/json" - "errors" - "fmt" - "maps" - "net/http" - "slices" - "strconv" - "strings" - "time" - - "github.com/meilisearch/meilisearch-go" - "github.com/oxynote/oxynote/server/core/pkg/errutil" -) - -//go:embed static/synonyms.json -var synonymsFile []byte - -// ErrNotConfigured is returned when search is not configured on this -// deployment. -var ErrNotConfigured = errutil.New(http.StatusConflict, "search.not_configured", "search is not configured") - -// _documentsIndex is the name of the documents index. -const _documentsIndex = "documents" - -// _textAttribute is the indexed block attribute searched, cropped, and -// highlighted. -const _textAttribute = "text" - -const ( - // _searchCropLength is the number of words kept around a match in - // cropped search results. - _searchCropLength = 5 - - // _searchResultLimit caps the number of search hits returned. - _searchResultLimit = 20 - - // _taskPollInterval is how often an asynchronous Meilisearch task is - // polled while waiting for it to settle. - _taskPollInterval = 50 * time.Millisecond - - // _setupTimeout bounds the index setup at boot. - _setupTimeout = time.Minute - - // _writeTimeout bounds one batch of index writes, task waits included. - _writeTimeout = 2 * time.Minute - - // _searchTimeout bounds one search request. - _searchTimeout = 10 * time.Second -) - -// _displayedAttributes are the entry fields search hits carry. -var _displayedAttributes = []string{ - "id", - "organizationId", - "documentId", - "branchId", - "branchName", - "branchDefault", - "type", - _textAttribute, -} - -// _filterableAttributes are the entry fields searches and removals filter -// by. -var _filterableAttributes = []string{ - "organizationId", - "documentId", - "branchId", -} - -// Client is a Meilisearch client wrapper. -type Client struct { - meiliMan meilisearch.ServiceManager -} - -// NewClient creates a new Meilisearch client wrapper. A nil meiliMan means -// search is not configured on this deployment: the client is returned -// without touching Meilisearch and every call on it reports -// ErrNotConfigured. -func NewClient( - ctx context.Context, - meiliMan meilisearch.ServiceManager, -) (*Client, error) { - c := &Client{ - meiliMan: meiliMan, - } - - if !c.Configured() { - return c, nil - } - - if err := c.ensureIndex(ctx); err != nil { - return nil, fmt.Errorf("ensuring documents index: %w", err) - } - - return c, nil -} - -// Configured reports whether search is configured on this deployment. -func (c *Client) Configured() bool { - return c.meiliMan != nil -} - -// ensureIndex ensures the documents index exists and runs with the -// declared settings. -func (c *Client) ensureIndex(ctx context.Context) error { - ctx, cancel := context.WithTimeout(ctx, _setupTimeout) - defer cancel() - - _, err := c.meiliMan.GetIndexWithContext(ctx, _documentsIndex) - - switch merr, ok := errors.AsType[*meilisearch.Error](err); { - case err == nil: - // the index is already there. - case ok && merr.MeilisearchApiError.Code == "index_not_found": - task, cerr := c.meiliMan.CreateIndexWithContext(ctx, &meilisearch.IndexConfig{ - Uid: _documentsIndex, - PrimaryKey: "id", - }) - if cerr != nil { - return fmt.Errorf("creating documents index: %w", cerr) - } - - if cerr = c.awaitTask(ctx, task); cerr != nil { - return fmt.Errorf("creating documents index: %w", cerr) - } - default: - return fmt.Errorf("getting documents index: %w", err) - } - - // the settings are checked on every boot rather than only when the - // index is created: an index whose settings task failed would otherwise - // stay broken for good, and new synonyms would never reach an existing - // deployment. They are sent only when they differ, since a searchable - // or filterable attribute change re-indexes every entry. - want, err := indexSettings() - if err != nil { - return err - } - - have, err := c.meiliMan.Index(_documentsIndex).GetSettingsWithContext(ctx) - if err != nil { - return fmt.Errorf("getting settings: %w", err) - } - - if settingsMatch(have, want) { - return nil - } - - task, err := c.meiliMan.Index(_documentsIndex).UpdateSettingsWithContext(ctx, want) - if err != nil { - return fmt.Errorf("updating settings: %w", err) - } - - if err = c.awaitTask(ctx, task); err != nil { - return fmt.Errorf("updating settings: %w", err) - } - - return nil -} - -// indexSettings returns the settings the documents index runs with. Only -// the fields it sets are sent; everything else keeps Meilisearch's default. -func indexSettings() (*meilisearch.Settings, error) { - var synonyms map[string][]string - - if err := json.Unmarshal(synonymsFile, &synonyms); err != nil { - return nil, fmt.Errorf("unmarshaling synonyms: %w", err) - } - - return &meilisearch.Settings{ - SearchableAttributes: []string{_textAttribute}, - DisplayedAttributes: _displayedAttributes, - FilterableAttributes: _filterableAttributes, - Synonyms: synonyms, - }, nil -} - -// settingsMatch reports whether the index already runs with every field -// want sets. Attribute lists are compared as sets, since Meilisearch does -// not promise their order back. -func settingsMatch(have, want *meilisearch.Settings) bool { - sameSet := func(a, b []string) bool { - a, b = slices.Sorted(slices.Values(a)), slices.Sorted(slices.Values(b)) - - return slices.Equal(a, b) - } - - return sameSet(have.SearchableAttributes, want.SearchableAttributes) && - sameSet(have.DisplayedAttributes, want.DisplayedAttributes) && - sameSet(have.FilterableAttributes, want.FilterableAttributes) && - maps.EqualFunc(have.Synonyms, want.Synonyms, sameSet) -} - -// awaitTask blocks until an asynchronous Meilisearch task settles and reports -// a rejected task as an error, so a failed index or settings update surfaces -// at boot instead of leaving the index quietly misconfigured. -func (c *Client) awaitTask(ctx context.Context, info *meilisearch.TaskInfo) error { - task, err := c.meiliMan.WaitForTaskWithContext(ctx, info.TaskUID, _taskPollInterval) - if err != nil { - return fmt.Errorf("waiting for task %d: %w", info.TaskUID, err) - } - - if task.Status != meilisearch.TaskStatusSucceeded { - return fmt.Errorf( - "task %d finished with status %q: %s (%s)", - info.TaskUID, - task.Status, - task.Error.Message, - task.Error.Code, - ) - } - - return nil -} - -// settle reports the outcome of one index write: the request error when the -// call itself failed, otherwise the task's result once Meilisearch has -// applied it. -func (c *Client) settle(ctx context.Context, what string, task *meilisearch.TaskInfo, err error) error { - if err != nil { - return fmt.Errorf("%s: %w", what, err) - } - - if err := c.awaitTask(ctx, task); err != nil { - return fmt.Errorf("%s: %w", what, err) - } - - return nil -} - -// SearchDocuments searches documents in the index. -func (c *Client) SearchDocuments(ctx context.Context, organizationID, query string) ([]byte, error) { - if !c.Configured() { - return nil, ErrNotConfigured - } - - ctx, cancel := context.WithTimeout(ctx, _searchTimeout) - defer cancel() - - res, err := c.meiliMan.Index(_documentsIndex).SearchWithContext(ctx, query, &meilisearch.SearchRequest{ - AttributesToSearchOn: []string{_textAttribute}, - AttributesToCrop: []string{_textAttribute}, - AttributesToHighlight: []string{_textAttribute}, - Filter: fmt.Sprintf("organizationId = %q", organizationID), - HighlightPreTag: "", - HighlightPostTag: "", - CropLength: _searchCropLength, - Limit: _searchResultLimit, - }) - if err != nil { - return nil, fmt.Errorf("searching documents: %w", err) - } - - hits := make([]json.RawMessage, 0, len(res.Hits)) - - for _, hit := range res.Hits { - hits = append( - hits, - hit["_formatted"], - ) - } - - data, err := json.Marshal(hits) - if err != nil { - return nil, fmt.Errorf("marshaling search results: %w", err) - } - - return data, nil -} - -// SearchDocumentBlocks returns the raw matching blocks for the -// query, scoped to the organization. Unlike SearchDocuments it -// returns plain block values (no highlight markup or cropping) so -// callers — the AI assistant's search tool — can consume the text -// directly. -func (c *Client) SearchDocumentBlocks(ctx context.Context, organizationID, query string, limit int) ([]Block, error) { - if !c.Configured() { - return nil, ErrNotConfigured - } - - ctx, cancel := context.WithTimeout(ctx, _searchTimeout) - defer cancel() - - res, err := c.meiliMan.Index(_documentsIndex).SearchWithContext(ctx, query, &meilisearch.SearchRequest{ - AttributesToSearchOn: []string{_textAttribute}, - Filter: fmt.Sprintf("organizationId = %q", organizationID), - Limit: int64(limit), - }) - if err != nil { - return nil, fmt.Errorf("searching document blocks: %w", err) - } - - blocks := make([]Block, 0, len(res.Hits)) - - for _, hit := range res.Hits { - var b Block - - if err := hit.DecodeInto(&b); err != nil { - return nil, fmt.Errorf("decoding search hit: %w", err) - } - - blocks = append(blocks, b) - } - - return blocks, nil -} - -// ReplaceDocumentBlocks replaces document blocks in the index based on the -// provided differences. Every write is awaited, so a batch Meilisearch -// rejects is reported rather than silently dropped. -func (c *Client) ReplaceDocumentBlocks(ctx context.Context, bd BlocksDifference) error { - if !c.Configured() { - return ErrNotConfigured - } - - ctx, cancel := context.WithTimeout(ctx, _writeTimeout) - defer cancel() - - idx := c.meiliMan.Index(_documentsIndex) - - // every entry is complete, so added and updated ones alike are sent as - // one add-or-replace request. - if docs := slices.Concat(bd.Added, bd.Updated); len(docs) != 0 { - task, err := idx.AddDocumentsWithContext(ctx, docs, nil) - - if err = c.settle(ctx, "adding documents", task, err); err != nil { - return err - } - } - - if len(bd.Removed) != 0 { - ids := make([]string, 0, len(bd.Removed)) - - for _, block := range bd.Removed { - ids = append(ids, block.ID) - } - - task, err := idx.DeleteDocumentsWithContext(ctx, ids, nil) - - if err = c.settle(ctx, "deleting documents", task, err); err != nil { - return err - } - } - - if len(bd.RemovedBranches) != 0 { - ids := make([]string, 0, len(bd.RemovedBranches)) - - for _, br := range bd.RemovedBranches { - ids = append(ids, br.BranchID.String()) - } - - if err := c.deleteByFilter(ctx, idx, "branchId", ids); err != nil { - return fmt.Errorf("deleting branches by filter: %w", err) - } - } - - if len(bd.RemovedDocuments) != 0 { - ids := make([]string, 0, len(bd.RemovedDocuments)) - - for _, id := range bd.RemovedDocuments { - ids = append(ids, id.String()) - } - - if err := c.deleteByFilter(ctx, idx, "documentId", ids); err != nil { - return fmt.Errorf("deleting documents by filter: %w", err) - } - } - - if len(bd.RemovedOrganizations) != 0 { - if err := c.deleteByFilter(ctx, idx, "organizationId", bd.RemovedOrganizations); err != nil { - return fmt.Errorf("deleting organizations by filter: %w", err) - } - } - - return nil -} - -// deleteByFilter removes every entry whose field is one of the ids and -// waits for the removal to apply. -func (c *Client) deleteByFilter(ctx context.Context, idx meilisearch.IndexManager, field string, ids []string) error { - quoted := make([]string, 0, len(ids)) - - for _, id := range ids { - quoted = append(quoted, strconv.Quote(id)) - } - - filter := fmt.Sprintf("%s IN [%s]", field, strings.Join(quoted, ", ")) - - task, err := idx.DeleteDocumentsByFilterWithContext(ctx, filter, nil) - - return c.settle(ctx, "deleting by "+field, task, err) -} diff --git a/server/core/internal/search/client_test.go b/server/core/internal/search/client_test.go deleted file mode 100644 index b0464148..00000000 --- a/server/core/internal/search/client_test.go +++ /dev/null @@ -1,606 +0,0 @@ -package search - -import ( - "context" - "encoding/json" - "fmt" - "slices" - "testing" - "time" - - "github.com/meilisearch/meilisearch-go" - mock "github.com/oxynote/oxynote/server/core/internal/_mock" - "github.com/rs/xid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -// indexNotFoundErr builds the meilisearch error ensureIndex treats as a -// missing index. -func indexNotFoundErr() *meilisearch.Error { - merr := &meilisearch.Error{} - merr.MeilisearchApiError.Code = "index_not_found" - - return merr -} - -// stubManagers wires a service-manager mock whose Index method returns the -// given index-manager mock. -func stubManagers(idx *mock.MeiliIndexManager) *mock.MeiliServiceManager { - return &mock.MeiliServiceManager{ - IndexFunc: func(string) meilisearch.IndexManager { - return idx - }, - } -} - -func Test_NewClient(t *testing.T) { - t.Parallel() - - // a nil service manager is the disabled mode: nothing is set up and - // every call refuses with the sentinel. - t.Run("Unconfigured client", func(t *testing.T) { - t.Parallel() - - c, err := NewClient(context.Background(), nil) - require.NoError(t, err) - require.NotNil(t, c) - assert.False(t, c.Configured()) - - data, serr := c.SearchDocuments(context.Background(), "org1", "query") - assert.ErrorIs(t, serr, ErrNotConfigured) - assert.Nil(t, data) - - blocks, serr := c.SearchDocumentBlocks(context.Background(), "org1", "query", 5) - assert.ErrorIs(t, serr, ErrNotConfigured) - assert.Nil(t, blocks) - - assert.ErrorIs(t, c.ReplaceDocumentBlocks(context.Background(), BlocksDifference{}), ErrNotConfigured) - }) - - type check func(*testing.T, *mock.MeiliServiceManager, *mock.MeiliIndexManager, error) - - checks := func(cc ...check) []check { return cc } - - hasError := func(expect bool) check { - return func(t *testing.T, _ *mock.MeiliServiceManager, _ *mock.MeiliIndexManager, err error) { - if expect { - require.Error(t, err) - return - } - - require.NoError(t, err) - } - } - - wasCreateIndexCalled := func(count int) check { - return func(t *testing.T, svc *mock.MeiliServiceManager, _ *mock.MeiliIndexManager, _ error) { - ff := svc.CreateIndexWithContextCalls() - require.Len(t, ff, count) - - if count == 0 { - return - } - - assert.Equal(t, "documents", ff[0].Config.Uid) - assert.Equal(t, "id", ff[0].Config.PrimaryKey) - } - } - - wasSettingsUpdated := func(count int) check { - return func(t *testing.T, _ *mock.MeiliServiceManager, idx *mock.MeiliIndexManager, _ error) { - ff := idx.UpdateSettingsWithContextCalls() - require.Len(t, ff, count) - - if count == 0 { - return - } - - assert.Equal(t, []string{"text"}, ff[0].Request.SearchableAttributes) - assert.Equal(t, _displayedAttributes, ff[0].Request.DisplayedAttributes) - assert.Equal(t, _filterableAttributes, ff[0].Request.FilterableAttributes) - assert.NotEmpty(t, ff[0].Request.Synonyms) - } - } - - // current is what a settled index reports: the declared settings, with - // the attribute lists in an order of Meilisearch's choosing. - current := func() *meilisearch.Settings { - want, err := indexSettings() - require.NoError(t, err) - - have := *want - have.DisplayedAttributes = slices.Clone(want.DisplayedAttributes) - slices.Reverse(have.DisplayedAttributes) - - return &have - } - - // fresh is what a just-created index reports. - fresh := func() *meilisearch.Settings { - return &meilisearch.Settings{ - SearchableAttributes: []string{"*"}, - DisplayedAttributes: []string{"*"}, - } - } - - tests := map[string]struct { - GetIndexErr error - CreateErr error - Settings *meilisearch.Settings - GetSettingsErr error - SettingsErr error - WaitErr error - TaskStatus meilisearch.TaskStatus - Checks []check - }{ - "Existing index with the declared settings is left alone": { - Settings: current(), - Checks: checks( - hasError(false), - wasCreateIndexCalled(0), - wasSettingsUpdated(0), - ), - }, - "Existing index with stale settings gets them updated": { - Settings: func() *meilisearch.Settings { - st := current() - st.FilterableAttributes = []string{"organizationId", "documentId"} - - return st - }(), - Checks: checks( - hasError(false), - wasCreateIndexCalled(0), - wasSettingsUpdated(1), - ), - }, - "Existing index with stale synonyms gets them updated": { - Settings: func() *meilisearch.Settings { - st := current() - st.Synonyms = map[string][]string{"2fa": {"mfa"}} - - return st - }(), - Checks: checks( - hasError(false), - wasSettingsUpdated(1), - ), - }, - "Settings fetch failure fails": { - GetSettingsErr: assert.AnError, - Checks: checks( - hasError(true), - wasSettingsUpdated(0), - ), - }, - "Rejected settings task fails": { - Settings: fresh(), - TaskStatus: meilisearch.TaskStatusFailed, - Checks: checks( - hasError(true), - wasCreateIndexCalled(0), - wasSettingsUpdated(1), - ), - }, - "Task wait failure fails": { - Settings: fresh(), - WaitErr: assert.AnError, - Checks: checks( - hasError(true), - ), - }, - "Missing index is created with settings": { - GetIndexErr: indexNotFoundErr(), - Settings: fresh(), - Checks: checks( - hasError(false), - wasCreateIndexCalled(1), - wasSettingsUpdated(1), - ), - }, - "Other meilisearch errors fail": { - GetIndexErr: &meilisearch.Error{}, - Checks: checks( - hasError(true), - wasCreateIndexCalled(0), - ), - }, - "Non-meilisearch errors fail": { - GetIndexErr: assert.AnError, - Checks: checks( - hasError(true), - wasCreateIndexCalled(0), - ), - }, - "Index creation failure fails": { - GetIndexErr: indexNotFoundErr(), - CreateErr: assert.AnError, - Checks: checks( - hasError(true), - wasSettingsUpdated(0), - ), - }, - "Settings update failure fails": { - GetIndexErr: indexNotFoundErr(), - Settings: fresh(), - SettingsErr: assert.AnError, - Checks: checks( - hasError(true), - wasSettingsUpdated(1), - ), - }, - } - - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - t.Parallel() - - idx := &mock.MeiliIndexManager{ - GetSettingsWithContextFunc: func(context.Context) (*meilisearch.Settings, error) { - return tc.Settings, tc.GetSettingsErr - }, - UpdateSettingsWithContextFunc: func(context.Context, *meilisearch.Settings) (*meilisearch.TaskInfo, error) { - return &meilisearch.TaskInfo{TaskUID: 2}, tc.SettingsErr - }, - } - - svc := stubManagers(idx) - svc.GetIndexWithContextFunc = func(context.Context, string) (*meilisearch.IndexResult, error) { - return nil, tc.GetIndexErr - } - svc.CreateIndexWithContextFunc = func(context.Context, *meilisearch.IndexConfig) (*meilisearch.TaskInfo, error) { - return &meilisearch.TaskInfo{TaskUID: 1}, tc.CreateErr - } - svc.WaitForTaskWithContextFunc = func(context.Context, int64, time.Duration) (*meilisearch.Task, error) { - status := meilisearch.TaskStatusSucceeded - if tc.TaskStatus != "" { - status = tc.TaskStatus - } - - return &meilisearch.Task{Status: status}, tc.WaitErr - } - - client, err := NewClient(context.Background(), svc) - - for _, ch := range tc.Checks { - ch(t, svc, idx, err) - } - - if err == nil { - assert.NotNil(t, client) - } - }) - } -} - -// newTestClient builds a Client wired straight to the given index mock, -// bypassing ensureIndex. Every task the index reports settles with the -// given status. -func newTestClient(idx *mock.MeiliIndexManager, status meilisearch.TaskStatus) *Client { - svc := stubManagers(idx) - svc.WaitForTaskWithContextFunc = func(context.Context, int64, time.Duration) (*meilisearch.Task, error) { - task := &meilisearch.Task{Status: status} - task.Error.Message = "boom" - task.Error.Code = "invalid_document_id" - - return task, nil - } - - return &Client{meiliMan: svc} -} - -func Test_Client_SearchDocuments(t *testing.T) { - t.Parallel() - - t.Run("Formatted hits are returned as JSON", func(t *testing.T) { - t.Parallel() - - var captured *meilisearch.SearchRequest - - idx := &mock.MeiliIndexManager{ - SearchWithContextFunc: func(_ context.Context, _ string, request *meilisearch.SearchRequest) (*meilisearch.SearchResponse, error) { - captured = request - - return &meilisearch.SearchResponse{ - Hits: meilisearch.Hits{ - {"_formatted": json.RawMessage(`{"id": "b1", "text": "hello"}`)}, - }, - }, nil - }, - } - - data, err := newTestClient(idx, meilisearch.TaskStatusSucceeded).SearchDocuments(context.Background(), "org-1", "hello") - require.NoError(t, err) - - assert.JSONEq(t, `[{"id": "b1", "text": "hello"}]`, string(data)) - - require.NotNil(t, captured) - assert.Equal(t, `organizationId = "org-1"`, captured.Filter) - assert.Equal(t, []string{"text"}, captured.AttributesToSearchOn) - assert.Equal(t, int64(5), captured.CropLength) - assert.Equal(t, int64(20), captured.Limit) - assert.Equal(t, "", captured.HighlightPreTag) - }) - - t.Run("Search failure is propagated", func(t *testing.T) { - t.Parallel() - - idx := &mock.MeiliIndexManager{ - SearchWithContextFunc: func(context.Context, string, *meilisearch.SearchRequest) (*meilisearch.SearchResponse, error) { - return nil, assert.AnError - }, - } - - _, err := newTestClient(idx, meilisearch.TaskStatusSucceeded).SearchDocuments(context.Background(), "org-1", "hello") - require.Error(t, err) - }) -} - -func Test_Client_SearchDocumentBlocks(t *testing.T) { - t.Parallel() - - documentID := xid.New() - - t.Run("Hits are decoded into blocks", func(t *testing.T) { - t.Parallel() - - var captured *meilisearch.SearchRequest - - idx := &mock.MeiliIndexManager{ - SearchWithContextFunc: func(_ context.Context, _ string, request *meilisearch.SearchRequest) (*meilisearch.SearchResponse, error) { - captured = request - - return &meilisearch.SearchResponse{ - Hits: meilisearch.Hits{ - { - "id": json.RawMessage(`"b1"`), - "organizationId": json.RawMessage(`"org-1"`), - "documentId": json.RawMessage(`"` + documentID.String() + `"`), - "type": json.RawMessage(`"paragraph"`), - "text": json.RawMessage(`"hello"`), - }, - }, - }, nil - }, - } - - blocks, err := newTestClient(idx, meilisearch.TaskStatusSucceeded).SearchDocumentBlocks(context.Background(), "org-1", "hello", 7) - require.NoError(t, err) - - assert.Equal(t, []Block{{ - ID: "b1", - OrganizationID: "org-1", - DocumentID: documentID, - Type: "paragraph", - Text: "hello", - }}, blocks) - - require.NotNil(t, captured) - assert.Equal(t, `organizationId = "org-1"`, captured.Filter) - assert.Equal(t, int64(7), captured.Limit) - }) - - t.Run("Undecodable hit fails", func(t *testing.T) { - t.Parallel() - - idx := &mock.MeiliIndexManager{ - SearchWithContextFunc: func(context.Context, string, *meilisearch.SearchRequest) (*meilisearch.SearchResponse, error) { - return &meilisearch.SearchResponse{ - Hits: meilisearch.Hits{ - {"id": json.RawMessage(`42`)}, - }, - }, nil - }, - } - - _, err := newTestClient(idx, meilisearch.TaskStatusSucceeded).SearchDocumentBlocks(context.Background(), "org-1", "hello", 7) - require.Error(t, err) - }) - - t.Run("Search failure is propagated", func(t *testing.T) { - t.Parallel() - - idx := &mock.MeiliIndexManager{ - SearchWithContextFunc: func(context.Context, string, *meilisearch.SearchRequest) (*meilisearch.SearchResponse, error) { - return nil, assert.AnError - }, - } - - _, err := newTestClient(idx, meilisearch.TaskStatusSucceeded).SearchDocumentBlocks(context.Background(), "org-1", "hello", 7) - require.Error(t, err) - }) -} - -func Test_Client_ReplaceDocumentBlocks(t *testing.T) { - t.Parallel() - - type check func(*testing.T, *mock.MeiliIndexManager, error) - - checks := func(cc ...check) []check { return cc } - - hasError := func(expect bool) check { - return func(t *testing.T, _ *mock.MeiliIndexManager, err error) { - if expect { - require.Error(t, err) - return - } - - require.NoError(t, err) - } - } - - wasAddCalled := func(count int) check { - return func(t *testing.T, idx *mock.MeiliIndexManager, _ error) { - require.Len(t, idx.AddDocumentsWithContextCalls(), count) - } - } - - wasDeleteCalled := func(count int) check { - return func(t *testing.T, idx *mock.MeiliIndexManager, _ error) { - require.Len(t, idx.DeleteDocumentsWithContextCalls(), count) - } - } - - wasDeleteByFilterCalled := func(count int) check { - return func(t *testing.T, idx *mock.MeiliIndexManager, _ error) { - require.Len(t, idx.DeleteDocumentsByFilterWithContextCalls(), count) - } - } - - hasFilter := func(filter string) check { - return func(t *testing.T, idx *mock.MeiliIndexManager, _ error) { - ff := idx.DeleteDocumentsByFilterWithContextCalls() - require.NotEmpty(t, ff) - assert.Equal(t, filter, ff[0].Filter) - } - } - - docID1, docID2 := xid.New(), xid.New() - branchID1, branchID2 := xid.New(), xid.New() - - fullDiff := BlocksDifference{ - Added: []Block{{ID: "a"}}, - Updated: []Block{{ID: "u"}}, - Removed: []Block{{ID: "r1"}, {ID: "r2"}}, - } - - tests := map[string]struct { - Diff BlocksDifference - TaskStatus meilisearch.TaskStatus - AddErr error - DeleteErr error - DeleteFilterErr error - Checks []check - }{ - "Empty difference makes no calls": { - Checks: checks( - hasError(false), - wasAddCalled(0), - wasDeleteCalled(0), - wasDeleteByFilterCalled(0), - ), - }, - "Removed branches are cleared by filter": { - Diff: BlocksDifference{RemovedBranches: []BranchRemoval{ - {DocumentID: docID1, BranchID: branchID1}, - {DocumentID: docID1, BranchID: branchID2}, - }}, - Checks: checks( - hasError(false), - wasDeleteCalled(0), - wasDeleteByFilterCalled(1), - hasFilter(fmt.Sprintf("branchId IN [%q, %q]", branchID1, branchID2)), - ), - }, - "Removed documents are cleared by filter": { - Diff: BlocksDifference{RemovedDocuments: []xid.ID{docID1, docID2}}, - Checks: checks( - hasError(false), - wasDeleteCalled(0), - wasDeleteByFilterCalled(1), - hasFilter(fmt.Sprintf("documentId IN [%q, %q]", docID1, docID2)), - ), - }, - "Removed organizations are cleared by filter": { - Diff: BlocksDifference{RemovedOrganizations: []string{"org-1", "org-2"}}, - Checks: checks( - hasError(false), - wasDeleteCalled(0), - wasDeleteByFilterCalled(1), - hasFilter(`organizationId IN ["org-1", "org-2"]`), - ), - }, - "Delete by filter failure is propagated": { - Diff: BlocksDifference{RemovedDocuments: []xid.ID{docID1}}, - DeleteFilterErr: assert.AnError, - Checks: checks( - hasError(true), - wasDeleteByFilterCalled(1), - ), - }, - // added and updated entries are complete either way, so one - // add-or-replace request carries both. - "Full difference sends one add and one delete": { - Diff: fullDiff, - Checks: checks( - hasError(false), - wasAddCalled(1), - wasDeleteCalled(1), - func(t *testing.T, idx *mock.MeiliIndexManager, _ error) { - assert.Equal(t, []Block{{ID: "a"}, {ID: "u"}}, idx.AddDocumentsWithContextCalls()[0].DocumentsPtr) - assert.Equal(t, []string{"r1", "r2"}, idx.DeleteDocumentsWithContextCalls()[0].Identifiers) - }, - ), - }, - "Add failure short-circuits": { - Diff: fullDiff, - AddErr: assert.AnError, - Checks: checks( - hasError(true), - wasDeleteCalled(0), - ), - }, - "Delete failure is propagated": { - Diff: fullDiff, - DeleteErr: assert.AnError, - Checks: checks( - hasError(true), - wasAddCalled(1), - ), - }, - // the request is accepted but the task fails later; the batch is - // reported so the job is retried rather than dropped. - "Failed task is reported with its cause": { - Diff: fullDiff, - TaskStatus: meilisearch.TaskStatusFailed, - Checks: checks( - hasError(true), - wasAddCalled(1), - wasDeleteCalled(0), - func(t *testing.T, _ *mock.MeiliIndexManager, err error) { - assert.ErrorContains(t, err, "boom (invalid_document_id)") - }, - ), - }, - "Calls run under a deadline": { - Diff: fullDiff, - Checks: checks( - hasError(false), - func(t *testing.T, idx *mock.MeiliIndexManager, _ error) { - _, ok := idx.AddDocumentsWithContextCalls()[0].Ctx.Deadline() - assert.True(t, ok) - }, - ), - }, - } - - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - t.Parallel() - - idx := &mock.MeiliIndexManager{ - AddDocumentsWithContextFunc: func(context.Context, any, *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - return &meilisearch.TaskInfo{TaskUID: 1}, tc.AddErr - }, - DeleteDocumentsWithContextFunc: func(context.Context, []string, *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - return &meilisearch.TaskInfo{TaskUID: 2}, tc.DeleteErr - }, - DeleteDocumentsByFilterWithContextFunc: func(context.Context, any, *meilisearch.DocumentOptions) (*meilisearch.TaskInfo, error) { - return &meilisearch.TaskInfo{TaskUID: 3}, tc.DeleteFilterErr - }, - } - - status := meilisearch.TaskStatusSucceeded - if tc.TaskStatus != "" { - status = tc.TaskStatus - } - - err := newTestClient(idx, status).ReplaceDocumentBlocks(context.Background(), tc.Diff) - - for _, ch := range tc.Checks { - ch(t, idx, err) - } - }) - } -} diff --git a/server/core/internal/search/document.go b/server/core/internal/search/document.go index a3941832..61715f2b 100644 --- a/server/core/internal/search/document.go +++ b/server/core/internal/search/document.go @@ -1,13 +1,16 @@ package search import ( - "database/sql/driver" - "encoding/json" - "fmt" + "strings" + "github.com/oxynote/oxynote/server/core/internal/document" "github.com/rs/xid" ) +// _documentNameUID is the uid of the synthetic entry carrying a branch's +// document name. Content blocks never use it. +const _documentNameUID = "docname" + // Block represents a information block. It can be a paragraph, heading, or // any other type of content in a document. type Block struct { @@ -37,6 +40,45 @@ type Block struct { Text string `json:"text"` } +// record is the shape a block is written to the index in. bleve walks +// struct fields by reflection and would take an xid's byte array for a +// list of numbers, so the ids are flattened to strings first. +type record struct { + // OrganizationID specifies the organization the block belongs to. + OrganizationID string `json:"organizationId"` + + // DocumentID specifies the document the block belongs to. + DocumentID string `json:"documentId"` + + // BranchID specifies the branch the block belongs to. + BranchID string `json:"branchId"` + + // BranchName specifies the name of the branch, kept for display only. + BranchName string `json:"branchName"` + + // BranchDefault indicates whether the branch is the document's default. + BranchDefault bool `json:"branchDefault"` + + // Type specifies the block type (e.g., "paragraph", "heading"). + Type string `json:"type"` + + // Text specifies the searchable text of the block. + Text string `json:"text"` +} + +// record flattens the block for indexing. +func (b Block) record() record { + return record{ + OrganizationID: b.OrganizationID, + DocumentID: b.DocumentID.String(), + BranchID: b.BranchID.String(), + BranchName: b.BranchName, + BranchDefault: b.BranchDefault, + Type: b.Type, + Text: b.Text, + } +} + // Scope is the branch every block of one indexing pass belongs to. type Scope struct { // OrganizationID is the organization owning the document. @@ -71,93 +113,68 @@ func (s Scope) Block(uid, typ, text string) Block { } } -// BranchRemoval names a branch whose every block is removed. The document -// id is carried so the removal is ordered with the document's other jobs. -type BranchRemoval struct { - // DocumentID is the document the branch belonged to. - DocumentID xid.ID `json:"documentId"` +// entries collects the index entries of the block and its descendants +// into res, keyed by block uid. +func (s Scope) entries(b document.Block, res map[string]Block) { + var text strings.Builder - // BranchID is the removed branch. - BranchID xid.ID `json:"branchId"` -} - -// BlocksDifference represents the differences between two slices of Blocks. -type BlocksDifference struct { - // Updated contains blocks that have been modified. - Updated []Block `json:"updated"` - - // Added contains blocks that have been added. - Added []Block `json:"added"` - - // Removed contains blocks that have been removed. - Removed []Block `json:"removed"` - - // RemovedBranches contains branches whose every block is removed. - // Deleting a branch drops its content row, so the index is cleared by - // branch instead of by block. - RemovedBranches []BranchRemoval `json:"removedBranches"` - - // RemovedDocuments contains documents whose every block is removed. - // Deleting a document cascades to its descendants in the database, - // which makes enumerating their blocks impossible after the fact, so - // the index is cleared by document instead. - RemovedDocuments []xid.ID `json:"removedDocuments"` - - // RemovedOrganizations contains organizations whose every block is - // removed. Organizations are deleted outside of core, so this is the - // only handle left on the content that went with them. - RemovedOrganizations []string `json:"removedOrganizations"` -} - -// BlocksDiff compares two slices of Blocks and returns the differences -// as a BlocksDifference struct. -func BlocksDiff(a, b map[string]Block) BlocksDifference { - var diff BlocksDifference - - // Check for added and updated blocks. - for id, blockB := range b { - blockA, exists := a[id] - if !exists { - diff.Added = append(diff.Added, blockB) - } else if blockA != blockB { - diff.Updated = append(diff.Updated, blockB) + for _, cb := range b.Content { + // every parent node holding text has a child of the text type, + // headings, paragraphs, code blocks and list items included. + if cb.Type == document.BlockNodeText { + text.WriteString(cb.Text) + continue } + + s.entries(cb, res) } - // Check for removed blocks. - for id, blockA := range a { - if _, exists := b[id]; !exists { - diff.Removed = append(diff.Removed, blockA) + // a metric, file or image block has no text children; what describes + // it sits in its attributes. + switch b.Type { //nolint:exhaustive // the other types index their text children + case document.BlockNodeMetricBlock: + if title, ok := b.Attrs[document.AttrTitle].(string); ok { + text.WriteString(title) } + case document.BlockNodeFileBlock: + if name, ok := b.Attrs[document.AttrName].(string); ok { + text.WriteString(name) + } + case document.BlockNodeImageBlock: + alt, _ := b.Attrs[document.AttrAlt].(string) + title, _ := b.Attrs[document.AttrTitle].(string) + + text.WriteString(strings.TrimSpace(alt + " " + title)) } - return diff -} - -// Scan implements the sql.Scanner interface for BlocksDifference. -func (bd *BlocksDifference) Scan(value any) error { - if value == nil { - return nil + if text.Len() == 0 { + return } - bytes, ok := value.([]byte) - if !ok { - return fmt.Errorf("failed to scan BlocksDifference: expected []byte, got %T", value) + if id, ok := b.UID(); ok && id != "" { + res[id] = s.Block(id, string(b.Type), text.String()) + } +} + +// Entries converts a document branch into its index entries, keyed by +// block uid. A synthetic entry carries the document name; its key is the +// document id, which no content block shares. +func Entries(doc document.Document) map[string]Block { + scope := Scope{ + OrganizationID: doc.OrganizationID, + DocumentID: doc.ID, + BranchID: doc.BranchID, + BranchName: doc.BranchName, + BranchDefault: doc.Default, } - return json.Unmarshal(bytes, bd) -} + res := make(map[string]Block) -// Value implements the driver.Valuer interface for BlocksDifference. -func (bd BlocksDifference) Value() (driver.Value, error) { - return json.Marshal(bd) -} + for _, b := range doc.Content.Content { + scope.entries(b, res) + } -// DocumentSearchJob represents a search index update job. -type DocumentSearchJob struct { - // ID is the unique identifier for the search job. - ID int64 `db:"id"` + res[doc.ID.String()] = scope.Block(_documentNameUID, "document", doc.DocumentName) - // BlockDiff contains the differences in blocks for the document. - BlockDiff BlocksDifference `db:"block_diff"` + return res } diff --git a/server/core/internal/search/document_test.go b/server/core/internal/search/document_test.go index 5d5e5f8c..d20b53c7 100644 --- a/server/core/internal/search/document_test.go +++ b/server/core/internal/search/document_test.go @@ -1,96 +1,29 @@ package search import ( - "encoding/json" "testing" + "github.com/oxynote/oxynote/server/core/internal/document" "github.com/rs/xid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -func Test_BlocksDiff(t *testing.T) { - t.Parallel() - - // empty inputs - empty := BlocksDiff(nil, nil) - - assert.Empty(t, empty.Added) - assert.Empty(t, empty.Updated) - assert.Empty(t, empty.Removed) - - // added, updated and removed blocks - kept := Block{ID: "kept", Text: "same"} - changed := Block{ID: "changed", Text: "old"} - changedNew := Block{ID: "changed", Text: "new"} - removed := Block{ID: "removed", Text: "gone"} - added := Block{ID: "added", Text: "fresh"} - - diff := BlocksDiff( - map[string]Block{"kept": kept, "changed": changed, "removed": removed}, - map[string]Block{"kept": kept, "changed": changedNew, "added": added}, - ) - - assert.Equal(t, []Block{added}, diff.Added) - assert.Equal(t, []Block{changedNew}, diff.Updated) - assert.Equal(t, []Block{removed}, diff.Removed) -} - -// stubBlocksDifference builds a difference carrying one block of each kind. -func stubBlocksDifference() BlocksDifference { - return BlocksDifference{ - Added: []Block{{ID: "a", Text: "added"}}, - Updated: []Block{{ID: "u", Text: "updated"}}, - Removed: []Block{{ID: "r", Text: "removed"}}, - } -} - -func Test_BlocksDifference_Value(t *testing.T) { - t.Parallel() - - orig := stubBlocksDifference() - - val, err := orig.Value() - require.NoError(t, err) - - data, ok := val.([]byte) - require.True(t, ok) - - exp, err := json.Marshal(orig) - require.NoError(t, err) - assert.JSONEq(t, string(exp), string(data)) -} - -func Test_BlocksDifference_Scan(t *testing.T) { - t.Parallel() - - orig := stubBlocksDifference() - - val, err := orig.Value() - require.NoError(t, err) - - var decoded BlocksDifference - - require.NoError(t, decoded.Scan(val)) - assert.Equal(t, orig, decoded) - - require.NoError(t, decoded.Scan(nil)) - assert.Equal(t, orig, decoded, "nil scan should leave the value untouched") - - assert.Error(t, decoded.Scan("not bytes")) - assert.Error(t, decoded.Scan([]byte(`{not json`))) -} - -func Test_Scope_Block(t *testing.T) { - t.Parallel() - - scope := Scope{ +// stubScope builds a scope on a draft branch. +func stubScope() Scope { + return Scope{ OrganizationID: "org-1", DocumentID: xid.New(), BranchID: xid.New(), BranchName: "draft", BranchDefault: false, } +} + +func Test_Scope_Block(t *testing.T) { + t.Parallel() + + scope := stubScope() assert.Equal(t, Block{ ID: scope.BranchID.String() + "-p1", @@ -103,3 +36,155 @@ func Test_Scope_Block(t *testing.T) { Text: "hello", }, scope.Block("p1", "paragraph", "hello")) } + +func Test_Scope_entries(t *testing.T) { + t.Parallel() + + blocks := []document.Block{ + { + Type: document.BlockNodeParagraph, + Attrs: document.Attributes{"uid": "p1"}, + Content: []document.Block{ + {Type: document.BlockNodeText, Text: "first"}, + }, + }, + { + Type: document.BlockNodeBulletList, + Attrs: document.Attributes{"uid": "l1"}, + Content: []document.Block{ + { + Type: document.BlockNodeListItem, + Attrs: document.Attributes{"uid": "li1"}, + Content: []document.Block{ + {Type: document.BlockNodeText, Text: "nested"}, + }, + }, + }, + }, + // marks split the text into multiple fragments; all of them are + // indexed, not just the last one. + { + Type: document.BlockNodeParagraph, + Attrs: document.Attributes{"uid": "p2"}, + Content: []document.Block{ + {Type: document.BlockNodeText, Text: "plain "}, + {Type: document.BlockNodeText, Text: "bold", Marks: []document.Mark{{Type: "bold"}}}, + {Type: document.BlockNodeText, Text: " tail"}, + }, + }, + // no uid: the text is not indexable. + { + Type: document.BlockNodeParagraph, + Content: []document.Block{ + {Type: document.BlockNodeText, Text: "orphan"}, + }, + }, + // no text: nothing to index. + {Type: document.BlockNodeHorizontalRule, Attrs: document.Attributes{"uid": "hr1"}}, + // a metric block's title is an attribute, not a text child. + { + Type: document.BlockNodeMetricBlock, + Attrs: document.Attributes{"uid": "m1", "title": "Pizza Fridays"}, + }, + // an untitled metric block has nothing to index. + { + Type: document.BlockNodeMetricBlock, + Attrs: document.Attributes{"uid": "m2", "title": ""}, + }, + { + Type: document.BlockNodeMetricBlock, + Attrs: document.Attributes{"uid": "m3"}, + }, + // a file block's name is an attribute, not a text child. + { + Type: document.BlockNodeFileBlock, + Attrs: document.Attributes{"uid": "f1", "name": "quarterly-report.pdf", "size": 2048}, + }, + // a file block still uploading has no name to index. + { + Type: document.BlockNodeFileBlock, + Attrs: document.Attributes{"uid": "f2"}, + }, + // an image block is described by its alt and title attributes. + { + Type: document.BlockNodeImageBlock, + Attrs: document.Attributes{"uid": "i1", "alt": "architecture diagram", "title": "Overview"}, + }, + { + Type: document.BlockNodeImageBlock, + Attrs: document.Attributes{"uid": "i2", "alt": "login flow"}, + }, + // an undescribed image has nothing to index. + { + Type: document.BlockNodeImageBlock, + Attrs: document.Attributes{"uid": "i3", "src": "/x.png"}, + }, + } + + scope := stubScope() + res := make(map[string]Block) + + for _, b := range blocks { + scope.entries(b, res) + } + + assert.Equal(t, map[string]Block{ + "p1": scope.Block("p1", "paragraph", "first"), + "li1": scope.Block("li1", "listItem", "nested"), + "p2": scope.Block("p2", "paragraph", "plain bold tail"), + "m1": scope.Block("m1", "metricBlock", "Pizza Fridays"), + "f1": scope.Block("f1", "fileBlock", "quarterly-report.pdf"), + "i1": scope.Block("i1", "imageBlock", "architecture diagram Overview"), + "i2": scope.Block("i2", "imageBlock", "login flow"), + }, res) +} + +func Test_Entries(t *testing.T) { + t.Parallel() + + doc := document.Document{ + ID: xid.New(), + OrganizationID: "org-1", + BranchID: xid.New(), + BranchName: document.DefaultBranch, + DocumentName: "Runbook", + Content: document.RootBlock{ + Type: document.BlockNodeDoc, + Content: []document.Block{ + { + Type: document.BlockNodeParagraph, + Attrs: document.Attributes{"uid": "p1"}, + Content: []document.Block{ + {Type: document.BlockNodeText, Text: "hello"}, + }, + }, + }, + }, + Default: true, + } + + res := Entries(doc) + + // the content block plus the synthetic document-name block. + require.Len(t, res, 2) + + nameBlock, ok := res[doc.ID.String()] + require.True(t, ok) + assert.Equal(t, Block{ + ID: doc.BranchID.String() + "-docname", + OrganizationID: "org-1", + DocumentID: doc.ID, + BranchID: doc.BranchID, + BranchName: document.DefaultBranch, + BranchDefault: true, + Type: "document", + Text: "Runbook", + }, nameBlock) + + contentBlock, ok := res["p1"] + require.True(t, ok) + assert.Equal(t, doc.BranchID.String()+"-p1", contentBlock.ID) + assert.Equal(t, doc.BranchID, contentBlock.BranchID) + assert.True(t, contentBlock.BranchDefault) + assert.Equal(t, "hello", contentBlock.Text) +} diff --git a/server/core/internal/search/index.go b/server/core/internal/search/index.go new file mode 100644 index 00000000..f9bbb4e1 --- /dev/null +++ b/server/core/internal/search/index.go @@ -0,0 +1,370 @@ +// Package search indexes and searches documents through an embedded bleve +// index. +package search + +import ( + "context" + _ "embed" + "encoding/json" + "errors" + "fmt" + "log/slog" + "os" + "strconv" + "time" + + "github.com/blevesearch/bleve/v2" + "github.com/oxynote/oxynote/server/core/internal/document" + "github.com/rs/xid" +) + +//go:embed static/synonyms.json +var synonymsFile []byte + +const ( + // _buildSuffix is appended to the index path while a fresh index is + // being built next to it. + _buildSuffix = ".building" + + // _buildPage is the number of branches one rebuild step reads. + _buildPage = 500 + + // _idsPage is the number of entry ids one lookup step reads. + _idsPage = 1000 + + // _writeTimeout bounds one batch of index writes. + _writeTimeout = 2 * time.Minute +) + +// Index is the document index. Handlers search it concurrently; the +// search-job worker and the boot-time build are its only writers. +type Index struct { + log *slog.Logger + idx bleve.Index +} + +// Open opens the index at path, or builds it from src when there is none +// or the one there was written by a binary with another mapping. The build +// happens next to path and is swapped in only once complete, so an +// interrupted build never leaves a half-written index behind. +func Open(ctx context.Context, log *slog.Logger, path string, src Source) (*Index, error) { + if path == "" { + return nil, errors.New("index path is empty") + } + + if err := registerHighlighter(); err != nil { + return nil, err + } + + log = log.With("component", "search-index") + + idx, err := openCurrent(log, path) + if err != nil { + return nil, err + } + + if idx == nil { + idx, err = build(ctx, log, path, src) + if err != nil { + return nil, err + } + } + + return &Index{ + log: log, + idx: idx, + }, nil +} + +// openCurrent opens the index at path when it exists and carries the +// mapping version of this binary. It returns nil otherwise, which asks for +// a build; an index that cannot be opened counts as absent, since it is +// only ever a cache of the database. +func openCurrent(log *slog.Logger, path string) (bleve.Index, error) { + if _, err := os.Stat(path); err != nil { + if errors.Is(err, os.ErrNotExist) { + return nil, nil //nolint:nilnil // no index is a valid state that asks for a build + } + + return nil, fmt.Errorf("checking index path: %w", err) + } + + idx, err := bleve.Open(path) + if err != nil { + log.With("error", err). + Warn("cannot open the search index, rebuilding it") + + return nil, nil //nolint:nilnil // an unreadable index asks for a build + } + + version, err := idx.GetInternal([]byte(_mappingVersionKey)) + if err != nil { + if cerr := idx.Close(); cerr != nil { + return nil, fmt.Errorf("closing index: %w", cerr) + } + + return nil, fmt.Errorf("reading mapping version: %w", err) + } + + if string(version) == _mappingVersion { + return idx, nil + } + + log.With("index_version", string(version)). + With("binary_version", _mappingVersion). + Info("search index mapping is outdated, rebuilding it") + + if err := idx.Close(); err != nil { + return nil, fmt.Errorf("closing index: %w", err) + } + + return nil, nil //nolint:nilnil // an outdated index asks for a build +} + +// build creates a fresh index from every branch in src at path. +func build(ctx context.Context, log *slog.Logger, path string, src Source) (bleve.Index, error) { + log.Info("building the search index") + + tmp := path + _buildSuffix + + if err := os.RemoveAll(tmp); err != nil { + return nil, fmt.Errorf("removing stale build: %w", err) + } + + im, err := newIndexMapping() + if err != nil { + return nil, err + } + + idx, err := bleve.New(tmp, im) + if err != nil { + return nil, fmt.Errorf("creating index: %w", err) + } + + if err = fill(ctx, log, idx, src); err != nil { + if cerr := idx.Close(); cerr != nil { + err = errors.Join(err, fmt.Errorf("closing index: %w", cerr)) + } + + return nil, err + } + + if err = idx.Close(); err != nil { + return nil, fmt.Errorf("closing built index: %w", err) + } + + if err = os.RemoveAll(path); err != nil { + return nil, fmt.Errorf("removing previous index: %w", err) + } + + if err = os.Rename(tmp, path); err != nil { + return nil, fmt.Errorf("moving built index into place: %w", err) + } + + idx, err = bleve.Open(path) + if err != nil { + return nil, fmt.Errorf("opening built index: %w", err) + } + + return idx, nil +} + +// fill writes the synonyms, every branch's entries and finally the mapping +// version into a fresh index. The version goes last, so an index missing +// it is one whose build did not finish. +func fill(ctx context.Context, log *slog.Logger, idx bleve.Index, src Source) error { + if err := indexSynonyms(idx); err != nil { + return err + } + + var ( + after xid.ID + branches int + ) + + for { + docs, err := src.FetchDocumentBranchesAfter(ctx, after, _buildPage) + if err != nil { + return fmt.Errorf("fetching branches: %w", err) + } + + batch := idx.NewBatch() + + for _, doc := range docs { + for _, e := range Entries(doc) { + if err := batch.Index(e.ID, e.record()); err != nil { + return fmt.Errorf("indexing entry %s: %w", e.ID, err) + } + } + } + + if err := idx.Batch(batch); err != nil { + return fmt.Errorf("writing batch: %w", err) + } + + branches += len(docs) + + if len(docs) < _buildPage { + break + } + + after = docs[len(docs)-1].BranchID + } + + if err := idx.SetInternal([]byte(_mappingVersionKey), []byte(_mappingVersion)); err != nil { + return fmt.Errorf("writing mapping version: %w", err) + } + + log.With("branches", branches). + Info("built the search index") + + return nil +} + +// indexSynonyms loads the synonyms file into the index. Every entry is +// bidirectional: the key and each of its values expand to one another. +func indexSynonyms(idx bleve.Index) error { + var synonyms map[string][]string + + if err := json.Unmarshal(synonymsFile, &synonyms); err != nil { + return fmt.Errorf("unmarshaling synonyms: %w", err) + } + + batch := idx.NewBatch() + + n := 0 + + for key, values := range synonyms { + n++ + + def := &bleve.SynonymDefinition{ + Synonyms: append([]string{key}, values...), + } + + if err := batch.IndexSynonym("synonym-"+strconv.Itoa(n), _synonymCollection, def); err != nil { + return fmt.Errorf("indexing synonym %q: %w", key, err) + } + } + + if err := idx.Batch(batch); err != nil { + return fmt.Errorf("writing synonyms: %w", err) + } + + return nil +} + +// Close closes the index. +func (i *Index) Close() error { + return i.idx.Close() +} + +// ReplaceBranch makes the branch's entries exactly the given ones: what is +// there and not in entries is deleted, the rest is written, all in one +// batch. +func (i *Index) ReplaceBranch(ctx context.Context, branchID xid.ID, entries map[string]Block) error { + ctx, cancel := context.WithTimeout(ctx, _writeTimeout) + defer cancel() + + ids, err := i.ids(ctx, _fieldBranchID, branchID.String()) + if err != nil { + return err + } + + batch := i.idx.NewBatch() + + // a block that survives an edit keeps its id, so it is deleted and + // indexed in the same batch. The batch is a map keyed by id where the + // last write wins, which is why the deletes go in first. + for _, id := range ids { + batch.Delete(id) + } + + for _, e := range entries { + if err := batch.Index(e.ID, e.record()); err != nil { + return fmt.Errorf("indexing entry %s: %w", e.ID, err) + } + } + + if err := i.idx.Batch(batch); err != nil { + return fmt.Errorf("replacing branch %s: %w", branchID, err) + } + + return nil +} + +// DeleteBranch removes every entry of the branch. +func (i *Index) DeleteBranch(ctx context.Context, branchID xid.ID) error { + return i.deleteByTerm(ctx, _fieldBranchID, branchID.String()) +} + +// DeleteDocument removes every entry of the document, on every branch. +func (i *Index) DeleteDocument(ctx context.Context, documentID xid.ID) error { + return i.deleteByTerm(ctx, _fieldDocumentID, documentID.String()) +} + +// DeleteOrganization removes every entry of the organization. +func (i *Index) DeleteOrganization(ctx context.Context, organizationID string) error { + return i.deleteByTerm(ctx, _fieldOrganizationID, organizationID) +} + +// deleteByTerm removes every entry whose field holds the value. +func (i *Index) deleteByTerm(ctx context.Context, field, value string) error { + ctx, cancel := context.WithTimeout(ctx, _writeTimeout) + defer cancel() + + ids, err := i.ids(ctx, field, value) + if err != nil { + return err + } + + if len(ids) == 0 { + return nil + } + + batch := i.idx.NewBatch() + + for _, id := range ids { + batch.Delete(id) + } + + if err := i.idx.Batch(batch); err != nil { + return fmt.Errorf("deleting by %s: %w", field, err) + } + + return nil +} + +// ids lists the ids of every entry whose field holds the value. bleve has +// no delete-by-query, so removals go through this list. +func (i *Index) ids(ctx context.Context, field, value string) ([]string, error) { + q := bleve.NewTermQuery(value) + q.SetField(field) + + var ids []string + + for from := 0; ; from += _idsPage { + req := bleve.NewSearchRequestOptions(q, _idsPage, from, false) + req.SortBy([]string{"_id"}) + + res, err := i.idx.SearchInContext(ctx, req) + if err != nil { + return nil, fmt.Errorf("listing entries by %s: %w", field, err) + } + + for _, hit := range res.Hits { + ids = append(ids, hit.ID) + } + + if len(res.Hits) < _idsPage { + return ids, nil + } + } +} + +// Source is the database surface a build reads the branches from. +type Source interface { + // FetchDocumentBranchesAfter should return up to limit branches whose + // id sorts after the given one, joined with their document, in id + // order. + FetchDocumentBranchesAfter(ctx context.Context, after xid.ID, limit int) ([]document.Document, error) +} diff --git a/server/core/internal/search/index_test.go b/server/core/internal/search/index_test.go new file mode 100644 index 00000000..3728b048 --- /dev/null +++ b/server/core/internal/search/index_test.go @@ -0,0 +1,543 @@ +package search + +import ( + "context" + "log/slog" + "os" + "path/filepath" + "strconv" + "testing" + + "github.com/oxynote/oxynote/server/core/internal/document" + "github.com/rs/xid" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +// stubSource serves fixed branches, in branch id order, page by page. +type stubSource struct { + docs []document.Document + err error + calls int +} + +func (s *stubSource) FetchDocumentBranchesAfter(_ context.Context, after xid.ID, limit int) ([]document.Document, error) { + s.calls++ + + if s.err != nil { + return nil, s.err + } + + res := []document.Document{} + + for _, d := range s.docs { + if d.BranchID.String() > after.String() && len(res) < limit { + res = append(res, d) + } + } + + return res, nil +} + +// stubDocument builds a default-branch document of org-1 with one +// paragraph. Ids come from xid.New, which increase within a process, so +// documents built in sequence are already in branch id order. +func stubDocument(name, text string) document.Document { + return document.Document{ + ID: xid.New(), + OrganizationID: "org-1", + BranchID: xid.New(), + BranchName: document.DefaultBranch, + DocumentName: name, + Content: document.RootBlock{ + Type: document.BlockNodeDoc, + Content: []document.Block{ + { + Type: document.BlockNodeParagraph, + Attrs: document.Attributes{"uid": "p1"}, + Content: []document.Block{ + {Type: document.BlockNodeText, Text: text}, + }, + }, + }, + }, + Default: true, + } +} + +// indexPath returns a fresh index path that does not exist yet. +func indexPath(t *testing.T) string { + t.Helper() + + return filepath.Join(t.TempDir(), "index") +} + +// openIndex opens or builds an index at path from src. +func openIndex(t *testing.T, path string, src Source) *Index { + t.Helper() + + idx, err := Open(context.Background(), slog.New(slog.DiscardHandler), path, src) + require.NoError(t, err) + require.NotNil(t, idx) + + return idx +} + +// texts returns the text of every entry the query finds for org-1, in rank +// order. +func texts(t *testing.T, idx *Index, q string) []string { + t.Helper() + + blocks, err := idx.SearchDocumentBlocks(context.Background(), "org-1", q, 50) + require.NoError(t, err) + + res := make([]string, 0, len(blocks)) + + for _, b := range blocks { + res = append(res, b.Text) + } + + return res +} + +// entryIDs returns the ids of every entry under the field's value. +func entryIDs(t *testing.T, idx *Index, field, value string) []string { + t.Helper() + + ids, err := idx.ids(context.Background(), field, value) + require.NoError(t, err) + + return ids +} + +func Test_Open(t *testing.T) { + t.Parallel() + + type tcase struct { + Path string + Source *stubSource + Err error + Check func(t *testing.T, idx *Index, path string, src *stubSource) + } + + cc := map[string]func(t *testing.T) tcase{ + "Empty path": func(*testing.T) tcase { + return tcase{ + Path: "", + Source: &stubSource{}, + Err: assert.AnError, + } + }, + "Error returned by Source.FetchDocumentBranchesAfter": func(t *testing.T) tcase { + path := indexPath(t) + + return tcase{ + Path: path, + Source: &stubSource{err: assert.AnError}, + Err: assert.AnError, + Check: func(t *testing.T, _ *Index, path string, _ *stubSource) { + _, err := os.Stat(path) + assert.True(t, os.IsNotExist(err), "a failed build leaves no index behind") + }, + } + }, + "Missing index is built from the source": func(t *testing.T) tcase { + return tcase{ + Path: indexPath(t), + Source: &stubSource{docs: []document.Document{stubDocument("Runbook", "restart the pods")}}, + Check: func(t *testing.T, idx *Index, path string, src *stubSource) { + assert.Equal(t, 1, src.calls) + assert.Equal(t, []string{"restart the pods"}, texts(t, idx, "pods")) + + version, err := idx.idx.GetInternal([]byte(_mappingVersionKey)) + require.NoError(t, err) + assert.Equal(t, _mappingVersion, string(version)) + + _, err = os.Stat(path + _buildSuffix) + assert.True(t, os.IsNotExist(err), "the build directory is moved into place") + }, + } + }, + "Index with the current mapping version opens as is": func(t *testing.T) tcase { + path := indexPath(t) + + prev := openIndex(t, path, &stubSource{docs: []document.Document{stubDocument("Runbook", "restart the pods")}}) + require.NoError(t, prev.Close()) + + return tcase{ + Path: path, + Source: &stubSource{docs: []document.Document{stubDocument("Other", "scale the cluster")}}, + Check: func(t *testing.T, idx *Index, _ string, src *stubSource) { + assert.Equal(t, 0, src.calls, "the source is not consulted") + assert.Equal(t, []string{"restart the pods"}, texts(t, idx, "pods")) + assert.Empty(t, texts(t, idx, "cluster")) + }, + } + }, + "Index with another mapping version is rebuilt": func(t *testing.T) tcase { + path := indexPath(t) + + prev := openIndex(t, path, &stubSource{docs: []document.Document{stubDocument("Runbook", "restart the pods")}}) + require.NoError(t, prev.idx.SetInternal([]byte(_mappingVersionKey), []byte("0"))) + require.NoError(t, prev.Close()) + + return tcase{ + Path: path, + Source: &stubSource{docs: []document.Document{stubDocument("Other", "scale the cluster")}}, + Check: func(t *testing.T, idx *Index, _ string, src *stubSource) { + assert.Equal(t, 1, src.calls) + assert.Empty(t, texts(t, idx, "pods")) + assert.Equal(t, []string{"scale the cluster"}, texts(t, idx, "cluster")) + }, + } + }, + "Index without a mapping version is rebuilt": func(t *testing.T) tcase { + path := indexPath(t) + + prev := openIndex(t, path, &stubSource{}) + require.NoError(t, prev.idx.DeleteInternal([]byte(_mappingVersionKey))) + require.NoError(t, prev.Close()) + + return tcase{ + Path: path, + Source: &stubSource{}, + Check: func(t *testing.T, _ *Index, _ string, src *stubSource) { + assert.Equal(t, 1, src.calls) + }, + } + }, + "Unreadable index is rebuilt": func(t *testing.T) tcase { + path := indexPath(t) + require.NoError(t, os.WriteFile(path, []byte("not an index"), 0o600)) + + return tcase{ + Path: path, + Source: &stubSource{}, + Check: func(t *testing.T, _ *Index, path string, src *stubSource) { + assert.Equal(t, 1, src.calls) + + info, err := os.Stat(path) + require.NoError(t, err) + assert.True(t, info.IsDir()) + }, + } + }, + "Stale build directory is replaced": func(t *testing.T) tcase { + path := indexPath(t) + require.NoError(t, os.MkdirAll(path+_buildSuffix, 0o750)) + require.NoError(t, os.WriteFile(filepath.Join(path+_buildSuffix, "junk"), []byte("junk"), 0o600)) + + return tcase{ + Path: path, + Source: &stubSource{}, + Check: func(t *testing.T, _ *Index, path string, _ *stubSource) { + _, err := os.Stat(filepath.Join(path, "junk")) + assert.True(t, os.IsNotExist(err)) + }, + } + }, + } + + for cn, c := range cc { + t.Run(cn, func(t *testing.T) { + t.Parallel() + + c := c(t) + + idx, err := Open(context.Background(), slog.New(slog.DiscardHandler), c.Path, c.Source) + + if c.Err != nil { + require.Error(t, err) + assert.Nil(t, idx) + } else { + require.NoError(t, err) + require.NotNil(t, idx) + + defer func() { require.NoError(t, idx.Close()) }() + } + + if c.Check != nil { + c.Check(t, idx, c.Path, c.Source) + } + }) + } +} + +func Test_openCurrent(t *testing.T) { + t.Parallel() + + log := slog.New(slog.DiscardHandler) + + // missing path + idx, err := openCurrent(log, indexPath(t)) + require.NoError(t, err) + assert.Nil(t, idx) + + // path that is not an index + path := indexPath(t) + require.NoError(t, os.WriteFile(path, []byte("not an index"), 0o600)) + + idx, err = openCurrent(log, path) + require.NoError(t, err) + assert.Nil(t, idx) + + // current index + path = indexPath(t) + + built := openIndex(t, path, &stubSource{}) + require.NoError(t, built.Close()) + + idx, err = openCurrent(log, path) + require.NoError(t, err) + require.NotNil(t, idx) + require.NoError(t, idx.Close()) + + // outdated index + built = openIndex(t, path, &stubSource{}) + require.NoError(t, built.idx.SetInternal([]byte(_mappingVersionKey), []byte("0"))) + require.NoError(t, built.Close()) + + idx, err = openCurrent(log, path) + require.NoError(t, err) + assert.Nil(t, idx) +} + +func Test_build(t *testing.T) { + t.Parallel() + + log := slog.New(slog.DiscardHandler) + + // error + path := indexPath(t) + + idx, err := build(context.Background(), log, path, &stubSource{err: assert.AnError}) + require.Error(t, err) + assert.Nil(t, idx) + + _, err = os.Stat(path) + assert.True(t, os.IsNotExist(err)) + + // success, replacing whatever was at the path + require.NoError(t, os.WriteFile(path, []byte("previous"), 0o600)) + + idx, err = build(context.Background(), log, path, &stubSource{}) + require.NoError(t, err) + require.NotNil(t, idx) + require.NoError(t, idx.Close()) + + info, err := os.Stat(path) + require.NoError(t, err) + assert.True(t, info.IsDir()) + + _, err = os.Stat(path + _buildSuffix) + assert.True(t, os.IsNotExist(err)) +} + +func Test_fill(t *testing.T) { + t.Parallel() + + // error + idx := openIndex(t, indexPath(t), &stubSource{}) + defer func() { require.NoError(t, idx.Close()) }() + + require.Error(t, fill(context.Background(), slog.New(slog.DiscardHandler), idx.idx, &stubSource{err: assert.AnError})) + + // success: every page is read until a short one, and the version is + // stamped last. + docs := make([]document.Document, 0, _buildPage+1) + + for i := range _buildPage + 1 { + docs = append(docs, stubDocument("Doc "+strconv.Itoa(i), "page filler")) + } + + src := &stubSource{docs: docs} + + require.NoError(t, idx.idx.DeleteInternal([]byte(_mappingVersionKey))) + require.NoError(t, fill(context.Background(), slog.New(slog.DiscardHandler), idx.idx, src)) + + assert.Equal(t, 2, src.calls) + + // one paragraph and one document-name entry per branch. + assert.Len(t, entryIDs(t, idx, _fieldOrganizationID, "org-1"), 2*(_buildPage+1)) + + version, err := idx.idx.GetInternal([]byte(_mappingVersionKey)) + require.NoError(t, err) + assert.Equal(t, _mappingVersion, string(version)) +} + +func Test_indexSynonyms(t *testing.T) { + t.Parallel() + + idx := openIndex(t, indexPath(t), &stubSource{}) + + // a build already loaded the synonyms; loading them again is an error + // only once the index is closed. + require.NoError(t, indexSynonyms(idx.idx)) + require.NoError(t, idx.Close()) + require.Error(t, indexSynonyms(idx.idx)) +} + +func Test_Index_Close(t *testing.T) { + t.Parallel() + + idx := openIndex(t, indexPath(t), &stubSource{}) + + require.NoError(t, idx.Close()) +} + +func Test_Index_ReplaceBranch(t *testing.T) { + t.Parallel() + + idx := openIndex(t, indexPath(t), &stubSource{}) + defer func() { require.NoError(t, idx.Close()) }() + + one, two := stubScope(), stubScope() + + require.NoError(t, idx.ReplaceBranch(context.Background(), one.BranchID, map[string]Block{ + "a": one.Block("a", "paragraph", "alpha"), + "b": one.Block("b", "paragraph", "beta"), + })) + require.NoError(t, idx.ReplaceBranch(context.Background(), two.BranchID, map[string]Block{ + "c": two.Block("c", "paragraph", "gamma"), + })) + + // the replacement updates, adds and removes, and leaves the other + // branch alone. + require.NoError(t, idx.ReplaceBranch(context.Background(), one.BranchID, map[string]Block{ + "a": one.Block("a", "paragraph", "alpha changed"), + "d": one.Block("d", "paragraph", "delta"), + })) + + assert.ElementsMatch(t, []string{one.BranchID.String() + "-a", one.BranchID.String() + "-d"}, entryIDs(t, idx, _fieldBranchID, one.BranchID.String())) + assert.Equal(t, []string{"alpha changed"}, texts(t, idx, "alpha")) + assert.Empty(t, texts(t, idx, "beta")) + assert.Equal(t, []string{"gamma"}, texts(t, idx, "gamma")) + + // an entry without an id is refused before anything is written. + require.Error(t, idx.ReplaceBranch(context.Background(), one.BranchID, map[string]Block{ + "e": {Text: "epsilon"}, + })) + assert.Equal(t, []string{"alpha changed"}, texts(t, idx, "alpha")) + + // a closed index fails the lookup. + require.NoError(t, idx.idx.Close()) + require.Error(t, idx.ReplaceBranch(context.Background(), one.BranchID, nil)) + + idx.idx = openIndex(t, indexPath(t), &stubSource{}).idx +} + +func Test_Index_DeleteBranch(t *testing.T) { + t.Parallel() + + idx := openIndex(t, indexPath(t), &stubSource{}) + defer func() { require.NoError(t, idx.Close()) }() + + one, two := stubScope(), stubScope() + + require.NoError(t, idx.ReplaceBranch(context.Background(), one.BranchID, map[string]Block{"a": one.Block("a", "paragraph", "alpha")})) + require.NoError(t, idx.ReplaceBranch(context.Background(), two.BranchID, map[string]Block{"b": two.Block("b", "paragraph", "beta")})) + + require.NoError(t, idx.DeleteBranch(context.Background(), one.BranchID)) + + assert.Empty(t, entryIDs(t, idx, _fieldBranchID, one.BranchID.String())) + assert.Len(t, entryIDs(t, idx, _fieldBranchID, two.BranchID.String()), 1) +} + +func Test_Index_DeleteDocument(t *testing.T) { + t.Parallel() + + idx := openIndex(t, indexPath(t), &stubSource{}) + defer func() { require.NoError(t, idx.Close()) }() + + one, two := stubScope(), stubScope() + fork := one + fork.BranchID = xid.New() + + require.NoError(t, idx.ReplaceBranch(context.Background(), one.BranchID, map[string]Block{"a": one.Block("a", "paragraph", "alpha")})) + require.NoError(t, idx.ReplaceBranch(context.Background(), fork.BranchID, map[string]Block{"a": fork.Block("a", "paragraph", "alpha")})) + require.NoError(t, idx.ReplaceBranch(context.Background(), two.BranchID, map[string]Block{"b": two.Block("b", "paragraph", "beta")})) + + require.NoError(t, idx.DeleteDocument(context.Background(), one.DocumentID)) + + assert.Empty(t, entryIDs(t, idx, _fieldDocumentID, one.DocumentID.String())) + assert.Len(t, entryIDs(t, idx, _fieldDocumentID, two.DocumentID.String()), 1) +} + +func Test_Index_DeleteOrganization(t *testing.T) { + t.Parallel() + + idx := openIndex(t, indexPath(t), &stubSource{}) + defer func() { require.NoError(t, idx.Close()) }() + + one, two := stubScope(), stubScope() + two.OrganizationID = "org-2" + + require.NoError(t, idx.ReplaceBranch(context.Background(), one.BranchID, map[string]Block{"a": one.Block("a", "paragraph", "alpha")})) + require.NoError(t, idx.ReplaceBranch(context.Background(), two.BranchID, map[string]Block{"b": two.Block("b", "paragraph", "beta")})) + + require.NoError(t, idx.DeleteOrganization(context.Background(), "org-1")) + + assert.Empty(t, entryIDs(t, idx, _fieldOrganizationID, "org-1")) + assert.Len(t, entryIDs(t, idx, _fieldOrganizationID, "org-2"), 1) +} + +func Test_Index_deleteByTerm(t *testing.T) { + t.Parallel() + + idx := openIndex(t, indexPath(t), &stubSource{}) + defer func() { require.NoError(t, idx.Close()) }() + + scope := stubScope() + + require.NoError(t, idx.ReplaceBranch(context.Background(), scope.BranchID, map[string]Block{"a": scope.Block("a", "paragraph", "alpha")})) + + // nothing under the value: no batch is written. + require.NoError(t, idx.deleteByTerm(context.Background(), _fieldBranchID, "missing")) + assert.Len(t, entryIDs(t, idx, _fieldBranchID, scope.BranchID.String()), 1) + + // success + require.NoError(t, idx.deleteByTerm(context.Background(), _fieldBranchID, scope.BranchID.String())) + assert.Empty(t, entryIDs(t, idx, _fieldBranchID, scope.BranchID.String())) + + // a closed index fails the lookup. + require.NoError(t, idx.idx.Close()) + require.Error(t, idx.deleteByTerm(context.Background(), _fieldBranchID, scope.BranchID.String())) + + idx.idx = openIndex(t, indexPath(t), &stubSource{}).idx +} + +func Test_Index_ids(t *testing.T) { + t.Parallel() + + idx := openIndex(t, indexPath(t), &stubSource{}) + defer func() { require.NoError(t, idx.Close()) }() + + scope := stubScope() + entries := make(map[string]Block, _idsPage+1) + + for i := range _idsPage + 1 { + uid := "b" + strconv.Itoa(i) + entries[uid] = scope.Block(uid, "paragraph", "filler") + } + + require.NoError(t, idx.ReplaceBranch(context.Background(), scope.BranchID, entries)) + + // every page is read, without duplicates. + ids := entryIDs(t, idx, _fieldBranchID, scope.BranchID.String()) + assert.Len(t, ids, _idsPage+1) + + seen := make(map[string]struct{}, len(ids)) + + for _, id := range ids { + seen[id] = struct{}{} + } + + assert.Len(t, seen, _idsPage+1) + + // a cancelled context fails the lookup. + ctx, cancel := context.WithCancel(context.Background()) + cancel() + + _, err := idx.ids(ctx, _fieldBranchID, scope.BranchID.String()) + require.Error(t, err) +} diff --git a/server/core/internal/search/jobs.go b/server/core/internal/search/jobs.go index 4bb7bf1a..cf190f23 100644 --- a/server/core/internal/search/jobs.go +++ b/server/core/internal/search/jobs.go @@ -1,38 +1,53 @@ package search -import "context" +import ( + "github.com/guregu/null/v5" + "github.com/rs/xid" +) -// Jobs is the way into the document search-job queue: every enqueue in -// the codebase goes through it, so whether a deployment indexes at all -// is decided here rather than by each call site or the database layer. -type Jobs struct { - enabled bool +// Job names a scope of the index to bring back in line with the database: +// a branch, a whole document, or a whole organization. It carries no +// content, so applying it in any order or any number of times yields the +// same index. +type Job struct { + // ID is the unique identifier for the job. + ID int64 `db:"id"` + + // Version counts the times the scope was queued while the job was + // pending. A job is deleted only at the version it was applied with, + // so a change committed during the application is picked up again. + Version int64 `db:"version"` + + // OrganizationID is the organization the scope belongs to. + OrganizationID string `db:"organization_id"` + + // DocumentID is the document the scope narrows to, if any. + DocumentID null.Value[xid.ID] `db:"document_id"` + + // BranchID is the branch the scope narrows to, if any. + BranchID null.Value[xid.ID] `db:"branch_id"` } -// NewJobs creates a fresh instance of Jobs. When enabled is false — -// search is not configured on this deployment — every enqueued job is -// dropped instead of piling up in a table nothing consumes; documents -// created meanwhile were never indexed, so there is nothing stale to -// clean up either. -func NewJobs(enabled bool) *Jobs { - return &Jobs{ - enabled: enabled, +// BranchScope names one branch of a document. +func BranchScope(organizationID string, documentID, branchID xid.ID) Job { + return Job{ + OrganizationID: organizationID, + DocumentID: null.ValueFrom(documentID), + BranchID: null.ValueFrom(branchID), } } -// Enqueue queues the diff through the given inserter, which is the -// caller's own database handle so the job commits atomically with the -// content change it describes. -func (j *Jobs) Enqueue(ctx context.Context, ins JobInserter, diff BlocksDifference) error { - if !j.enabled { - return nil +// DocumentScope names every branch of a document. +func DocumentScope(organizationID string, documentID xid.ID) Job { + return Job{ + OrganizationID: organizationID, + DocumentID: null.ValueFrom(documentID), } - - return ins.InsertDocumentSearchJob(ctx, diff) } -// JobInserter is the database surface Enqueue writes through. -type JobInserter interface { - // InsertDocumentSearchJob should insert the document search job. - InsertDocumentSearchJob(ctx context.Context, diff BlocksDifference) error +// OrganizationScope names every entry of an organization. +func OrganizationScope(organizationID string) Job { + return Job{ + OrganizationID: organizationID, + } } diff --git a/server/core/internal/search/jobs_test.go b/server/core/internal/search/jobs_test.go index 997ee2fd..5471120a 100644 --- a/server/core/internal/search/jobs_test.go +++ b/server/core/internal/search/jobs_test.go @@ -1,49 +1,40 @@ package search import ( - "context" "testing" + "github.com/guregu/null/v5" + "github.com/rs/xid" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) -// insertRecorder records InsertDocumentSearchJob calls for Jobs tests. -type insertRecorder struct { - diffs []BlocksDifference - err error -} - -func (ir *insertRecorder) InsertDocumentSearchJob(_ context.Context, diff BlocksDifference) error { - ir.diffs = append(ir.diffs, diff) - - return ir.err -} - -func Test_NewJobs(t *testing.T) { +func Test_BranchScope(t *testing.T) { t.Parallel() - j := NewJobs(true) - require.NotNil(t, j) - assert.True(t, j.enabled) + documentID, branchID := xid.New(), xid.New() + + assert.Equal(t, Job{ + OrganizationID: "org-1", + DocumentID: null.ValueFrom(documentID), + BranchID: null.ValueFrom(branchID), + }, BranchScope("org-1", documentID, branchID)) } -func Test_Jobs_Enqueue(t *testing.T) { +func Test_DocumentScope(t *testing.T) { t.Parallel() - diff := BlocksDifference{ - RemovedOrganizations: []string{"org1"}, - } + documentID := xid.New() - // disabled drops the job without touching the inserter. - ir := &insertRecorder{} - require.NoError(t, NewJobs(false).Enqueue(context.Background(), ir, diff)) - assert.Empty(t, ir.diffs) - - // enabled writes through and propagates the inserter's error. - ir = &insertRecorder{err: assert.AnError} - err := NewJobs(true).Enqueue(context.Background(), ir, diff) - assert.Equal(t, assert.AnError, err) - require.Len(t, ir.diffs, 1) - assert.Equal(t, diff, ir.diffs[0]) + assert.Equal(t, Job{ + OrganizationID: "org-1", + DocumentID: null.ValueFrom(documentID), + }, DocumentScope("org-1", documentID)) +} + +func Test_OrganizationScope(t *testing.T) { + t.Parallel() + + assert.Equal(t, Job{ + OrganizationID: "org-1", + }, OrganizationScope("org-1")) } diff --git a/server/core/internal/search/main_test.go b/server/core/internal/search/main_test.go new file mode 100644 index 00000000..955339ca --- /dev/null +++ b/server/core/internal/search/main_test.go @@ -0,0 +1,12 @@ +package search + +import ( + "testing" + + "github.com/oxynote/oxynote/server/core/pkg/testutil" + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m, testutil.IgnoreBleveWorkers()) +} diff --git a/server/core/internal/search/manager/0mock_db_test.go b/server/core/internal/search/manager/0mock_db_test.go index f2a08663..893783af 100644 --- a/server/core/internal/search/manager/0mock_db_test.go +++ b/server/core/internal/search/manager/0mock_db_test.go @@ -5,9 +5,10 @@ package manager import ( "context" - "sync" - + "github.com/oxynote/oxynote/server/core/internal/document" "github.com/oxynote/oxynote/server/core/internal/search" + "github.com/rs/xid" + "sync" ) // Ensure, that DBMock does implement DB. @@ -20,11 +21,17 @@ var _ DB = &DBMock{} // // // make and configure a mocked DB // mockedDB := &DBMock{ -// DeleteDocumentSearchJobFunc: func(ctx context.Context, id int64) error { -// panic("mock out the DeleteDocumentSearchJob method") +// DeleteSearchJobFunc: func(ctx context.Context, id int64, version int64) error { +// panic("mock out the DeleteSearchJob method") // }, -// FetchDocumentSearchJobsFunc: func(ctx context.Context, offsetID int64, limit int64) ([]search.DocumentSearchJob, error) { -// panic("mock out the FetchDocumentSearchJobs method") +// FetchDocumentBranchesUnsafeFunc: func(ctx context.Context, docID xid.ID) ([]document.BranchSummary, error) { +// panic("mock out the FetchDocumentBranchesUnsafe method") +// }, +// FetchDocumentUnsafeByBranchIDFunc: func(ctx context.Context, branchID xid.ID) (*document.Document, error) { +// panic("mock out the FetchDocumentUnsafeByBranchID method") +// }, +// FetchSearchJobsFunc: func(ctx context.Context, offsetID int64, limit int64) ([]search.Job, error) { +// panic("mock out the FetchSearchJobs method") // }, // } // @@ -33,23 +40,45 @@ var _ DB = &DBMock{} // // } type DBMock struct { - // DeleteDocumentSearchJobFunc mocks the DeleteDocumentSearchJob method. - DeleteDocumentSearchJobFunc func(ctx context.Context, id int64) error + // DeleteSearchJobFunc mocks the DeleteSearchJob method. + DeleteSearchJobFunc func(ctx context.Context, id int64, version int64) error - // FetchDocumentSearchJobsFunc mocks the FetchDocumentSearchJobs method. - FetchDocumentSearchJobsFunc func(ctx context.Context, offsetID int64, limit int64) ([]search.DocumentSearchJob, error) + // FetchDocumentBranchesUnsafeFunc mocks the FetchDocumentBranchesUnsafe method. + FetchDocumentBranchesUnsafeFunc func(ctx context.Context, docID xid.ID) ([]document.BranchSummary, error) + + // FetchDocumentUnsafeByBranchIDFunc mocks the FetchDocumentUnsafeByBranchID method. + FetchDocumentUnsafeByBranchIDFunc func(ctx context.Context, branchID xid.ID) (*document.Document, error) + + // FetchSearchJobsFunc mocks the FetchSearchJobs method. + FetchSearchJobsFunc func(ctx context.Context, offsetID int64, limit int64) ([]search.Job, error) // calls tracks calls to the methods. calls struct { - // DeleteDocumentSearchJob holds details about calls to the DeleteDocumentSearchJob method. - DeleteDocumentSearchJob []struct { + // DeleteSearchJob holds details about calls to the DeleteSearchJob method. + DeleteSearchJob []struct { // Ctx is the ctx argument value. Ctx context.Context // ID is the id argument value. ID int64 + // Version is the version argument value. + Version int64 } - // FetchDocumentSearchJobs holds details about calls to the FetchDocumentSearchJobs method. - FetchDocumentSearchJobs []struct { + // FetchDocumentBranchesUnsafe holds details about calls to the FetchDocumentBranchesUnsafe method. + FetchDocumentBranchesUnsafe []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // DocID is the docID argument value. + DocID xid.ID + } + // FetchDocumentUnsafeByBranchID holds details about calls to the FetchDocumentUnsafeByBranchID method. + FetchDocumentUnsafeByBranchID []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // BranchID is the branchID argument value. + BranchID xid.ID + } + // FetchSearchJobs holds details about calls to the FetchSearchJobs method. + FetchSearchJobs []struct { // Ctx is the ctx argument value. Ctx context.Context // OffsetID is the offsetID argument value. @@ -58,51 +87,137 @@ type DBMock struct { Limit int64 } } - lockDeleteDocumentSearchJob sync.RWMutex - lockFetchDocumentSearchJobs sync.RWMutex + lockDeleteSearchJob sync.RWMutex + lockFetchDocumentBranchesUnsafe sync.RWMutex + lockFetchDocumentUnsafeByBranchID sync.RWMutex + lockFetchSearchJobs sync.RWMutex } -// DeleteDocumentSearchJob calls DeleteDocumentSearchJobFunc. -func (mock *DBMock) DeleteDocumentSearchJob(ctx context.Context, id int64) error { +// DeleteSearchJob calls DeleteSearchJobFunc. +func (mock *DBMock) DeleteSearchJob(ctx context.Context, id int64, version int64) error { callInfo := struct { - Ctx context.Context - ID int64 + Ctx context.Context + ID int64 + Version int64 }{ - Ctx: ctx, - ID: id, + Ctx: ctx, + ID: id, + Version: version, } - mock.lockDeleteDocumentSearchJob.Lock() - mock.calls.DeleteDocumentSearchJob = append(mock.calls.DeleteDocumentSearchJob, callInfo) - mock.lockDeleteDocumentSearchJob.Unlock() - if mock.DeleteDocumentSearchJobFunc == nil { + mock.lockDeleteSearchJob.Lock() + mock.calls.DeleteSearchJob = append(mock.calls.DeleteSearchJob, callInfo) + mock.lockDeleteSearchJob.Unlock() + if mock.DeleteSearchJobFunc == nil { var ( errOut error ) return errOut } - return mock.DeleteDocumentSearchJobFunc(ctx, id) + return mock.DeleteSearchJobFunc(ctx, id, version) } -// DeleteDocumentSearchJobCalls gets all the calls that were made to DeleteDocumentSearchJob. +// DeleteSearchJobCalls gets all the calls that were made to DeleteSearchJob. // Check the length with: // -// len(mockedDB.DeleteDocumentSearchJobCalls()) -func (mock *DBMock) DeleteDocumentSearchJobCalls() []struct { - Ctx context.Context - ID int64 +// len(mockedDB.DeleteSearchJobCalls()) +func (mock *DBMock) DeleteSearchJobCalls() []struct { + Ctx context.Context + ID int64 + Version int64 } { var calls []struct { - Ctx context.Context - ID int64 + Ctx context.Context + ID int64 + Version int64 } - mock.lockDeleteDocumentSearchJob.RLock() - calls = mock.calls.DeleteDocumentSearchJob - mock.lockDeleteDocumentSearchJob.RUnlock() + mock.lockDeleteSearchJob.RLock() + calls = mock.calls.DeleteSearchJob + mock.lockDeleteSearchJob.RUnlock() return calls } -// FetchDocumentSearchJobs calls FetchDocumentSearchJobsFunc. -func (mock *DBMock) FetchDocumentSearchJobs(ctx context.Context, offsetID int64, limit int64) ([]search.DocumentSearchJob, error) { +// FetchDocumentBranchesUnsafe calls FetchDocumentBranchesUnsafeFunc. +func (mock *DBMock) FetchDocumentBranchesUnsafe(ctx context.Context, docID xid.ID) ([]document.BranchSummary, error) { + callInfo := struct { + Ctx context.Context + DocID xid.ID + }{ + Ctx: ctx, + DocID: docID, + } + mock.lockFetchDocumentBranchesUnsafe.Lock() + mock.calls.FetchDocumentBranchesUnsafe = append(mock.calls.FetchDocumentBranchesUnsafe, callInfo) + mock.lockFetchDocumentBranchesUnsafe.Unlock() + if mock.FetchDocumentBranchesUnsafeFunc == nil { + var ( + out0 []document.BranchSummary + errOut error + ) + return out0, errOut + } + return mock.FetchDocumentBranchesUnsafeFunc(ctx, docID) +} + +// FetchDocumentBranchesUnsafeCalls gets all the calls that were made to FetchDocumentBranchesUnsafe. +// Check the length with: +// +// len(mockedDB.FetchDocumentBranchesUnsafeCalls()) +func (mock *DBMock) FetchDocumentBranchesUnsafeCalls() []struct { + Ctx context.Context + DocID xid.ID +} { + var calls []struct { + Ctx context.Context + DocID xid.ID + } + mock.lockFetchDocumentBranchesUnsafe.RLock() + calls = mock.calls.FetchDocumentBranchesUnsafe + mock.lockFetchDocumentBranchesUnsafe.RUnlock() + return calls +} + +// FetchDocumentUnsafeByBranchID calls FetchDocumentUnsafeByBranchIDFunc. +func (mock *DBMock) FetchDocumentUnsafeByBranchID(ctx context.Context, branchID xid.ID) (*document.Document, error) { + callInfo := struct { + Ctx context.Context + BranchID xid.ID + }{ + Ctx: ctx, + BranchID: branchID, + } + mock.lockFetchDocumentUnsafeByBranchID.Lock() + mock.calls.FetchDocumentUnsafeByBranchID = append(mock.calls.FetchDocumentUnsafeByBranchID, callInfo) + mock.lockFetchDocumentUnsafeByBranchID.Unlock() + if mock.FetchDocumentUnsafeByBranchIDFunc == nil { + var ( + out0 *document.Document + errOut error + ) + return out0, errOut + } + return mock.FetchDocumentUnsafeByBranchIDFunc(ctx, branchID) +} + +// FetchDocumentUnsafeByBranchIDCalls gets all the calls that were made to FetchDocumentUnsafeByBranchID. +// Check the length with: +// +// len(mockedDB.FetchDocumentUnsafeByBranchIDCalls()) +func (mock *DBMock) FetchDocumentUnsafeByBranchIDCalls() []struct { + Ctx context.Context + BranchID xid.ID +} { + var calls []struct { + Ctx context.Context + BranchID xid.ID + } + mock.lockFetchDocumentUnsafeByBranchID.RLock() + calls = mock.calls.FetchDocumentUnsafeByBranchID + mock.lockFetchDocumentUnsafeByBranchID.RUnlock() + return calls +} + +// FetchSearchJobs calls FetchSearchJobsFunc. +func (mock *DBMock) FetchSearchJobs(ctx context.Context, offsetID int64, limit int64) ([]search.Job, error) { callInfo := struct { Ctx context.Context OffsetID int64 @@ -112,24 +227,24 @@ func (mock *DBMock) FetchDocumentSearchJobs(ctx context.Context, offsetID int64, OffsetID: offsetID, Limit: limit, } - mock.lockFetchDocumentSearchJobs.Lock() - mock.calls.FetchDocumentSearchJobs = append(mock.calls.FetchDocumentSearchJobs, callInfo) - mock.lockFetchDocumentSearchJobs.Unlock() - if mock.FetchDocumentSearchJobsFunc == nil { + mock.lockFetchSearchJobs.Lock() + mock.calls.FetchSearchJobs = append(mock.calls.FetchSearchJobs, callInfo) + mock.lockFetchSearchJobs.Unlock() + if mock.FetchSearchJobsFunc == nil { var ( - documentSearchJobsOut []search.DocumentSearchJob - errOut error + out0 []search.Job + errOut error ) - return documentSearchJobsOut, errOut + return out0, errOut } - return mock.FetchDocumentSearchJobsFunc(ctx, offsetID, limit) + return mock.FetchSearchJobsFunc(ctx, offsetID, limit) } -// FetchDocumentSearchJobsCalls gets all the calls that were made to FetchDocumentSearchJobs. +// FetchSearchJobsCalls gets all the calls that were made to FetchSearchJobs. // Check the length with: // -// len(mockedDB.FetchDocumentSearchJobsCalls()) -func (mock *DBMock) FetchDocumentSearchJobsCalls() []struct { +// len(mockedDB.FetchSearchJobsCalls()) +func (mock *DBMock) FetchSearchJobsCalls() []struct { Ctx context.Context OffsetID int64 Limit int64 @@ -139,8 +254,8 @@ func (mock *DBMock) FetchDocumentSearchJobsCalls() []struct { OffsetID int64 Limit int64 } - mock.lockFetchDocumentSearchJobs.RLock() - calls = mock.calls.FetchDocumentSearchJobs - mock.lockFetchDocumentSearchJobs.RUnlock() + mock.lockFetchSearchJobs.RLock() + calls = mock.calls.FetchSearchJobs + mock.lockFetchSearchJobs.RUnlock() return calls } diff --git a/server/core/internal/search/manager/0mock_index_test.go b/server/core/internal/search/manager/0mock_index_test.go new file mode 100644 index 00000000..1b5d8af3 --- /dev/null +++ b/server/core/internal/search/manager/0mock_index_test.go @@ -0,0 +1,251 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package manager + +import ( + "context" + "github.com/oxynote/oxynote/server/core/internal/search" + "github.com/rs/xid" + "sync" +) + +// Ensure, that IndexMock does implement Index. +// If this is not the case, regenerate this file with moq. +var _ Index = &IndexMock{} + +// IndexMock is a mock implementation of Index. +// +// func TestSomethingThatUsesIndex(t *testing.T) { +// +// // make and configure a mocked Index +// mockedIndex := &IndexMock{ +// DeleteBranchFunc: func(ctx context.Context, branchID xid.ID) error { +// panic("mock out the DeleteBranch method") +// }, +// DeleteDocumentFunc: func(ctx context.Context, documentID xid.ID) error { +// panic("mock out the DeleteDocument method") +// }, +// DeleteOrganizationFunc: func(ctx context.Context, organizationID string) error { +// panic("mock out the DeleteOrganization method") +// }, +// ReplaceBranchFunc: func(ctx context.Context, branchID xid.ID, entries map[string]search.Block) error { +// panic("mock out the ReplaceBranch method") +// }, +// } +// +// // use mockedIndex in code that requires Index +// // and then make assertions. +// +// } +type IndexMock struct { + // DeleteBranchFunc mocks the DeleteBranch method. + DeleteBranchFunc func(ctx context.Context, branchID xid.ID) error + + // DeleteDocumentFunc mocks the DeleteDocument method. + DeleteDocumentFunc func(ctx context.Context, documentID xid.ID) error + + // DeleteOrganizationFunc mocks the DeleteOrganization method. + DeleteOrganizationFunc func(ctx context.Context, organizationID string) error + + // ReplaceBranchFunc mocks the ReplaceBranch method. + ReplaceBranchFunc func(ctx context.Context, branchID xid.ID, entries map[string]search.Block) error + + // calls tracks calls to the methods. + calls struct { + // DeleteBranch holds details about calls to the DeleteBranch method. + DeleteBranch []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // BranchID is the branchID argument value. + BranchID xid.ID + } + // DeleteDocument holds details about calls to the DeleteDocument method. + DeleteDocument []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // DocumentID is the documentID argument value. + DocumentID xid.ID + } + // DeleteOrganization holds details about calls to the DeleteOrganization method. + DeleteOrganization []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // OrganizationID is the organizationID argument value. + OrganizationID string + } + // ReplaceBranch holds details about calls to the ReplaceBranch method. + ReplaceBranch []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // BranchID is the branchID argument value. + BranchID xid.ID + // Entries is the entries argument value. + Entries map[string]search.Block + } + } + lockDeleteBranch sync.RWMutex + lockDeleteDocument sync.RWMutex + lockDeleteOrganization sync.RWMutex + lockReplaceBranch sync.RWMutex +} + +// DeleteBranch calls DeleteBranchFunc. +func (mock *IndexMock) DeleteBranch(ctx context.Context, branchID xid.ID) error { + callInfo := struct { + Ctx context.Context + BranchID xid.ID + }{ + Ctx: ctx, + BranchID: branchID, + } + mock.lockDeleteBranch.Lock() + mock.calls.DeleteBranch = append(mock.calls.DeleteBranch, callInfo) + mock.lockDeleteBranch.Unlock() + if mock.DeleteBranchFunc == nil { + var ( + errOut error + ) + return errOut + } + return mock.DeleteBranchFunc(ctx, branchID) +} + +// DeleteBranchCalls gets all the calls that were made to DeleteBranch. +// Check the length with: +// +// len(mockedIndex.DeleteBranchCalls()) +func (mock *IndexMock) DeleteBranchCalls() []struct { + Ctx context.Context + BranchID xid.ID +} { + var calls []struct { + Ctx context.Context + BranchID xid.ID + } + mock.lockDeleteBranch.RLock() + calls = mock.calls.DeleteBranch + mock.lockDeleteBranch.RUnlock() + return calls +} + +// DeleteDocument calls DeleteDocumentFunc. +func (mock *IndexMock) DeleteDocument(ctx context.Context, documentID xid.ID) error { + callInfo := struct { + Ctx context.Context + DocumentID xid.ID + }{ + Ctx: ctx, + DocumentID: documentID, + } + mock.lockDeleteDocument.Lock() + mock.calls.DeleteDocument = append(mock.calls.DeleteDocument, callInfo) + mock.lockDeleteDocument.Unlock() + if mock.DeleteDocumentFunc == nil { + var ( + errOut error + ) + return errOut + } + return mock.DeleteDocumentFunc(ctx, documentID) +} + +// DeleteDocumentCalls gets all the calls that were made to DeleteDocument. +// Check the length with: +// +// len(mockedIndex.DeleteDocumentCalls()) +func (mock *IndexMock) DeleteDocumentCalls() []struct { + Ctx context.Context + DocumentID xid.ID +} { + var calls []struct { + Ctx context.Context + DocumentID xid.ID + } + mock.lockDeleteDocument.RLock() + calls = mock.calls.DeleteDocument + mock.lockDeleteDocument.RUnlock() + return calls +} + +// DeleteOrganization calls DeleteOrganizationFunc. +func (mock *IndexMock) DeleteOrganization(ctx context.Context, organizationID string) error { + callInfo := struct { + Ctx context.Context + OrganizationID string + }{ + Ctx: ctx, + OrganizationID: organizationID, + } + mock.lockDeleteOrganization.Lock() + mock.calls.DeleteOrganization = append(mock.calls.DeleteOrganization, callInfo) + mock.lockDeleteOrganization.Unlock() + if mock.DeleteOrganizationFunc == nil { + var ( + errOut error + ) + return errOut + } + return mock.DeleteOrganizationFunc(ctx, organizationID) +} + +// DeleteOrganizationCalls gets all the calls that were made to DeleteOrganization. +// Check the length with: +// +// len(mockedIndex.DeleteOrganizationCalls()) +func (mock *IndexMock) DeleteOrganizationCalls() []struct { + Ctx context.Context + OrganizationID string +} { + var calls []struct { + Ctx context.Context + OrganizationID string + } + mock.lockDeleteOrganization.RLock() + calls = mock.calls.DeleteOrganization + mock.lockDeleteOrganization.RUnlock() + return calls +} + +// ReplaceBranch calls ReplaceBranchFunc. +func (mock *IndexMock) ReplaceBranch(ctx context.Context, branchID xid.ID, entries map[string]search.Block) error { + callInfo := struct { + Ctx context.Context + BranchID xid.ID + Entries map[string]search.Block + }{ + Ctx: ctx, + BranchID: branchID, + Entries: entries, + } + mock.lockReplaceBranch.Lock() + mock.calls.ReplaceBranch = append(mock.calls.ReplaceBranch, callInfo) + mock.lockReplaceBranch.Unlock() + if mock.ReplaceBranchFunc == nil { + var ( + errOut error + ) + return errOut + } + return mock.ReplaceBranchFunc(ctx, branchID, entries) +} + +// ReplaceBranchCalls gets all the calls that were made to ReplaceBranch. +// Check the length with: +// +// len(mockedIndex.ReplaceBranchCalls()) +func (mock *IndexMock) ReplaceBranchCalls() []struct { + Ctx context.Context + BranchID xid.ID + Entries map[string]search.Block +} { + var calls []struct { + Ctx context.Context + BranchID xid.ID + Entries map[string]search.Block + } + mock.lockReplaceBranch.RLock() + calls = mock.calls.ReplaceBranch + mock.lockReplaceBranch.RUnlock() + return calls +} diff --git a/server/core/internal/search/manager/0mock_search_gateway_test.go b/server/core/internal/search/manager/0mock_search_gateway_test.go deleted file mode 100644 index c9b7c23a..00000000 --- a/server/core/internal/search/manager/0mock_search_gateway_test.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package manager - -import ( - "context" - "sync" - - "github.com/oxynote/oxynote/server/core/internal/search" -) - -// Ensure, that SearchGatewayMock does implement SearchGateway. -// If this is not the case, regenerate this file with moq. -var _ SearchGateway = &SearchGatewayMock{} - -// SearchGatewayMock is a mock implementation of SearchGateway. -// -// func TestSomethingThatUsesSearchGateway(t *testing.T) { -// -// // make and configure a mocked SearchGateway -// mockedSearchGateway := &SearchGatewayMock{ -// ReplaceDocumentBlocksFunc: func(ctx context.Context, bd search.BlocksDifference) error { -// panic("mock out the ReplaceDocumentBlocks method") -// }, -// } -// -// // use mockedSearchGateway in code that requires SearchGateway -// // and then make assertions. -// -// } -type SearchGatewayMock struct { - // ReplaceDocumentBlocksFunc mocks the ReplaceDocumentBlocks method. - ReplaceDocumentBlocksFunc func(ctx context.Context, bd search.BlocksDifference) error - - // calls tracks calls to the methods. - calls struct { - // ReplaceDocumentBlocks holds details about calls to the ReplaceDocumentBlocks method. - ReplaceDocumentBlocks []struct { - // Ctx is the ctx argument value. - Ctx context.Context - // Bd is the bd argument value. - Bd search.BlocksDifference - } - } - lockReplaceDocumentBlocks sync.RWMutex -} - -// ReplaceDocumentBlocks calls ReplaceDocumentBlocksFunc. -func (mock *SearchGatewayMock) ReplaceDocumentBlocks(ctx context.Context, bd search.BlocksDifference) error { - callInfo := struct { - Ctx context.Context - Bd search.BlocksDifference - }{ - Ctx: ctx, - Bd: bd, - } - mock.lockReplaceDocumentBlocks.Lock() - mock.calls.ReplaceDocumentBlocks = append(mock.calls.ReplaceDocumentBlocks, callInfo) - mock.lockReplaceDocumentBlocks.Unlock() - if mock.ReplaceDocumentBlocksFunc == nil { - var ( - errOut error - ) - return errOut - } - return mock.ReplaceDocumentBlocksFunc(ctx, bd) -} - -// ReplaceDocumentBlocksCalls gets all the calls that were made to ReplaceDocumentBlocks. -// Check the length with: -// -// len(mockedSearchGateway.ReplaceDocumentBlocksCalls()) -func (mock *SearchGatewayMock) ReplaceDocumentBlocksCalls() []struct { - Ctx context.Context - Bd search.BlocksDifference -} { - var calls []struct { - Ctx context.Context - Bd search.BlocksDifference - } - mock.lockReplaceDocumentBlocks.RLock() - calls = mock.calls.ReplaceDocumentBlocks - mock.lockReplaceDocumentBlocks.RUnlock() - return calls -} diff --git a/server/core/internal/search/manager/manager.go b/server/core/internal/search/manager/manager.go index b6e8fe07..38e3fca4 100644 --- a/server/core/internal/search/manager/manager.go +++ b/server/core/internal/search/manager/manager.go @@ -1,4 +1,4 @@ -// Package manager runs the background document search-indexing jobs. +// Package manager runs the background search-indexing jobs. package manager import ( @@ -7,219 +7,205 @@ import ( "log/slog" "time" + "github.com/oxynote/oxynote/server/core/internal/document" "github.com/oxynote/oxynote/server/core/internal/search" + "github.com/oxynote/oxynote/server/core/pkg/errutil" "github.com/oxynote/oxynote/server/core/pkg/logutil" "github.com/oxynote/oxynote/server/core/pkg/timeutil" "github.com/rs/xid" ) const ( - // _processingBatch defines how many search jobs to process in one batch. + // _processingBatch defines how many search jobs to fetch in one batch. _processingBatch = 100 - // _processingInterval defines how often to process search jobs. + // _processingInterval defines how often queued jobs are processed + // when no nudge arrives, which covers jobs queued before a restart. _processingInterval = time.Second * 10 ) -// Manager manages document search index update jobs. +// Manager applies search jobs: for every queued scope it reads the +// current rows and makes the index match them. type Manager struct { - log *slog.Logger - db DB - searchGateway SearchGateway + log *slog.Logger + db DB + index Index + pe *timeutil.PeriodicExec } -// NewManager creates a new Manager with the given database and search gateway. -func NewManager(log *slog.Logger, db DB, searchGateway SearchGateway) *Manager { - return &Manager{ - log: log.With("component", "document-search-job-manager"), - db: db, - searchGateway: searchGateway, +// NewManager creates a new Manager with the given database and index. +func NewManager(log *slog.Logger, db DB, index Index) *Manager { + m := &Manager{ + log: log.With("component", "search-job-manager"), + db: db, + index: index, } + + m.pe = timeutil.NewPeriodicExec( + _processingInterval, + 0, + m.run, + logutil.RecoveryValue(m.log, logutil.NewRecoveryPlan("recovered from a panic while processing search jobs")), + true, + ) + + return m } -// Start begins the periodic processing of document search jobs. +// Start processes the queued jobs right away, then again on every trigger +// and on the periodic interval, until the context ends. func (m *Manager) Start(ctx context.Context) { m.log.Info("starting") defer m.log.Info("stopped") - timeutil.NewPeriodicExec( - _processingInterval, - 0, - func(ctx context.Context) { - if err := m.processJobs(ctx); err != nil { - m.log.With("error", err). - Error("processing document search jobs") - } - }, - logutil.RecoveryValue(m.log, logutil.NewRecoveryPlan("recovered from a panic while processing document search jobs")), - true, - ).Start(ctx) + m.pe.Start(ctx) } -// processJobs processes document search jobs in a paginated manner. Failed -// jobs stay in the database and are retried on the next processing interval, -// together with every later job of the same document: a diff describes a -// change against the state its predecessors left behind, so applying one out -// of order resurrects blocks a newer diff removed. +// Trigger runs a pass right away. A job producer calls it once the job's +// transaction has committed, so the index follows a change without +// waiting for the periodic pass. +func (m *Manager) Trigger() { + m.pe.Trigger() +} + +// run processes the queued jobs once, reporting a failed pass. +func (m *Manager) run(ctx context.Context) { + if err := m.processJobs(ctx); err != nil { + m.log.With("error", err). + Error("processing search jobs") + } +} + +// processJobs applies the queued jobs in a paginated manner. A job that +// fails stays in the database for the next pass; the jobs after it are +// unaffected, since every job describes a scope's current state rather +// than a change against its predecessors. func (m *Manager) processJobs(ctx context.Context) error { - var ( - offsetID int64 - held = newHoldSet() - ) + var offsetID int64 for { if err := ctx.Err(); err != nil { return err } - jobs, err := m.db.FetchDocumentSearchJobs(ctx, offsetID, _processingBatch) + jobs, err := m.db.FetchSearchJobs(ctx, offsetID, _processingBatch) if err != nil { - return fmt.Errorf("fetching paginated document search jobs: %w", err) + return fmt.Errorf("fetching paginated search jobs: %w", err) } for _, job := range jobs { offsetID = job.ID - documentIDs, global := jobScope(job.BlockDiff) - - if held.blocks(documentIDs, global) { - held.hold(documentIDs, global) + if err := m.apply(ctx, job); err != nil { + m.log.With("job_id", job.ID). + With("error", err). + Error("applying search job") continue } - err := m.searchGateway.ReplaceDocumentBlocks(ctx, job.BlockDiff) - if err != nil { + // a job queued again meanwhile carries a newer version, so the + // delete leaves it for the next pass. + if err := m.db.DeleteSearchJob(ctx, job.ID, job.Version); err != nil { m.log.With("job_id", job.ID). With("error", err). - Error("processing document search job") - - held.hold(documentIDs, global) - - continue - } - - err = m.db.DeleteDocumentSearchJob(ctx, job.ID) - if err != nil { - m.log.With("job_id", job.ID). - With("error", err). - Error("deleting document search job") - - // the diff is applied but the job survives, so it runs again - // next interval — after anything newer, unless held. - held.hold(documentIDs, global) + Error("deleting search job") } } if len(jobs) < _processingBatch { - break + return nil + } + } +} + +// apply brings the job's scope in line with the database. +func (m *Manager) apply(ctx context.Context, job search.Job) error { + switch { + case job.BranchID.Valid: + return m.syncBranch(ctx, job.BranchID.V) + case job.DocumentID.Valid: + return m.syncDocument(ctx, job.DocumentID.V) + default: + // an organization is queued only by its teardown, which runs + // while its rows still exist, so there is nothing to compare + // against: the scope is always a removal. + return m.index.DeleteOrganization(ctx, job.OrganizationID) + } +} + +// syncBranch replaces the branch's entries with what the database holds, +// or removes them when the branch is gone. +func (m *Manager) syncBranch(ctx context.Context, branchID xid.ID) error { + doc, err := m.db.FetchDocumentUnsafeByBranchID(ctx, branchID) + if err != nil { + if errutil.IsNotFound(err) { + return m.index.DeleteBranch(ctx, branchID) + } + + return fmt.Errorf("fetching branch %s: %w", branchID, err) + } + + return m.index.ReplaceBranch(ctx, branchID, search.Entries(*doc)) +} + +// syncDocument syncs every branch of the document, or removes the +// document's entries when it has none left. +func (m *Manager) syncDocument(ctx context.Context, documentID xid.ID) error { + branches, err := m.db.FetchDocumentBranchesUnsafe(ctx, documentID) + if err != nil { + return fmt.Errorf("fetching branches of document %s: %w", documentID, err) + } + + if len(branches) == 0 { + return m.index.DeleteDocument(ctx, documentID) + } + + for _, b := range branches { + if err := m.syncBranch(ctx, b.BranchID); err != nil { + return err } } return nil } -// jobScope reports the documents a difference touches. An organization -// removal is global: it clears the entries of every document the -// organization owns, which no per-document bound can enumerate. -func jobScope(bd search.BlocksDifference) (documentIDs []xid.ID, global bool) { - if len(bd.RemovedOrganizations) > 0 { - return nil, true - } - - seen := make(map[xid.ID]struct{}) - - add := func(id xid.ID) { - if _, ok := seen[id]; ok { - return - } - - seen[id] = struct{}{} - - documentIDs = append(documentIDs, id) - } - - for _, blocks := range [][]search.Block{bd.Added, bd.Updated, bd.Removed} { - for _, b := range blocks { - add(b.DocumentID) - } - } - - for _, br := range bd.RemovedBranches { - add(br.DocumentID) - } - - for _, id := range bd.RemovedDocuments { - add(id) - } - - return documentIDs, false -} - -// holdSet tracks the documents whose diffs have to wait for the next -// interval, in the order-preserving sense: once one diff of a document is -// held back, every later one is held with it. -type holdSet struct { - documentIDs map[xid.ID]struct{} - all bool -} - -// newHoldSet creates an empty hold set. -func newHoldSet() *holdSet { - return &holdSet{documentIDs: make(map[xid.ID]struct{})} -} - -// blocks reports whether a difference of the given scope has to wait. -func (h *holdSet) blocks(documentIDs []xid.ID, global bool) bool { - if h.all { - return true - } - - // a global difference covers documents this run knows nothing about, so - // anything held at all can be one of them. - if global { - return len(h.documentIDs) > 0 - } - - for _, id := range documentIDs { - if _, ok := h.documentIDs[id]; ok { - return true - } - } - - return false -} - -// hold makes every later difference of the same scope wait too. -func (h *holdSet) hold(documentIDs []xid.ID, global bool) { - if global { - h.all = true - - return - } - - for _, id := range documentIDs { - h.documentIDs[id] = struct{}{} - } -} - // DB defines the database operations required by the Manager. // //go:generate ../../../scripts/codegen/mock -t internal DB db type DB interface { - // FetchDocumentSearchJobs should retrieve a batch of document search - // jobs with IDs greater than the given offset ID, limited to the - // specified number of jobs. - FetchDocumentSearchJobs(ctx context.Context, offsetID, limit int64) ([]search.DocumentSearchJob, error) + // FetchSearchJobs should retrieve a batch of search jobs with IDs + // greater than the given offset ID, limited to the specified number + // of jobs. + FetchSearchJobs(ctx context.Context, offsetID, limit int64) ([]search.Job, error) - // DeleteDocumentSearchJob should delete the given document search job from the database. - DeleteDocumentSearchJob(ctx context.Context, id int64) error + // DeleteSearchJob should delete the search job when it is still at + // the given version. + DeleteSearchJob(ctx context.Context, id, version int64) error + + // FetchDocumentUnsafeByBranchID should fetch the document joined + // against the branch, across organizations. + FetchDocumentUnsafeByBranchID(ctx context.Context, branchID xid.ID) (*document.Document, error) + + // FetchDocumentBranchesUnsafe should fetch the document's branches, + // across organizations. + FetchDocumentBranchesUnsafe(ctx context.Context, docID xid.ID) ([]document.BranchSummary, error) } -// SearchGateway defines the search operations required by the Manager. +// Index defines the index operations required by the Manager. // -//go:generate ../../../scripts/codegen/mock -t internal SearchGateway search_gateway -type SearchGateway interface { - // ReplaceDocumentBlocks should replace document blocks based on the provided differences. - ReplaceDocumentBlocks(ctx context.Context, bd search.BlocksDifference) error +//go:generate ../../../scripts/codegen/mock -t internal Index index +type Index interface { + // ReplaceBranch should make the branch's entries exactly the given + // ones. + ReplaceBranch(ctx context.Context, branchID xid.ID, entries map[string]search.Block) error + + // DeleteBranch should remove every entry of the branch. + DeleteBranch(ctx context.Context, branchID xid.ID) error + + // DeleteDocument should remove every entry of the document. + DeleteDocument(ctx context.Context, documentID xid.ID) error + + // DeleteOrganization should remove every entry of the organization. + DeleteOrganization(ctx context.Context, organizationID string) error } diff --git a/server/core/internal/search/manager/manager_test.go b/server/core/internal/search/manager/manager_test.go index 5ffa2c61..3bca3237 100644 --- a/server/core/internal/search/manager/manager_test.go +++ b/server/core/internal/search/manager/manager_test.go @@ -2,85 +2,162 @@ package manager import ( "context" + "database/sql" "log/slog" - "strconv" + "path/filepath" "testing" + "github.com/oxynote/oxynote/server/core/internal/document" "github.com/oxynote/oxynote/server/core/internal/search" + "github.com/oxynote/oxynote/server/core/pkg/testutil" "github.com/rs/xid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" ) -// jobs builds n sequential search jobs with IDs starting at start. -func jobs(start, n int) []search.DocumentSearchJob { - jj := make([]search.DocumentSearchJob, 0, n) +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m, testutil.IgnoreBleveWorkers()) +} + +// jobs builds n sequential branch-scope jobs with IDs starting at start. +func jobs(start, n int) []search.Job { + jj := make([]search.Job, 0, n) for i := range n { - jj = append(jj, search.DocumentSearchJob{ID: int64(start + i)}) + job := search.BranchScope("org-1", xid.New(), xid.New()) + job.ID = int64(start + i) + job.Version = 1 + + jj = append(jj, job) } return jj } -// docJob builds a job whose difference touches the given document. -func docJob(id int64, documentID xid.ID) search.DocumentSearchJob { - return search.DocumentSearchJob{ - ID: id, - BlockDiff: search.BlocksDifference{ - Added: []search.Block{{ID: "b" + strconv.FormatInt(id, 10), DocumentID: documentID}}, +// stubDocument builds a default-branch document with one paragraph. +func stubDocument(branchID xid.ID) *document.Document { + return &document.Document{ + ID: xid.New(), + OrganizationID: "org-1", + BranchID: branchID, + BranchName: document.DefaultBranch, + DocumentName: "Runbook", + Content: document.RootBlock{ + Type: document.BlockNodeDoc, + Content: []document.Block{ + { + Type: document.BlockNodeParagraph, + Attrs: document.Attributes{"uid": "p1"}, + Content: []document.Block{ + {Type: document.BlockNodeText, Text: "hello"}, + }, + }, + }, }, + Default: true, } } +// emptySource is a search.Source with no branches. +type emptySource struct{} + +func (emptySource) FetchDocumentBranchesAfter(context.Context, xid.ID, int) ([]document.Document, error) { + return nil, nil +} + func Test_NewManager(t *testing.T) { t.Parallel() - man := NewManager(slog.New(slog.DiscardHandler), &DBMock{}, &SearchGatewayMock{}) + man := NewManager(slog.New(slog.DiscardHandler), &DBMock{}, &IndexMock{}) require.NotNil(t, man) + assert.NotNil(t, man.log) + assert.NotNil(t, man.db) + assert.NotNil(t, man.index) + assert.NotNil(t, man.pe) } func Test_Manager_Start(t *testing.T) { t.Parallel() - fetched := make(chan struct{}) - ctx, cancel := context.WithCancel(context.Background()) defer cancel() + fetches := 0 + + var man *Manager + + // the first pass runs at once; a trigger brings the second, which ends + // the run. db := &DBMock{ - FetchDocumentSearchJobsFunc: func(context.Context, int64, int64) ([]search.DocumentSearchJob, error) { - close(fetched) - cancel() + FetchSearchJobsFunc: func(context.Context, int64, int64) ([]search.Job, error) { + fetches++ + + switch fetches { + case 1: + man.Trigger() + case 2: + cancel() + } return nil, nil }, } + man = NewManager(slog.New(slog.DiscardHandler), db, &IndexMock{}) + stopped := make(chan struct{}) go func() { defer close(stopped) - NewManager(slog.New(slog.DiscardHandler), db, &SearchGatewayMock{}).Start(ctx) + man.Start(ctx) }() - <-fetched <-stopped - assert.Len(t, db.FetchDocumentSearchJobsCalls(), 1) + assert.Len(t, db.FetchSearchJobsCalls(), 2) +} + +func Test_Manager_Trigger(t *testing.T) { + t.Parallel() + + man := NewManager(slog.New(slog.DiscardHandler), &DBMock{}, &IndexMock{}) + + // repeated triggers never block; the executor's own tests cover the + // coalescing. + assert.NotPanics(t, func() { + man.Trigger() + man.Trigger() + }) +} + +func Test_Manager_run(t *testing.T) { + t.Parallel() + + // an error is logged and swallowed + db := &DBMock{ + FetchSearchJobsFunc: func(context.Context, int64, int64) ([]search.Job, error) { + return nil, assert.AnError + }, + } + + man := NewManager(slog.New(slog.DiscardHandler), db, &IndexMock{}) + + assert.NotPanics(t, func() { man.run(context.Background()) }) + assert.Len(t, db.FetchSearchJobsCalls(), 1) } func Test_Manager_processJobs(t *testing.T) { t.Parallel() - type check func(*testing.T, *DBMock, *SearchGatewayMock, error) + type check func(*testing.T, *DBMock, *IndexMock, error) checks := func(cc ...check) []check { return cc } hasError := func(expect bool) check { - return func(t *testing.T, _ *DBMock, _ *SearchGatewayMock, err error) { + return func(t *testing.T, _ *DBMock, _ *IndexMock, err error) { if expect { require.Error(t, err) return @@ -91,29 +168,26 @@ func Test_Manager_processJobs(t *testing.T) { } wasReplaceCalled := func(count int) check { - return func(t *testing.T, _ *DBMock, gw *SearchGatewayMock, _ error) { - require.Len(t, gw.ReplaceDocumentBlocksCalls(), count) + return func(t *testing.T, _ *DBMock, idx *IndexMock, _ error) { + require.Len(t, idx.ReplaceBranchCalls(), count) } } wasDeleteCalled := func(count int) check { - return func(t *testing.T, db *DBMock, _ *SearchGatewayMock, _ error) { - require.Len(t, db.DeleteDocumentSearchJobCalls(), count) + return func(t *testing.T, db *DBMock, _ *IndexMock, _ error) { + require.Len(t, db.DeleteSearchJobCalls(), count) } } - docA, docB := xid.New(), xid.New() - isCancelled := func() check { - return func(t *testing.T, _ *DBMock, _ *SearchGatewayMock, err error) { - assert.ErrorIs(t, err, context.Canceled) + return func(t *testing.T, _ *DBMock, _ *IndexMock, err error) { + assert.Equal(t, context.Canceled, err) } } - tests := map[string]struct { - Batches [][]search.DocumentSearchJob + cc := map[string]struct { + Batches [][]search.Job CancelledContext bool - ReplaceErr error FailJobs map[int64]bool DeleteErr error Checks []check @@ -125,143 +199,73 @@ func Test_Manager_processJobs(t *testing.T) { wasReplaceCalled(0), ), }, - "Fetch failure is propagated": { + "Error returned by DB.FetchSearchJobs": { Batches: nil, Checks: checks( hasError(true), wasReplaceCalled(0), ), }, - "Jobs are processed and deleted": { - Batches: [][]search.DocumentSearchJob{jobs(1, 3)}, + "Jobs are applied and deleted at their version": { + Batches: [][]search.Job{jobs(1, 3)}, Checks: checks( hasError(false), wasReplaceCalled(3), wasDeleteCalled(3), + func(t *testing.T, db *DBMock, _ *IndexMock, _ error) { + for i, call := range db.DeleteSearchJobCalls() { + assert.Equal(t, int64(i+1), call.ID) + assert.Equal(t, int64(1), call.Version) + } + }, ), }, "Full batches keep paginating past the last job ID": { - Batches: [][]search.DocumentSearchJob{jobs(1, _processingBatch), jobs(101, 2)}, + Batches: [][]search.Job{jobs(1, _processingBatch), jobs(101, 2)}, Checks: checks( hasError(false), wasReplaceCalled(_processingBatch+2), wasDeleteCalled(_processingBatch+2), - func(t *testing.T, db *DBMock, _ *SearchGatewayMock, _ error) { - ff := db.FetchDocumentSearchJobsCalls() + func(t *testing.T, db *DBMock, _ *IndexMock, _ error) { + ff := db.FetchSearchJobsCalls() require.Len(t, ff, 2) assert.Equal(t, int64(0), ff[0].OffsetID) assert.Equal(t, int64(_processingBatch), ff[1].OffsetID) }, ), }, - "Replace failure keeps the job for the next interval": { - Batches: [][]search.DocumentSearchJob{jobs(1, 2)}, - ReplaceErr: assert.AnError, + "Failed job stays queued and the others still run": { + Batches: [][]search.Job{jobs(1, 3)}, + FailJobs: map[int64]bool{2: true}, Checks: checks( hasError(false), - wasReplaceCalled(2), - wasDeleteCalled(0), + wasReplaceCalled(3), + wasDeleteCalled(2), + func(t *testing.T, db *DBMock, _ *IndexMock, _ error) { + ff := db.DeleteSearchJobCalls() + require.Len(t, ff, 2) + assert.Equal(t, int64(1), ff[0].ID) + assert.Equal(t, int64(3), ff[1].ID) + }, ), }, "Persistently failing full batches advance and terminate": { // the offset moves past failing jobs, so a wall of // failures cannot refetch the same batch forever. - Batches: [][]search.DocumentSearchJob{ + Batches: [][]search.Job{ jobs(1, _processingBatch), jobs(101, _processingBatch), nil, }, - ReplaceErr: assert.AnError, + FailJobs: map[int64]bool{-1: true}, Checks: checks( hasError(false), wasReplaceCalled(2*_processingBatch), wasDeleteCalled(0), ), }, - // a diff is a delta against what the previous ones left, so replaying - // a failed one after a newer one would resurrect what the newer one - // removed — including the blocks of a document that no longer exists. - "A failed job holds the later diffs of its document": { - Batches: [][]search.DocumentSearchJob{{ - docJob(1, docA), - docJob(2, docA), - docJob(3, docA), - }}, - FailJobs: map[int64]bool{1: true}, - Checks: checks( - hasError(false), - wasReplaceCalled(1), - wasDeleteCalled(0), - ), - }, - "A failure holds only its own document": { - Batches: [][]search.DocumentSearchJob{{ - docJob(1, docA), - docJob(2, docB), - docJob(3, docA), - }}, - FailJobs: map[int64]bool{1: true}, - Checks: checks( - hasError(false), - wasReplaceCalled(2), - wasDeleteCalled(1), - func(t *testing.T, db *DBMock, _ *SearchGatewayMock, _ error) { - ff := db.DeleteDocumentSearchJobCalls() - require.Len(t, ff, 1) - assert.Equal(t, int64(2), ff[0].ID, "the other document keeps moving") - }, - ), - }, - "A branch removal waits behind its document's failed diff": { - Batches: [][]search.DocumentSearchJob{{ - docJob(1, docA), - { - ID: 2, - BlockDiff: search.BlocksDifference{ - RemovedBranches: []search.BranchRemoval{{DocumentID: docA, BranchID: xid.New()}}, - }, - }, - { - ID: 3, - BlockDiff: search.BlocksDifference{ - RemovedBranches: []search.BranchRemoval{{DocumentID: docB, BranchID: xid.New()}}, - }, - }, - }}, - FailJobs: map[int64]bool{1: true}, - Checks: checks( - hasError(false), - wasReplaceCalled(2), - wasDeleteCalled(1), - func(t *testing.T, db *DBMock, _ *SearchGatewayMock, _ error) { - ff := db.DeleteDocumentSearchJobCalls() - require.Len(t, ff, 1) - assert.Equal(t, int64(3), ff[0].ID, "the other document's branch removal keeps moving") - }, - ), - }, - "An organization removal waits for anything held": { - Batches: [][]search.DocumentSearchJob{{ - docJob(1, docA), - { - ID: 2, - BlockDiff: search.BlocksDifference{ - RemovedOrganizations: []string{"org-1"}, - }, - }, - docJob(3, docB), - }}, - FailJobs: map[int64]bool{1: true}, - Checks: checks( - hasError(false), - // the organization removal covers documents this run cannot - // enumerate, so everything after it waits as well. - wasReplaceCalled(1), - wasDeleteCalled(0), - ), - }, - "Delete failure still advances the offset": { - Batches: [][]search.DocumentSearchJob{ + "Error returned by DB.DeleteSearchJob still advances": { + Batches: [][]search.Job{ jobs(1, _processingBatch), nil, }, @@ -274,64 +278,377 @@ func Test_Manager_processJobs(t *testing.T) { }, } - for name, tc := range tests { - t.Run(name, func(t *testing.T) { + for cn, c := range cc { + t.Run(cn, func(t *testing.T) { t.Parallel() fetches := 0 db := &DBMock{ - FetchDocumentSearchJobsFunc: func(context.Context, int64, int64) ([]search.DocumentSearchJob, error) { - if fetches >= len(tc.Batches) { - if len(tc.Batches) == 0 { + FetchSearchJobsFunc: func(context.Context, int64, int64) ([]search.Job, error) { + if fetches >= len(c.Batches) { + if len(c.Batches) == 0 { return nil, assert.AnError } t.Fatal("unexpected extra fetch: the pagination did not terminate") } - batch := tc.Batches[fetches] + batch := c.Batches[fetches] fetches++ return batch, nil }, - DeleteDocumentSearchJobFunc: func(context.Context, int64) error { - return tc.DeleteErr + DeleteSearchJobFunc: func(context.Context, int64, int64) error { + return c.DeleteErr + }, + FetchDocumentUnsafeByBranchIDFunc: func(_ context.Context, branchID xid.ID) (*document.Document, error) { + return stubDocument(branchID), nil }, } applied := 0 - gw := &SearchGatewayMock{ - ReplaceDocumentBlocksFunc: func(context.Context, search.BlocksDifference) error { + idx := &IndexMock{ + ReplaceBranchFunc: func(context.Context, xid.ID, map[string]search.Block) error { applied++ - if tc.FailJobs != nil { - // the fixture numbers jobs from one in fetch order. - if tc.FailJobs[int64(applied)] { - return assert.AnError - } - - return nil + // the fixture numbers jobs from one in fetch order; a + // negative key fails every job. + if c.FailJobs[int64(applied)] || c.FailJobs[-1] { + return assert.AnError } - return tc.ReplaceErr + return nil }, } - man := NewManager(slog.New(slog.DiscardHandler), db, gw) + man := NewManager(slog.New(slog.DiscardHandler), db, idx) ctx, cancel := context.WithCancel(context.Background()) defer cancel() - if tc.CancelledContext { + if c.CancelledContext { cancel() } err := man.processJobs(ctx) - for _, ch := range tc.Checks { - ch(t, db, gw, err) + for _, ch := range c.Checks { + ch(t, db, idx, err) + } + }) + } +} + +func Test_Manager_apply(t *testing.T) { + t.Parallel() + + documentID, branchID := xid.New(), xid.New() + + cc := map[string]struct { + Job search.Job + DB *DBMock + Err error + Call func(t *testing.T, idx *IndexMock) + }{ + "Branch scope syncs the branch": { + Job: search.BranchScope("org-1", documentID, branchID), + DB: &DBMock{ + FetchDocumentUnsafeByBranchIDFunc: func(_ context.Context, branchID xid.ID) (*document.Document, error) { + return stubDocument(branchID), nil + }, + }, + Call: func(t *testing.T, idx *IndexMock) { + require.Len(t, idx.ReplaceBranchCalls(), 1) + assert.Equal(t, branchID, idx.ReplaceBranchCalls()[0].BranchID) + }, + }, + "Document scope syncs the document": { + Job: search.DocumentScope("org-1", documentID), + DB: &DBMock{ + FetchDocumentBranchesUnsafeFunc: func(context.Context, xid.ID) ([]document.BranchSummary, error) { + return nil, nil + }, + }, + Call: func(t *testing.T, idx *IndexMock) { + require.Len(t, idx.DeleteDocumentCalls(), 1) + assert.Equal(t, documentID, idx.DeleteDocumentCalls()[0].DocumentID) + }, + }, + "Organization scope removes the organization": { + Job: search.OrganizationScope("org-1"), + DB: &DBMock{}, + Call: func(t *testing.T, idx *IndexMock) { + require.Len(t, idx.DeleteOrganizationCalls(), 1) + assert.Equal(t, "org-1", idx.DeleteOrganizationCalls()[0].OrganizationID) + }, + }, + "Error returned by Index.DeleteOrganization": { + Job: search.OrganizationScope("org-1"), + DB: &DBMock{}, + Err: assert.AnError, + Call: func(t *testing.T, idx *IndexMock) { + require.Len(t, idx.DeleteOrganizationCalls(), 1) + }, + }, + } + + for cn, c := range cc { + t.Run(cn, func(t *testing.T) { + t.Parallel() + + idx := &IndexMock{ + DeleteOrganizationFunc: func(context.Context, string) error { + return c.Err + }, + } + + man := NewManager(slog.New(slog.DiscardHandler), c.DB, idx) + + err := man.apply(context.Background(), c.Job) + + if c.Err != nil { + require.Error(t, err) + } else { + require.NoError(t, err) + } + + c.Call(t, idx) + }) + } + + // applied against a real index, a set of jobs yields the same entries in + // every order, and applying one twice changes nothing. + t.Run("Jobs are order-independent and idempotent", func(t *testing.T) { + t.Parallel() + + kept, gone := stubDocument(xid.New()), stubDocument(xid.New()) + removed := xid.New() + + db := &DBMock{ + FetchDocumentUnsafeByBranchIDFunc: func(_ context.Context, branchID xid.ID) (*document.Document, error) { + if branchID == kept.BranchID { + return kept, nil + } + + return nil, sql.ErrNoRows + }, + FetchDocumentBranchesUnsafeFunc: func(context.Context, xid.ID) ([]document.BranchSummary, error) { + return nil, nil + }, + } + + set := []search.Job{ + search.BranchScope("org-1", kept.ID, kept.BranchID), + search.BranchScope("org-1", gone.ID, gone.BranchID), + search.DocumentScope("org-1", removed), + search.OrganizationScope("org-2"), + } + + orders := [][]int{ + {0, 1, 2, 3}, + {3, 2, 1, 0}, + {1, 0, 3, 2}, + {0, 0, 2, 1, 3, 1}, + } + + var expected []search.Block + + for i, order := range orders { + idx, err := search.Open(context.Background(), slog.New(slog.DiscardHandler), filepath.Join(t.TempDir(), "index"), emptySource{}) + require.NoError(t, err) + + // the branches to remove start out present, so the removals + // have something to do. + require.NoError(t, idx.ReplaceBranch(context.Background(), gone.BranchID, search.Entries(*gone))) + + man := NewManager(slog.New(slog.DiscardHandler), db, idx) + + for _, j := range order { + require.NoError(t, man.apply(context.Background(), set[j])) + } + + blocks, err := idx.SearchDocumentBlocks(context.Background(), "org-1", "hello runbook", 50) + require.NoError(t, err) + require.NoError(t, idx.Close()) + + if i == 0 { + expected = blocks + require.Len(t, expected, 2, "the kept branch's paragraph and name") + + continue + } + + assert.ElementsMatch(t, expected, blocks) + } + }) +} + +func Test_Manager_syncBranch(t *testing.T) { + t.Parallel() + + branchID := xid.New() + + cc := map[string]struct { + FetchErr error + ReplaceErr error + DeleteErr error + Err error + Replaced int + Deleted int + }{ + "Error returned by DB.FetchDocumentUnsafeByBranchID": { + FetchErr: assert.AnError, + Err: assert.AnError, + }, + "Missing branch is removed from the index": { + FetchErr: sql.ErrNoRows, + Deleted: 1, + }, + "Error returned by Index.DeleteBranch": { + FetchErr: sql.ErrNoRows, + DeleteErr: assert.AnError, + Err: assert.AnError, + Deleted: 1, + }, + "Error returned by Index.ReplaceBranch": { + ReplaceErr: assert.AnError, + Err: assert.AnError, + Replaced: 1, + }, + "Branch entries are replaced": { + Replaced: 1, + }, + } + + for cn, c := range cc { + t.Run(cn, func(t *testing.T) { + t.Parallel() + + doc := stubDocument(branchID) + + db := &DBMock{ + FetchDocumentUnsafeByBranchIDFunc: func(context.Context, xid.ID) (*document.Document, error) { + if c.FetchErr != nil { + return nil, c.FetchErr + } + + return doc, nil + }, + } + + idx := &IndexMock{ + ReplaceBranchFunc: func(context.Context, xid.ID, map[string]search.Block) error { + return c.ReplaceErr + }, + DeleteBranchFunc: func(context.Context, xid.ID) error { + return c.DeleteErr + }, + } + + man := NewManager(slog.New(slog.DiscardHandler), db, idx) + + err := man.syncBranch(context.Background(), branchID) + + if c.Err != nil { + require.Error(t, err) + } else { + require.NoError(t, err) + } + + require.Len(t, idx.ReplaceBranchCalls(), c.Replaced) + require.Len(t, idx.DeleteBranchCalls(), c.Deleted) + + if c.Replaced == 1 { + call := idx.ReplaceBranchCalls()[0] + assert.Equal(t, branchID, call.BranchID) + assert.Equal(t, search.Entries(*doc), call.Entries) + } + + if c.Deleted == 1 { + assert.Equal(t, branchID, idx.DeleteBranchCalls()[0].BranchID) + } + }) + } +} + +func Test_Manager_syncDocument(t *testing.T) { + t.Parallel() + + documentID := xid.New() + branches := []document.BranchSummary{{BranchID: xid.New()}, {BranchID: xid.New()}} + + cc := map[string]struct { + Branches []document.BranchSummary + FetchErr error + BranchErr error + DeleteErr error + Err error + Replaced int + DocDeleted int + }{ + "Error returned by DB.FetchDocumentBranchesUnsafe": { + FetchErr: assert.AnError, + Err: assert.AnError, + }, + "Document without branches is removed from the index": { + DocDeleted: 1, + }, + "Error returned by Index.DeleteDocument": { + DeleteErr: assert.AnError, + Err: assert.AnError, + DocDeleted: 1, + }, + "Every branch is synced": { + Branches: branches, + Replaced: 2, + }, + "Error returned by a branch sync": { + Branches: branches, + BranchErr: assert.AnError, + Err: assert.AnError, + Replaced: 1, + }, + } + + for cn, c := range cc { + t.Run(cn, func(t *testing.T) { + t.Parallel() + + db := &DBMock{ + FetchDocumentBranchesUnsafeFunc: func(context.Context, xid.ID) ([]document.BranchSummary, error) { + return c.Branches, c.FetchErr + }, + FetchDocumentUnsafeByBranchIDFunc: func(_ context.Context, branchID xid.ID) (*document.Document, error) { + return stubDocument(branchID), nil + }, + } + + idx := &IndexMock{ + ReplaceBranchFunc: func(context.Context, xid.ID, map[string]search.Block) error { + return c.BranchErr + }, + DeleteDocumentFunc: func(context.Context, xid.ID) error { + return c.DeleteErr + }, + } + + man := NewManager(slog.New(slog.DiscardHandler), db, idx) + + err := man.syncDocument(context.Background(), documentID) + + if c.Err != nil { + require.Error(t, err) + } else { + require.NoError(t, err) + } + + require.Len(t, idx.ReplaceBranchCalls(), c.Replaced) + require.Len(t, idx.DeleteDocumentCalls(), c.DocDeleted) + + if c.DocDeleted == 1 { + assert.Equal(t, documentID, idx.DeleteDocumentCalls()[0].DocumentID) } }) } diff --git a/server/core/internal/search/mapping.go b/server/core/internal/search/mapping.go new file mode 100644 index 00000000..32599382 --- /dev/null +++ b/server/core/internal/search/mapping.go @@ -0,0 +1,137 @@ +package search + +import ( + "fmt" + "sync" + + "github.com/blevesearch/bleve/v2" + "github.com/blevesearch/bleve/v2/analysis/analyzer/custom" + "github.com/blevesearch/bleve/v2/analysis/lang/en" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/mapping" + htmlFormatter "github.com/blevesearch/bleve/v2/search/highlight/format/html" + simpleFragmenter "github.com/blevesearch/bleve/v2/search/highlight/fragmenter/simple" + simpleHighlighter "github.com/blevesearch/bleve/v2/search/highlight/highlighter/simple" + bleveIndex "github.com/blevesearch/bleve_index_api" +) + +// _mappingVersion is stamped into every index built by this binary. Bump it +// whenever the analyzer, the fields, the synonyms file or anything else the +// index stores changes shape: an index carrying another version is rebuilt +// at boot. +const _mappingVersion = "1" + +// _mappingVersionKey is the index-internal key holding the mapping version. +const _mappingVersionKey = "mapping-version" + +// Entry field names, as they appear in Block's JSON. +const ( + _fieldText = "text" + _fieldOrganizationID = "organizationId" + _fieldDocumentID = "documentId" + _fieldBranchID = "branchId" + _fieldBranchName = "branchName" + _fieldBranchDefault = "branchDefault" + _fieldType = "type" +) + +const ( + // _analyzerName is the analyzer the text field and the synonyms share. + _analyzerName = "text" + + // _synonymSource is the synonym source the text field expands through. + _synonymSource = "synonyms" + + // _synonymCollection is the collection the synonym definitions are + // indexed under. + _synonymCollection = "synonyms" + + // _fragmenterName names the fragmenter cropping highlighted text. + _fragmenterName = "crop" + + // _fragmentSize is the number of characters a highlighted fragment + // keeps around the best match. + _fragmentSize = 120 + + // _highlighterName names the highlighter wrapping matches in mark tags. + _highlighterName = "mark" +) + +// _registerHighlighter guards the one-time registration of the highlighter +// in bleve's process-wide registry, which refuses a second definition. +var _registerHighlighter sync.Once + +// newIndexMapping describes the entries: one text field analyzed for +// search, keyword fields to filter and boost on, and the branch name kept +// only for display. +func newIndexMapping() (*mapping.IndexMappingImpl, error) { + im := bleve.NewIndexMapping() + im.ScoringModel = bleveIndex.BM25Scoring + + // no stop-word removal: phrases such as "not found" must stay + // searchable as written. + if err := im.AddCustomAnalyzer(_analyzerName, map[string]any{ + "type": custom.Name, + "tokenizer": unicode.Name, + "token_filters": []any{lowercase.Name, en.SnowballStemmerName}, + }); err != nil { + return nil, fmt.Errorf("adding analyzer: %w", err) + } + + if err := im.AddSynonymSource(_synonymSource, map[string]any{ + "collection": _synonymCollection, + "analyzer": _analyzerName, + }); err != nil { + return nil, fmt.Errorf("adding synonym source: %w", err) + } + + text := bleve.NewTextFieldMapping() + text.Analyzer = _analyzerName + text.SynonymSource = _synonymSource + + name := bleve.NewKeywordFieldMapping() + name.Index = false + + dm := bleve.NewDocumentStaticMapping() + dm.AddFieldMappingsAt(_fieldText, text) + dm.AddFieldMappingsAt(_fieldOrganizationID, bleve.NewKeywordFieldMapping()) + dm.AddFieldMappingsAt(_fieldDocumentID, bleve.NewKeywordFieldMapping()) + dm.AddFieldMappingsAt(_fieldBranchID, bleve.NewKeywordFieldMapping()) + dm.AddFieldMappingsAt(_fieldType, bleve.NewKeywordFieldMapping()) + dm.AddFieldMappingsAt(_fieldBranchDefault, bleve.NewBooleanFieldMapping()) + dm.AddFieldMappingsAt(_fieldBranchName, name) + + im.DefaultMapping = dm + + return im, nil +} + +// registerHighlighter defines the highlighter search results are formatted +// with. bleve keeps highlighters in a process-wide registry, so this runs +// once per process rather than once per index. +func registerHighlighter() error { + var err error + + _registerHighlighter.Do(func() { + _, err = bleve.Config.Cache.DefineFragmenter(_fragmenterName, map[string]any{ + "type": simpleFragmenter.Name, + "size": float64(_fragmentSize), + }) + if err != nil { + err = fmt.Errorf("defining fragmenter: %w", err) + return + } + + _, err = bleve.Config.Cache.DefineHighlighter(_highlighterName, map[string]any{ + "type": simpleHighlighter.Name, + "fragmenter": _fragmenterName, + "formatter": htmlFormatter.Name, + }) + if err != nil { + err = fmt.Errorf("defining highlighter: %w", err) + } + }) + + return err +} diff --git a/server/core/internal/search/mapping_test.go b/server/core/internal/search/mapping_test.go new file mode 100644 index 00000000..55952b54 --- /dev/null +++ b/server/core/internal/search/mapping_test.go @@ -0,0 +1,44 @@ +package search + +import ( + "testing" + + bleveIndex "github.com/blevesearch/bleve_index_api" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func Test_newIndexMapping(t *testing.T) { + t.Parallel() + + im, err := newIndexMapping() + require.NoError(t, err) + require.NotNil(t, im) + + assert.Equal(t, bleveIndex.BM25Scoring, im.ScoringModel) + assert.Equal(t, _analyzerName, im.AnalyzerNameForPath(_fieldText)) + assert.Equal(t, "keyword", im.AnalyzerNameForPath(_fieldOrganizationID)) + assert.Equal(t, "keyword", im.AnalyzerNameForPath(_fieldBranchID)) + assert.Equal(t, "keyword", im.AnalyzerNameForPath(_fieldDocumentID)) + assert.Equal(t, "keyword", im.AnalyzerNameForPath(_fieldType)) + + // the analyzer lowercases and stems without dropping stop words. + tokens := im.AnalyzerNamed(_analyzerName).Analyze([]byte("Not Deploying")) + require.Len(t, tokens, 2) + assert.Equal(t, "not", string(tokens[0].Term)) + assert.Equal(t, "deploy", string(tokens[1].Term)) + + // the branch name is kept for display only. + name := im.DefaultMapping.Properties[_fieldBranchName].Fields[0] + assert.False(t, name.Index) + assert.True(t, name.Store) +} + +func Test_registerHighlighter(t *testing.T) { + t.Parallel() + + // registration happens once per process, so a second call is a no-op + // rather than a duplicate-definition error. + require.NoError(t, registerHighlighter()) + require.NoError(t, registerHighlighter()) +} diff --git a/server/core/internal/search/query.go b/server/core/internal/search/query.go new file mode 100644 index 00000000..2a7a8c69 --- /dev/null +++ b/server/core/internal/search/query.go @@ -0,0 +1,232 @@ +package search + +import ( + "context" + "encoding/json" + "fmt" + "time" + + "github.com/blevesearch/bleve/v2" + bleveSearch "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/query" + "github.com/rs/xid" +) + +const ( + // _searchResultLimit caps the number of hits the search endpoint + // returns. + _searchResultLimit = 30 + + // _searchTimeout bounds one search request. + _searchTimeout = 10 * time.Second + + // _phraseBoost lifts an entry holding the whole query as a phrase + // above one holding the same words scattered. + _phraseBoost = 2 + + // _documentNameBoost lifts an entry carrying a document name. + _documentNameBoost = 3 + + // _headingBoost lifts a heading above the other block types. + _headingBoost = 2 + + // _defaultBranchBoost lifts an entry on the document's default branch + // above the same entry on a fork. + _defaultBranchBoost = 1.5 + + // _maxQueryTerms is how many terms of a query are searched; the rest + // are dropped. Every term costs a dictionary walk for its fuzzy and + // prefix candidates. + _maxQueryTerms = 16 + + // _maxTermSearchers caps the terms one search expands to across its + // whole query tree, fuzzy and prefix candidates included, so a query + // over a large vocabulary fails instead of pinning the process. + _maxTermSearchers = 1024 +) + +// SearchDocuments searches the organization's entries and returns them as +// the search endpoint's JSON: the matched terms wrapped in mark tags and +// the text cropped to a fragment around the best match. +func (i *Index) SearchDocuments(ctx context.Context, organizationID, q string) ([]byte, error) { + blocks, err := i.search(ctx, organizationID, q, _searchResultLimit, true) + if err != nil { + return nil, err + } + + data, err := json.Marshal(blocks) + if err != nil { + return nil, fmt.Errorf("marshaling search results: %w", err) + } + + return data, nil +} + +// SearchDocumentBlocks returns the raw matching blocks for the query, +// scoped to the organization. Unlike SearchDocuments it returns plain +// block values (no highlight markup or cropping) so callers, the AI +// assistant's search tool, can consume the text directly. +func (i *Index) SearchDocumentBlocks(ctx context.Context, organizationID, q string, limit int) ([]Block, error) { + return i.search(ctx, organizationID, q, limit, false) +} + +// search runs the query and decodes the hits. +func (i *Index) search(ctx context.Context, organizationID, q string, limit int, highlight bool) ([]Block, error) { + ctx, cancel := context.WithTimeout(ctx, _searchTimeout) + defer cancel() + + ctx = context.WithValue(ctx, bleveSearch.MaxTermSearchersKey, _maxTermSearchers) + + req := bleve.NewSearchRequestOptions(i.query(organizationID, q), limit, 0, false) + req.Fields = []string{"*"} + + if highlight { + req.Highlight = bleve.NewHighlightWithStyle(_highlighterName) + req.Highlight.AddField(_fieldText) + } + + res, err := i.idx.SearchInContext(ctx, req) + if err != nil { + return nil, fmt.Errorf("searching documents: %w", err) + } + + blocks := make([]Block, 0, len(res.Hits)) + + for _, hit := range res.Hits { + b, err := i.decodeHit(hit.ID, hit.Fields) + if err != nil { + return nil, err + } + + // a hit reached only through a synonym has no matched term of its + // own to fragment around, so it keeps its full text. + if fragments := hit.Fragments[_fieldText]; highlight && len(fragments) != 0 { + b.Text = fragments[0] + } + + blocks = append(blocks, b) + } + + return blocks, nil +} + +// query composes the search: an entry must belong to the organization and +// match the text, as the whole phrase or by its terms; a document name, a +// heading and the default branch then add score on top. +func (i *Index) query(organizationID, q string) query.Query { + org := bleve.NewTermQuery(organizationID) + org.SetField(_fieldOrganizationID) + + var text query.Query = bleve.NewMatchNoneQuery() + + // the analyzer is the field's own, so the terms run over the stemmed + // vocabulary the index holds. + if terms := i.terms(q); len(terms) != 0 { + phrase := bleve.NewPhraseQuery(terms, _fieldText) + phrase.SetBoost(_phraseBoost) + + text = bleve.NewDisjunctionQuery(phrase, termsQuery(terms)) + } + + name := bleve.NewTermQuery("document") + name.SetField(_fieldType) + name.SetBoost(_documentNameBoost) + + heading := bleve.NewTermQuery("heading") + heading.SetField(_fieldType) + heading.SetBoost(_headingBoost) + + def := bleve.NewBoolFieldQuery(true) + def.SetField(_fieldBranchDefault) + def.SetBoost(_defaultBranchBoost) + + bq := bleve.NewBooleanQuery() + bq.AddMust(org, text) + bq.AddShould(name, heading, def) + + return bq +} + +// terms analyzes the query into at most _maxQueryTerms index terms. +func (i *Index) terms(q string) []string { + tokens := i.idx.Mapping().AnalyzerNamed(_analyzerName).Analyze([]byte(q)) + terms := make([]string, 0, min(len(tokens), _maxQueryTerms)) + + for _, token := range tokens[:min(len(tokens), _maxQueryTerms)] { + terms = append(terms, string(token.Term)) + } + + return terms +} + +// termsQuery matches the terms with automatic fuzziness, the last one also +// as a prefix since it is what the user is still typing. All terms but one +// have to match: a lone unknown word does not empty the results, while a +// common word inside otherwise unknown ones does not fill them. +func termsQuery(terms []string) query.Query { + dq := bleve.NewDisjunctionQuery() + + for n, term := range terms { + fuzzy := bleve.NewFuzzyQuery(term) + fuzzy.SetField(_fieldText) + fuzzy.SetAutoFuzziness(true) + + if n != len(terms)-1 { + dq.AddQuery(fuzzy) + continue + } + + prefix := bleve.NewPrefixQuery(term) + prefix.SetField(_fieldText) + + dq.AddQuery(bleve.NewDisjunctionQuery(fuzzy, prefix)) + } + + dq.SetMin(float64(max(len(terms)-1, 1))) + + return dq +} + +// decodeHit rebuilds an entry from a hit's stored fields. Every field is +// stored with the type record gives it, so one of another type is a bug; +// it is logged and left at its zero value rather than failing the search. +func (i *Index) decodeHit(id string, fields map[string]any) (Block, error) { + str := func(field string) string { + s, ok := fields[field].(string) + if !ok { + i.log.With("entry_id", id). + With("field", field). + Warn("search entry field is not a string") + } + + return s + } + + documentID, err := xid.FromString(str(_fieldDocumentID)) + if err != nil { + return Block{}, fmt.Errorf("decoding document id of entry %s: %w", id, err) + } + + branchID, err := xid.FromString(str(_fieldBranchID)) + if err != nil { + return Block{}, fmt.Errorf("decoding branch id of entry %s: %w", id, err) + } + + def, ok := fields[_fieldBranchDefault].(bool) + if !ok { + i.log.With("entry_id", id). + With("field", _fieldBranchDefault). + Warn("search entry field is not a boolean") + } + + return Block{ + ID: id, + OrganizationID: str(_fieldOrganizationID), + DocumentID: documentID, + BranchID: branchID, + BranchName: str(_fieldBranchName), + BranchDefault: def, + Type: str(_fieldType), + Text: str(_fieldText), + }, nil +} diff --git a/server/core/internal/search/query_test.go b/server/core/internal/search/query_test.go new file mode 100644 index 00000000..5e8d7861 --- /dev/null +++ b/server/core/internal/search/query_test.go @@ -0,0 +1,544 @@ +package search + +import ( + "bytes" + "context" + "encoding/json" + "log/slog" + "strings" + "testing" + + "github.com/blevesearch/bleve/v2/search/query" + "github.com/rs/xid" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +// _longText holds a match well past the fragment size on both sides. +const _longText = "the migration guide starts with the prerequisites and then walks through every step of the upgrade, " + + "including the zebra pattern used for rolling out schema changes without downtime, " + + "before closing with the rollback procedure and the checks to run afterwards" + +// seedIndex fills an index with the entries the ranking cases rely on: +// a default branch and a fork of one document in org-1, and one document +// in org-2. It returns the index and the default branch's scope. +func seedIndex(t *testing.T) (*Index, Scope) { + t.Helper() + + idx := openIndex(t, indexPath(t), &stubSource{}) + t.Cleanup(func() { require.NoError(t, idx.Close()) }) + + main := Scope{ + OrganizationID: "org-1", + DocumentID: xid.New(), + BranchID: xid.New(), + BranchName: "main", + BranchDefault: true, + } + + fork := main + fork.BranchID = xid.New() + fork.BranchName = "draft" + fork.BranchDefault = false + + other := Scope{ + OrganizationID: "org-2", + DocumentID: xid.New(), + BranchID: xid.New(), + BranchName: "main", + BranchDefault: true, + } + + require.NoError(t, idx.ReplaceBranch(context.Background(), main.BranchID, map[string]Block{ + "docname": main.Block("docname", "document", "Release Checklist"), + "h1": main.Block("h1", "heading", "Release Checklist"), + "p1": main.Block("p1", "paragraph", "Release Checklist"), + "p2": main.Block("p2", "paragraph", "we deploy the service to production every friday"), + "p3": main.Block("p3", "paragraph", "production traffic hits the service after we deploy on monday"), + "p4": main.Block("p4", "paragraph", "alpha beta"), + "p5": main.Block("p5", "paragraph", "alpha only"), + "p6": main.Block("p6", "paragraph", "kubernetes clusters"), + "p7": main.Block("p7", "paragraph", "the endpoint answers 404 not found"), + "p8": main.Block("p8", "paragraph", "run an a11y audit before launch"), + "p9": main.Block("p9", "paragraph", "accessibility matters"), + "p10": main.Block("p10", "paragraph", _longText), + })) + + require.NoError(t, idx.ReplaceBranch(context.Background(), fork.BranchID, map[string]Block{ + "p1": fork.Block("p1", "paragraph", "Release Checklist"), + })) + + require.NoError(t, idx.ReplaceBranch(context.Background(), other.BranchID, map[string]Block{ + "p1": other.Block("p1", "paragraph", "Release Checklist"), + })) + + return idx, main +} + +func Test_Index_SearchDocuments(t *testing.T) { + t.Parallel() + + idx, main := seedIndex(t) + + data, err := idx.SearchDocuments(context.Background(), "org-1", "kubernetes") + require.NoError(t, err) + + exp, err := json.Marshal([]Block{ + { + ID: main.BranchID.String() + "-p6", + OrganizationID: "org-1", + DocumentID: main.DocumentID, + BranchID: main.BranchID, + BranchName: "main", + BranchDefault: true, + Type: "paragraph", + Text: "kubernetes clusters", + }, + }) + require.NoError(t, err) + assert.JSONEq(t, string(exp), string(data)) + + // error + ctx, cancel := context.WithCancel(context.Background()) + cancel() + + data, err = idx.SearchDocuments(ctx, "org-1", "kubernetes") + require.Error(t, err) + assert.Nil(t, data) +} + +func Test_Index_SearchDocumentBlocks(t *testing.T) { + t.Parallel() + + idx, main := seedIndex(t) + + blocks, err := idx.SearchDocumentBlocks(context.Background(), "org-1", "kubernetes", 10) + require.NoError(t, err) + assert.Equal(t, []Block{ + { + ID: main.BranchID.String() + "-p6", + OrganizationID: "org-1", + DocumentID: main.DocumentID, + BranchID: main.BranchID, + BranchName: "main", + BranchDefault: true, + Type: "paragraph", + Text: "kubernetes clusters", + }, + }, blocks) + + // the limit caps the hits. + blocks, err = idx.SearchDocumentBlocks(context.Background(), "org-1", "release checklist", 2) + require.NoError(t, err) + assert.Len(t, blocks, 2) + + // error + ctx, cancel := context.WithCancel(context.Background()) + cancel() + + blocks, err = idx.SearchDocumentBlocks(ctx, "org-1", "kubernetes", 10) + require.Error(t, err) + assert.Nil(t, blocks) +} + +func Test_Index_search(t *testing.T) { + t.Parallel() + + idx, main := seedIndex(t) + + cc := map[string]struct { + OrganizationID string + Query string + Limit int + Highlight bool + Check func(t *testing.T, blocks []Block) + }{ + "Stemming matches another form of the word": { + OrganizationID: "org-1", + Query: "deploying", + Limit: 10, + Check: func(t *testing.T, blocks []Block) { + assert.ElementsMatch(t, []string{ + "we deploy the service to production every friday", + "production traffic hits the service after we deploy on monday", + }, blockTexts(blocks)) + }, + }, + "Stop words are searchable": { + OrganizationID: "org-1", + Query: "not found", + Limit: 10, + Check: func(t *testing.T, blocks []Block) { + require.NotEmpty(t, blocks) + assert.Equal(t, "the endpoint answers 404 not found", blocks[0].Text) + }, + }, + "Typo within the automatic fuzziness matches": { + OrganizationID: "org-1", + Query: "kubernets", + Limit: 10, + Check: func(t *testing.T, blocks []Block) { + assert.Equal(t, []string{"kubernetes clusters"}, blockTexts(blocks)) + }, + }, + "Last term matches as a prefix": { + OrganizationID: "org-1", + Query: "kuber", + Limit: 10, + Check: func(t *testing.T, blocks []Block) { + assert.Equal(t, []string{"kubernetes clusters"}, blockTexts(blocks)) + }, + }, + "Phrase ranks above scattered words": { + OrganizationID: "org-1", + Query: "deploy the service", + Limit: 10, + Check: func(t *testing.T, blocks []Block) { + // "the" alone matches other entries too; they rank below both. + require.GreaterOrEqual(t, len(blocks), 2) + assert.Equal(t, "we deploy the service to production every friday", blocks[0].Text) + assert.Equal(t, "production traffic hits the service after we deploy on monday", blocks[1].Text) + }, + }, + "All terms rank above a subset, which is still returned": { + OrganizationID: "org-1", + Query: "alpha beta", + Limit: 10, + Check: func(t *testing.T, blocks []Block) { + require.Len(t, blocks, 2) + assert.Equal(t, "alpha beta", blocks[0].Text) + assert.Equal(t, "alpha only", blocks[1].Text) + }, + }, + "Synonym expands the query": { + OrganizationID: "org-1", + Query: "accessibility", + Limit: 10, + Check: func(t *testing.T, blocks []Block) { + assert.ElementsMatch(t, []string{ + "run an a11y audit before launch", + "accessibility matters", + }, blockTexts(blocks)) + }, + }, + "Synonym expands the query in the other direction": { + OrganizationID: "org-1", + Query: "a11y", + Limit: 10, + Check: func(t *testing.T, blocks []Block) { + assert.ElementsMatch(t, []string{ + "run an a11y audit before launch", + "accessibility matters", + }, blockTexts(blocks)) + }, + }, + "Document name, heading and default branch rank first": { + OrganizationID: "org-1", + Query: "release checklist", + Limit: 10, + Check: func(t *testing.T, blocks []Block) { + require.Len(t, blocks, 4) + assert.Equal(t, "document", blocks[0].Type) + assert.Equal(t, "heading", blocks[1].Type) + assert.Equal(t, "paragraph", blocks[2].Type) + assert.True(t, blocks[2].BranchDefault) + assert.Equal(t, "paragraph", blocks[3].Type) + assert.False(t, blocks[3].BranchDefault) + }, + }, + "Entries of another organization are never returned": { + OrganizationID: "org-2", + Query: "release checklist", + Limit: 10, + Check: func(t *testing.T, blocks []Block) { + require.Len(t, blocks, 1) + assert.Equal(t, "org-2", blocks[0].OrganizationID) + }, + }, + "Unknown organization finds nothing": { + OrganizationID: "org-3", + Query: "release checklist", + Limit: 10, + Check: func(t *testing.T, blocks []Block) { + assert.Empty(t, blocks) + }, + }, + "Limit caps the hits": { + OrganizationID: "org-1", + Query: "release checklist", + Limit: 1, + Check: func(t *testing.T, blocks []Block) { + assert.Len(t, blocks, 1) + }, + }, + "Highlight marks the match inside a fragment": { + OrganizationID: "org-1", + Query: "zebra", + Limit: 10, + Highlight: true, + Check: func(t *testing.T, blocks []Block) { + require.Len(t, blocks, 1) + assert.Contains(t, blocks[0].Text, "zebra") + // the fragment size counts text only; the mark tags come on top. + assert.Less(t, len(blocks[0].Text), _fragmentSize+len("")+10) + assert.Equal(t, main.BranchID.String()+"-p10", blocks[0].ID) + }, + }, + "Highlight keeps the full text of a synonym-only match": { + OrganizationID: "org-1", + Query: "accessibility", + Limit: 10, + Highlight: true, + Check: func(t *testing.T, blocks []Block) { + require.Len(t, blocks, 2) + + for _, b := range blocks { + assert.NotEmpty(t, b.Text) + } + }, + }, + "Query missing one of three terms still matches": { + OrganizationID: "org-1", + Query: "deploy service friday", + Limit: 10, + Check: func(t *testing.T, blocks []Block) { + require.Len(t, blocks, 2) + assert.Equal(t, "we deploy the service to production every friday", blocks[0].Text) + assert.Equal(t, "production traffic hits the service after we deploy on monday", blocks[1].Text) + }, + }, + "Common word among unknown ones matches nothing": { + OrganizationID: "org-1", + Query: "zz-no-such-release-anywhere", + Limit: 10, + Check: func(t *testing.T, blocks []Block) { + assert.Empty(t, blocks) + }, + }, + "Query without a single token still matches nothing": { + OrganizationID: "org-1", + Query: "...", + Limit: 10, + Check: func(t *testing.T, blocks []Block) { + assert.Empty(t, blocks) + }, + }, + } + + for cn, c := range cc { + t.Run(cn, func(t *testing.T) { + t.Parallel() + + blocks, err := idx.search(context.Background(), c.OrganizationID, c.Query, c.Limit, c.Highlight) + require.NoError(t, err) + + c.Check(t, blocks) + }) + } +} + +// blockTexts returns the text of each block, in order. +func blockTexts(blocks []Block) []string { + res := make([]string, 0, len(blocks)) + + for _, b := range blocks { + res = append(res, b.Text) + } + + return res +} + +func Test_Index_query(t *testing.T) { + t.Parallel() + + idx := openIndex(t, indexPath(t), &stubSource{}) + defer func() { require.NoError(t, idx.Close()) }() + + // a query with terms: the organization filter and the text disjunction + // are required, the boosts optional. + bq, ok := idx.query("org-1", "release notes").(*query.BooleanQuery) + require.True(t, ok) + + must, ok := bq.Must.(*query.ConjunctionQuery) + require.True(t, ok) + require.Len(t, must.Conjuncts, 2) + + org, ok := must.Conjuncts[0].(*query.TermQuery) + require.True(t, ok) + assert.Equal(t, "org-1", org.Term) + assert.Equal(t, _fieldOrganizationID, org.FieldVal) + + text, ok := must.Conjuncts[1].(*query.DisjunctionQuery) + require.True(t, ok) + require.Len(t, text.Disjuncts, 2) + + phrase, ok := text.Disjuncts[0].(*query.PhraseQuery) + require.True(t, ok) + assert.Equal(t, []string{"releas", "note"}, phrase.Terms) + + terms, ok := text.Disjuncts[1].(*query.DisjunctionQuery) + require.True(t, ok) + assert.Len(t, terms.Disjuncts, 2) + + should, ok := bq.Should.(*query.DisjunctionQuery) + require.True(t, ok) + assert.Len(t, should.Disjuncts, 3) + + // a query the analyzer reduces to nothing matches nothing. + bq, ok = idx.query("org-1", "...").(*query.BooleanQuery) + require.True(t, ok) + + must, ok = bq.Must.(*query.ConjunctionQuery) + require.True(t, ok) + + _, ok = must.Conjuncts[1].(*query.MatchNoneQuery) + assert.True(t, ok) +} + +func Test_Index_terms(t *testing.T) { + t.Parallel() + + idx := openIndex(t, indexPath(t), &stubSource{}) + defer func() { require.NoError(t, idx.Close()) }() + + // the terms are the analyzer's: lowercased and stemmed. + assert.Equal(t, []string{"deploy", "releas", "note"}, idx.terms("Deploying Release Notes")) + assert.Empty(t, idx.terms("...")) + + // a query beyond the cap keeps its first terms only. + long := strings.TrimSpace(strings.Repeat("word ", _maxQueryTerms+5)) + assert.Len(t, idx.terms(long), _maxQueryTerms) +} + +func Test_termsQuery(t *testing.T) { + t.Parallel() + + // one term: fuzzy or prefix, and it has to match. + dq, ok := termsQuery([]string{"kuber"}).(*query.DisjunctionQuery) + require.True(t, ok) + require.Len(t, dq.Disjuncts, 1) + assert.InDelta(t, 1, dq.Min, 0) + + last, ok := dq.Disjuncts[0].(*query.DisjunctionQuery) + require.True(t, ok) + require.Len(t, last.Disjuncts, 2) + + fuzzy, ok := last.Disjuncts[0].(*query.FuzzyQuery) + require.True(t, ok) + assert.Equal(t, "kuber", fuzzy.Term) + + prefix, ok := last.Disjuncts[1].(*query.PrefixQuery) + require.True(t, ok) + assert.Equal(t, "kuber", prefix.Prefix) + + // three terms: the first two fuzzy only, the last also a prefix, and + // all but one have to match. + dq, ok = termsQuery([]string{"deploy", "releas", "note"}).(*query.DisjunctionQuery) + require.True(t, ok) + require.Len(t, dq.Disjuncts, 3) + assert.InDelta(t, 2, dq.Min, 0) + + fuzzy, ok = dq.Disjuncts[0].(*query.FuzzyQuery) + require.True(t, ok) + assert.Equal(t, "deploy", fuzzy.Term) + + last, ok = dq.Disjuncts[2].(*query.DisjunctionQuery) + require.True(t, ok) + + prefix, ok = last.Disjuncts[1].(*query.PrefixQuery) + require.True(t, ok) + assert.Equal(t, "note", prefix.Prefix) +} + +func Test_Index_decodeHit(t *testing.T) { + t.Parallel() + + documentID, branchID := xid.New(), xid.New() + + fields := func(documentID, branchID string) map[string]any { + return map[string]any{ + _fieldOrganizationID: "org-1", + _fieldDocumentID: documentID, + _fieldBranchID: branchID, + _fieldBranchName: "draft", + _fieldBranchDefault: false, + _fieldType: "paragraph", + _fieldText: "hello", + } + } + + block := Block{ + ID: branchID.String() + "-p1", + OrganizationID: "org-1", + DocumentID: documentID, + BranchID: branchID, + BranchName: "draft", + BranchDefault: false, + Type: "paragraph", + Text: "hello", + } + + type tcase struct { + Fields map[string]any + Result Block + Logged string + Err error + } + + cc := map[string]tcase{ + "Invalid document id": { + Fields: fields("nope", branchID.String()), + Err: assert.AnError, + }, + "Invalid branch id": { + Fields: fields(documentID.String(), "nope"), + Err: assert.AnError, + }, + "Field of another type is logged and left empty": func() tcase { + ff := fields(documentID.String(), branchID.String()) + ff[_fieldText] = 42 + + res := block + res.Text = "" + + return tcase{Fields: ff, Result: res, Logged: "search entry field is not a string"} + }(), + "Missing boolean is logged and left false": func() tcase { + ff := fields(documentID.String(), branchID.String()) + delete(ff, _fieldBranchDefault) + + return tcase{Fields: ff, Result: block, Logged: "search entry field is not a boolean"} + }(), + "Successful decoding": { + Fields: fields(documentID.String(), branchID.String()), + Result: block, + }, + } + + for cn, c := range cc { + t.Run(cn, func(t *testing.T) { + t.Parallel() + + var logs bytes.Buffer + + idx := &Index{log: slog.New(slog.NewTextHandler(&logs, nil))} + + res, err := idx.decodeHit(branchID.String()+"-p1", c.Fields) + + if c.Err != nil { + require.Error(t, err) + return + } + + require.NoError(t, err) + assert.Equal(t, c.Result, res) + + if c.Logged == "" { + assert.Empty(t, logs.String()) + return + } + + assert.Contains(t, logs.String(), c.Logged) + }) + } +} diff --git a/server/core/internal/server/0mock_db_test.go b/server/core/internal/server/0mock_db_test.go index a8674642..32f84392 100644 --- a/server/core/internal/server/0mock_db_test.go +++ b/server/core/internal/server/0mock_db_test.go @@ -217,8 +217,8 @@ var _ DB = &DBMock{} // InsertDocumentHookFunc: func(ctx context.Context, hk hook.Hook) error { // panic("mock out the InsertDocumentHook method") // }, -// InsertDocumentSearchJobFunc: func(ctx context.Context, diff search.BlocksDifference) error { -// panic("mock out the InsertDocumentSearchJob method") +// InsertSearchJobFunc: func(ctx context.Context, job search.Job) error { +// panic("mock out the InsertSearchJob method") // }, // InsertGithubInstallationFunc: func(ctx context.Context, installationID int64) error { // panic("mock out the InsertGithubInstallation method") @@ -503,8 +503,8 @@ type DBMock struct { // InsertDocumentHookFunc mocks the InsertDocumentHook method. InsertDocumentHookFunc func(ctx context.Context, hk hook.Hook) error - // InsertDocumentSearchJobFunc mocks the InsertDocumentSearchJob method. - InsertDocumentSearchJobFunc func(ctx context.Context, diff search.BlocksDifference) error + // InsertSearchJobFunc mocks the InsertSearchJob method. + InsertSearchJobFunc func(ctx context.Context, job search.Job) error // InsertGithubInstallationFunc mocks the InsertGithubInstallation method. InsertGithubInstallationFunc func(ctx context.Context, installationID int64) error @@ -1132,12 +1132,12 @@ type DBMock struct { // Hk is the hk argument value. Hk hook.Hook } - // InsertDocumentSearchJob holds details about calls to the InsertDocumentSearchJob method. - InsertDocumentSearchJob []struct { + // InsertSearchJob holds details about calls to the InsertSearchJob method. + InsertSearchJob []struct { // Ctx is the ctx argument value. Ctx context.Context - // Diff is the diff argument value. - Diff search.BlocksDifference + // Job is the job argument value. + Job search.Job } // InsertGithubInstallation holds details about calls to the InsertGithubInstallation method. InsertGithubInstallation []struct { @@ -1458,7 +1458,7 @@ type DBMock struct { lockInsertDocumentCommentReply sync.RWMutex lockInsertDocumentFile sync.RWMutex lockInsertDocumentHook sync.RWMutex - lockInsertDocumentSearchJob sync.RWMutex + lockInsertSearchJob sync.RWMutex lockInsertGithubInstallation sync.RWMutex lockInsertSlackApp sync.RWMutex lockInsertSlackMessage sync.RWMutex @@ -4140,42 +4140,42 @@ func (mock *DBMock) InsertDocumentHookCalls() []struct { return calls } -// InsertDocumentSearchJob calls InsertDocumentSearchJobFunc. -func (mock *DBMock) InsertDocumentSearchJob(ctx context.Context, diff search.BlocksDifference) error { +// InsertSearchJob calls InsertSearchJobFunc. +func (mock *DBMock) InsertSearchJob(ctx context.Context, job search.Job) error { callInfo := struct { - Ctx context.Context - Diff search.BlocksDifference + Ctx context.Context + Job search.Job }{ - Ctx: ctx, - Diff: diff, + Ctx: ctx, + Job: job, } - mock.lockInsertDocumentSearchJob.Lock() - mock.calls.InsertDocumentSearchJob = append(mock.calls.InsertDocumentSearchJob, callInfo) - mock.lockInsertDocumentSearchJob.Unlock() - if mock.InsertDocumentSearchJobFunc == nil { + mock.lockInsertSearchJob.Lock() + mock.calls.InsertSearchJob = append(mock.calls.InsertSearchJob, callInfo) + mock.lockInsertSearchJob.Unlock() + if mock.InsertSearchJobFunc == nil { var ( errOut error ) return errOut } - return mock.InsertDocumentSearchJobFunc(ctx, diff) + return mock.InsertSearchJobFunc(ctx, job) } -// InsertDocumentSearchJobCalls gets all the calls that were made to InsertDocumentSearchJob. +// InsertSearchJobCalls gets all the calls that were made to InsertSearchJob. // Check the length with: // -// len(mockedDB.InsertDocumentSearchJobCalls()) -func (mock *DBMock) InsertDocumentSearchJobCalls() []struct { - Ctx context.Context - Diff search.BlocksDifference +// len(mockedDB.InsertSearchJobCalls()) +func (mock *DBMock) InsertSearchJobCalls() []struct { + Ctx context.Context + Job search.Job } { var calls []struct { - Ctx context.Context - Diff search.BlocksDifference + Ctx context.Context + Job search.Job } - mock.lockInsertDocumentSearchJob.RLock() - calls = mock.calls.InsertDocumentSearchJob - mock.lockInsertDocumentSearchJob.RUnlock() + mock.lockInsertSearchJob.RLock() + calls = mock.calls.InsertSearchJob + mock.lockInsertSearchJob.RUnlock() return calls } diff --git a/server/core/internal/server/0mock_search_trigger_test.go b/server/core/internal/server/0mock_search_trigger_test.go new file mode 100644 index 00000000..703dd90b --- /dev/null +++ b/server/core/internal/server/0mock_search_trigger_test.go @@ -0,0 +1,67 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package server + +import ( + "sync" +) + +// Ensure, that SearchTriggerMock does implement SearchTrigger. +// If this is not the case, regenerate this file with moq. +var _ SearchTrigger = &SearchTriggerMock{} + +// SearchTriggerMock is a mock implementation of SearchTrigger. +// +// func TestSomethingThatUsesSearchTrigger(t *testing.T) { +// +// // make and configure a mocked SearchTrigger +// mockedSearchTrigger := &SearchTriggerMock{ +// TriggerFunc: func() { +// panic("mock out the Trigger method") +// }, +// } +// +// // use mockedSearchTrigger in code that requires SearchTrigger +// // and then make assertions. +// +// } +type SearchTriggerMock struct { + // TriggerFunc mocks the Trigger method. + TriggerFunc func() + + // calls tracks calls to the methods. + calls struct { + // Trigger holds details about calls to the Trigger method. + Trigger []struct { + } + } + lockTrigger sync.RWMutex +} + +// Trigger calls TriggerFunc. +func (mock *SearchTriggerMock) Trigger() { + callInfo := struct { + }{} + mock.lockTrigger.Lock() + mock.calls.Trigger = append(mock.calls.Trigger, callInfo) + mock.lockTrigger.Unlock() + if mock.TriggerFunc == nil { + return + } + mock.TriggerFunc() +} + +// TriggerCalls gets all the calls that were made to Trigger. +// Check the length with: +// +// len(mockedSearchTrigger.TriggerCalls()) +func (mock *SearchTriggerMock) TriggerCalls() []struct { +} { + var calls []struct { + } + mock.lockTrigger.RLock() + calls = mock.calls.Trigger + mock.lockTrigger.RUnlock() + return calls +} diff --git a/server/core/internal/server/capabilities.go b/server/core/internal/server/capabilities.go index 1857ba66..74ee106d 100644 --- a/server/core/internal/server/capabilities.go +++ b/server/core/internal/server/capabilities.go @@ -25,9 +25,6 @@ type Capabilities struct { // ChangeDetection reports whether the changedetection.io integration // is configured. ChangeDetection bool `json:"changeDetection"` - - // Search reports whether document search is configured. - Search bool `json:"search"` } // AssistantCapability describes the AI assistant's availability, diff --git a/server/core/internal/server/capabilities_test.go b/server/core/internal/server/capabilities_test.go index e3bee4b9..d1da02ee 100644 --- a/server/core/internal/server/capabilities_test.go +++ b/server/core/internal/server/capabilities_test.go @@ -15,8 +15,7 @@ func Test_Server_fetchCapabilities(t *testing.T) { s := Server{ log: discardLog(), capabilities: Capabilities{ - Slack: true, - Search: true, + Slack: true, AIAssistant: AssistantCapability{ Status: provider.StatusActiveButWeak, Model: "claude-sonnet-5", @@ -36,8 +35,7 @@ func Test_Server_fetchCapabilities(t *testing.T) { "github": false, "slack": true, "aiAssistant": {"status": "active-but-weak", "model": "claude-sonnet-5"}, - "changeDetection": false, - "search": true + "changeDetection": false }`, rec.Body.String(), ) diff --git a/server/core/internal/server/internal/assistant/http_test.go b/server/core/internal/server/internal/assistant/http_test.go index 61bddf4c..bf6e8d28 100644 --- a/server/core/internal/server/internal/assistant/http_test.go +++ b/server/core/internal/server/internal/assistant/http_test.go @@ -22,7 +22,7 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, testutil.IgnoreBleveWorkers()) } // chatServer serves HandleChat with a test session on every request and diff --git a/server/core/internal/server/internal/document/0mock_db_test.go b/server/core/internal/server/internal/document/0mock_db_test.go index f803c33f..b9c4ea0d 100644 --- a/server/core/internal/server/internal/document/0mock_db_test.go +++ b/server/core/internal/server/internal/document/0mock_db_test.go @@ -109,8 +109,8 @@ var _ DB = &DBMock{} // InsertDocumentHookFunc: func(ctx context.Context, hk hook.Hook) error { // panic("mock out the InsertDocumentHook method") // }, -// InsertDocumentSearchJobFunc: func(ctx context.Context, diff search.BlocksDifference) error { -// panic("mock out the InsertDocumentSearchJob method") +// InsertSearchJobFunc: func(ctx context.Context, job search.Job) error { +// panic("mock out the InsertSearchJob method") // }, // PromoteBranchApprovalsFunc: func(ctx context.Context, fromBranchID xid.ID, toBranchID xid.ID, organizationID string) error { // panic("mock out the PromoteBranchApprovals method") @@ -230,8 +230,8 @@ type DBMock struct { // InsertDocumentHookFunc mocks the InsertDocumentHook method. InsertDocumentHookFunc func(ctx context.Context, hk hook.Hook) error - // InsertDocumentSearchJobFunc mocks the InsertDocumentSearchJob method. - InsertDocumentSearchJobFunc func(ctx context.Context, diff search.BlocksDifference) error + // InsertSearchJobFunc mocks the InsertSearchJob method. + InsertSearchJobFunc func(ctx context.Context, job search.Job) error // PromoteBranchApprovalsFunc mocks the PromoteBranchApprovals method. PromoteBranchApprovalsFunc func(ctx context.Context, fromBranchID xid.ID, toBranchID xid.ID, organizationID string) error @@ -506,12 +506,12 @@ type DBMock struct { // Hk is the hk argument value. Hk hook.Hook } - // InsertDocumentSearchJob holds details about calls to the InsertDocumentSearchJob method. - InsertDocumentSearchJob []struct { + // InsertSearchJob holds details about calls to the InsertSearchJob method. + InsertSearchJob []struct { // Ctx is the ctx argument value. Ctx context.Context - // Diff is the diff argument value. - Diff search.BlocksDifference + // Job is the job argument value. + Job search.Job } // PromoteBranchApprovals holds details about calls to the PromoteBranchApprovals method. PromoteBranchApprovals []struct { @@ -625,7 +625,7 @@ type DBMock struct { lockInsertDocumentBranch sync.RWMutex lockInsertDocumentFile sync.RWMutex lockInsertDocumentHook sync.RWMutex - lockInsertDocumentSearchJob sync.RWMutex + lockInsertSearchJob sync.RWMutex lockPromoteBranchApprovals sync.RWMutex lockReplaceBranchTags sync.RWMutex lockDetachDocumentHooksByBranchID sync.RWMutex @@ -1840,42 +1840,42 @@ func (mock *DBMock) InsertDocumentHookCalls() []struct { return calls } -// InsertDocumentSearchJob calls InsertDocumentSearchJobFunc. -func (mock *DBMock) InsertDocumentSearchJob(ctx context.Context, diff search.BlocksDifference) error { +// InsertSearchJob calls InsertSearchJobFunc. +func (mock *DBMock) InsertSearchJob(ctx context.Context, job search.Job) error { callInfo := struct { - Ctx context.Context - Diff search.BlocksDifference + Ctx context.Context + Job search.Job }{ - Ctx: ctx, - Diff: diff, + Ctx: ctx, + Job: job, } - mock.lockInsertDocumentSearchJob.Lock() - mock.calls.InsertDocumentSearchJob = append(mock.calls.InsertDocumentSearchJob, callInfo) - mock.lockInsertDocumentSearchJob.Unlock() - if mock.InsertDocumentSearchJobFunc == nil { + mock.lockInsertSearchJob.Lock() + mock.calls.InsertSearchJob = append(mock.calls.InsertSearchJob, callInfo) + mock.lockInsertSearchJob.Unlock() + if mock.InsertSearchJobFunc == nil { var ( errOut error ) return errOut } - return mock.InsertDocumentSearchJobFunc(ctx, diff) + return mock.InsertSearchJobFunc(ctx, job) } -// InsertDocumentSearchJobCalls gets all the calls that were made to InsertDocumentSearchJob. +// InsertSearchJobCalls gets all the calls that were made to InsertSearchJob. // Check the length with: // -// len(mockedDB.InsertDocumentSearchJobCalls()) -func (mock *DBMock) InsertDocumentSearchJobCalls() []struct { - Ctx context.Context - Diff search.BlocksDifference +// len(mockedDB.InsertSearchJobCalls()) +func (mock *DBMock) InsertSearchJobCalls() []struct { + Ctx context.Context + Job search.Job } { var calls []struct { - Ctx context.Context - Diff search.BlocksDifference + Ctx context.Context + Job search.Job } - mock.lockInsertDocumentSearchJob.RLock() - calls = mock.calls.InsertDocumentSearchJob - mock.lockInsertDocumentSearchJob.RUnlock() + mock.lockInsertSearchJob.RLock() + calls = mock.calls.InsertSearchJob + mock.lockInsertSearchJob.RUnlock() return calls } diff --git a/server/core/internal/server/internal/document/0mock_search_trigger_test.go b/server/core/internal/server/internal/document/0mock_search_trigger_test.go new file mode 100644 index 00000000..3448bf1d --- /dev/null +++ b/server/core/internal/server/internal/document/0mock_search_trigger_test.go @@ -0,0 +1,67 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package document + +import ( + "sync" +) + +// Ensure, that SearchTriggerMock does implement SearchTrigger. +// If this is not the case, regenerate this file with moq. +var _ SearchTrigger = &SearchTriggerMock{} + +// SearchTriggerMock is a mock implementation of SearchTrigger. +// +// func TestSomethingThatUsesSearchTrigger(t *testing.T) { +// +// // make and configure a mocked SearchTrigger +// mockedSearchTrigger := &SearchTriggerMock{ +// TriggerFunc: func() { +// panic("mock out the Trigger method") +// }, +// } +// +// // use mockedSearchTrigger in code that requires SearchTrigger +// // and then make assertions. +// +// } +type SearchTriggerMock struct { + // TriggerFunc mocks the Trigger method. + TriggerFunc func() + + // calls tracks calls to the methods. + calls struct { + // Trigger holds details about calls to the Trigger method. + Trigger []struct { + } + } + lockTrigger sync.RWMutex +} + +// Trigger calls TriggerFunc. +func (mock *SearchTriggerMock) Trigger() { + callInfo := struct { + }{} + mock.lockTrigger.Lock() + mock.calls.Trigger = append(mock.calls.Trigger, callInfo) + mock.lockTrigger.Unlock() + if mock.TriggerFunc == nil { + return + } + mock.TriggerFunc() +} + +// TriggerCalls gets all the calls that were made to Trigger. +// Check the length with: +// +// len(mockedSearchTrigger.TriggerCalls()) +func (mock *SearchTriggerMock) TriggerCalls() []struct { +} { + var calls []struct { + } + mock.lockTrigger.RLock() + calls = mock.calls.Trigger + mock.lockTrigger.RUnlock() + return calls +} diff --git a/server/core/internal/server/internal/document/0mock_search_gateway_test.go b/server/core/internal/server/internal/document/0mock_searcher_test.go similarity index 53% rename from server/core/internal/server/internal/document/0mock_search_gateway_test.go rename to server/core/internal/server/internal/document/0mock_searcher_test.go index 21c0c6e6..53b08431 100644 --- a/server/core/internal/server/internal/document/0mock_search_gateway_test.go +++ b/server/core/internal/server/internal/document/0mock_searcher_test.go @@ -8,37 +8,31 @@ import ( "sync" ) -// Ensure, that SearchGatewayMock does implement SearchGateway. +// Ensure, that SearcherMock does implement Searcher. // If this is not the case, regenerate this file with moq. -var _ SearchGateway = &SearchGatewayMock{} +var _ Searcher = &SearcherMock{} -// SearchGatewayMock is a mock implementation of SearchGateway. +// SearcherMock is a mock implementation of Searcher. // -// func TestSomethingThatUsesSearchGateway(t *testing.T) { +// func TestSomethingThatUsesSearcher(t *testing.T) { // -// // make and configure a mocked SearchGateway -// mockedSearchGateway := &SearchGatewayMock{ +// // make and configure a mocked Searcher +// mockedSearcher := &SearcherMock{ // SearchDocumentsFunc: func(ctx context.Context, organizationID string, query string) ([]byte, error) { // panic("mock out the SearchDocuments method") // }, // } // -// // use mockedSearchGateway in code that requires SearchGateway +// // use mockedSearcher in code that requires Searcher // // and then make assertions. // // } -type SearchGatewayMock struct { - // ConfiguredFunc mocks the Configured method. - ConfiguredFunc func() bool - +type SearcherMock struct { // SearchDocumentsFunc mocks the SearchDocuments method. SearchDocumentsFunc func(ctx context.Context, organizationID string, query string) ([]byte, error) // calls tracks calls to the methods. calls struct { - // Configured holds details about calls to the Configured method. - Configured []struct { - } // SearchDocuments holds details about calls to the SearchDocuments method. SearchDocuments []struct { // Ctx is the ctx argument value. @@ -49,12 +43,11 @@ type SearchGatewayMock struct { Query string } } - lockConfigured sync.RWMutex lockSearchDocuments sync.RWMutex } // SearchDocuments calls SearchDocumentsFunc. -func (mock *SearchGatewayMock) SearchDocuments(ctx context.Context, organizationID string, query string) ([]byte, error) { +func (mock *SearcherMock) SearchDocuments(ctx context.Context, organizationID string, query string) ([]byte, error) { callInfo := struct { Ctx context.Context OrganizationID string @@ -69,10 +62,10 @@ func (mock *SearchGatewayMock) SearchDocuments(ctx context.Context, organization mock.lockSearchDocuments.Unlock() if mock.SearchDocumentsFunc == nil { var ( - bytesOut []byte - errOut error + out0 []byte + errOut error ) - return bytesOut, errOut + return out0, errOut } return mock.SearchDocumentsFunc(ctx, organizationID, query) } @@ -80,8 +73,8 @@ func (mock *SearchGatewayMock) SearchDocuments(ctx context.Context, organization // SearchDocumentsCalls gets all the calls that were made to SearchDocuments. // Check the length with: // -// len(mockedSearchGateway.SearchDocumentsCalls()) -func (mock *SearchGatewayMock) SearchDocumentsCalls() []struct { +// len(mockedSearcher.SearchDocumentsCalls()) +func (mock *SearcherMock) SearchDocumentsCalls() []struct { Ctx context.Context OrganizationID string Query string @@ -96,33 +89,3 @@ func (mock *SearchGatewayMock) SearchDocumentsCalls() []struct { mock.lockSearchDocuments.RUnlock() return calls } - -// Configured calls ConfiguredFunc. -func (mock *SearchGatewayMock) Configured() bool { - callInfo := struct { - }{} - mock.lockConfigured.Lock() - mock.calls.Configured = append(mock.calls.Configured, callInfo) - mock.lockConfigured.Unlock() - if mock.ConfiguredFunc == nil { - var ( - bOut bool - ) - return bOut - } - return mock.ConfiguredFunc() -} - -// ConfiguredCalls gets all the calls that were made to Configured. -// Check the length with: -// -// len(mockedSearchGateway.ConfiguredCalls()) -func (mock *SearchGatewayMock) ConfiguredCalls() []struct { -} { - var calls []struct { - } - mock.lockConfigured.RLock() - calls = mock.calls.Configured - mock.lockConfigured.RUnlock() - return calls -} diff --git a/server/core/internal/server/internal/document/0mock_tx_test.go b/server/core/internal/server/internal/document/0mock_tx_test.go index 8a07031d..1151a1ee 100644 --- a/server/core/internal/server/internal/document/0mock_tx_test.go +++ b/server/core/internal/server/internal/document/0mock_tx_test.go @@ -109,8 +109,8 @@ var _ Tx = &TxMock{} // InsertDocumentHookFunc: func(ctx context.Context, hk hook.Hook) error { // panic("mock out the InsertDocumentHook method") // }, -// InsertDocumentSearchJobFunc: func(ctx context.Context, diff search.BlocksDifference) error { -// panic("mock out the InsertDocumentSearchJob method") +// InsertSearchJobFunc: func(ctx context.Context, job search.Job) error { +// panic("mock out the InsertSearchJob method") // }, // PromoteBranchApprovalsFunc: func(ctx context.Context, fromBranchID xid.ID, toBranchID xid.ID, organizationID string) error { // panic("mock out the PromoteBranchApprovals method") @@ -233,8 +233,8 @@ type TxMock struct { // InsertDocumentHookFunc mocks the InsertDocumentHook method. InsertDocumentHookFunc func(ctx context.Context, hk hook.Hook) error - // InsertDocumentSearchJobFunc mocks the InsertDocumentSearchJob method. - InsertDocumentSearchJobFunc func(ctx context.Context, diff search.BlocksDifference) error + // InsertSearchJobFunc mocks the InsertSearchJob method. + InsertSearchJobFunc func(ctx context.Context, job search.Job) error // PromoteBranchApprovalsFunc mocks the PromoteBranchApprovals method. PromoteBranchApprovalsFunc func(ctx context.Context, fromBranchID xid.ID, toBranchID xid.ID, organizationID string) error @@ -508,12 +508,12 @@ type TxMock struct { // Hk is the hk argument value. Hk hook.Hook } - // InsertDocumentSearchJob holds details about calls to the InsertDocumentSearchJob method. - InsertDocumentSearchJob []struct { + // InsertSearchJob holds details about calls to the InsertSearchJob method. + InsertSearchJob []struct { // Ctx is the ctx argument value. Ctx context.Context - // Diff is the diff argument value. - Diff search.BlocksDifference + // Job is the job argument value. + Job search.Job } // PromoteBranchApprovals holds details about calls to the PromoteBranchApprovals method. PromoteBranchApprovals []struct { @@ -630,7 +630,7 @@ type TxMock struct { lockInsertDocumentBranch sync.RWMutex lockInsertDocumentFile sync.RWMutex lockInsertDocumentHook sync.RWMutex - lockInsertDocumentSearchJob sync.RWMutex + lockInsertSearchJob sync.RWMutex lockPromoteBranchApprovals sync.RWMutex lockReplaceBranchTags sync.RWMutex lockRollback sync.RWMutex @@ -1837,42 +1837,42 @@ func (mock *TxMock) InsertDocumentHookCalls() []struct { return calls } -// InsertDocumentSearchJob calls InsertDocumentSearchJobFunc. -func (mock *TxMock) InsertDocumentSearchJob(ctx context.Context, diff search.BlocksDifference) error { +// InsertSearchJob calls InsertSearchJobFunc. +func (mock *TxMock) InsertSearchJob(ctx context.Context, job search.Job) error { callInfo := struct { - Ctx context.Context - Diff search.BlocksDifference + Ctx context.Context + Job search.Job }{ - Ctx: ctx, - Diff: diff, + Ctx: ctx, + Job: job, } - mock.lockInsertDocumentSearchJob.Lock() - mock.calls.InsertDocumentSearchJob = append(mock.calls.InsertDocumentSearchJob, callInfo) - mock.lockInsertDocumentSearchJob.Unlock() - if mock.InsertDocumentSearchJobFunc == nil { + mock.lockInsertSearchJob.Lock() + mock.calls.InsertSearchJob = append(mock.calls.InsertSearchJob, callInfo) + mock.lockInsertSearchJob.Unlock() + if mock.InsertSearchJobFunc == nil { var ( errOut error ) return errOut } - return mock.InsertDocumentSearchJobFunc(ctx, diff) + return mock.InsertSearchJobFunc(ctx, job) } -// InsertDocumentSearchJobCalls gets all the calls that were made to InsertDocumentSearchJob. +// InsertSearchJobCalls gets all the calls that were made to InsertSearchJob. // Check the length with: // -// len(mockedTx.InsertDocumentSearchJobCalls()) -func (mock *TxMock) InsertDocumentSearchJobCalls() []struct { - Ctx context.Context - Diff search.BlocksDifference +// len(mockedTx.InsertSearchJobCalls()) +func (mock *TxMock) InsertSearchJobCalls() []struct { + Ctx context.Context + Job search.Job } { var calls []struct { - Ctx context.Context - Diff search.BlocksDifference + Ctx context.Context + Job search.Job } - mock.lockInsertDocumentSearchJob.RLock() - calls = mock.calls.InsertDocumentSearchJob - mock.lockInsertDocumentSearchJob.RUnlock() + mock.lockInsertSearchJob.RLock() + calls = mock.calls.InsertSearchJob + mock.lockInsertSearchJob.RUnlock() return calls } diff --git a/server/core/internal/server/internal/document/branch_http.go b/server/core/internal/server/internal/document/branch_http.go index a142dc96..d2786c5f 100644 --- a/server/core/internal/server/internal/document/branch_http.go +++ b/server/core/internal/server/internal/document/branch_http.go @@ -84,7 +84,7 @@ func (h *Handler) UpdateDocumentBranch(w http.ResponseWriter, r *http.Request) { // the index carries the branch name on every entry of the branch. if ndoc.BranchName != doc.BranchName { - if err := h.searchJobs.Enqueue(r.Context(), tx, search.BlocksDiff(doc.Search(), ndoc.Search())); err != nil { + if err := tx.InsertSearchJob(r.Context(), search.BranchScope(session.ActiveOrganizationID, ndoc.ID, ndoc.BranchID)); err != nil { httpserver.RespondError(h.log, w, err) return } @@ -95,6 +95,8 @@ func (h *Handler) UpdateDocumentBranch(w http.ResponseWriter, r *http.Request) { return } + h.searchTrigger.Trigger() + if h.metadata.changeCallback != nil { h.metadata.changeCallback(session.ActiveOrganizationID, ndoc) } @@ -228,11 +230,7 @@ func (h *Handler) UpdateDocumentBranchByIDUnsafe(w http.ResponseWriter, r *http. } } - if err = h.searchJobs.Enqueue( - r.Context(), - tx, - search.BlocksDiff(doc.Search(), ndoc.Search()), - ); err != nil { + if err = tx.InsertSearchJob(r.Context(), search.BranchScope(doc.OrganizationID, doc.ID, doc.BranchID)); err != nil { httpserver.RespondError(h.log, w, err) return } @@ -243,6 +241,8 @@ func (h *Handler) UpdateDocumentBranchByIDUnsafe(w http.ResponseWriter, r *http. return } + h.searchTrigger.Trigger() + if h.metadata.changeCallback != nil { h.metadata.changeCallback(doc.OrganizationID, ndoc) } @@ -341,7 +341,7 @@ func (h *Handler) MergeBranches(w http.ResponseWriter, r *http.Request) { return } - if err := h.searchJobs.Enqueue(r.Context(), tx, search.BlocksDiff(toDoc.Search(), ndoc.Search())); err != nil { + if err := tx.InsertSearchJob(r.Context(), search.BranchScope(session.ActiveOrganizationID, toDoc.ID, toDoc.BranchID)); err != nil { httpserver.RespondError(h.log, w, err) return } @@ -356,6 +356,8 @@ func (h *Handler) MergeBranches(w http.ResponseWriter, r *http.Request) { return } + h.searchTrigger.Trigger() + h.copyHooksToBranch( r.Context(), fromDoc.BranchID, @@ -469,7 +471,7 @@ func (h *Handler) CreateDocumentBranch(w http.ResponseWriter, r *http.Request) { return } - if err := h.searchJobs.Enqueue(r.Context(), tx, search.BlocksDiff(nil, newDoc.Search())); err != nil { + if err := tx.InsertSearchJob(r.Context(), search.BranchScope(session.ActiveOrganizationID, newDoc.ID, newDoc.BranchID)); err != nil { httpserver.RespondError(h.log, w, err) return } @@ -479,6 +481,8 @@ func (h *Handler) CreateDocumentBranch(w http.ResponseWriter, r *http.Request) { return } + h.searchTrigger.Trigger() + h.copyHooksToBranch( r.Context(), sourceDoc.BranchID, @@ -557,9 +561,7 @@ func (h *Handler) DeleteDocumentBranch(w http.ResponseWriter, r *http.Request) { return } - if err := h.searchJobs.Enqueue(r.Context(), tx, search.BlocksDifference{ - RemovedBranches: []search.BranchRemoval{{DocumentID: branchDoc.ID, BranchID: branchID}}, - }); err != nil { + if err := tx.InsertSearchJob(r.Context(), search.BranchScope(session.ActiveOrganizationID, branchDoc.ID, branchID)); err != nil { httpserver.RespondError(h.log, w, err) return } @@ -569,6 +571,8 @@ func (h *Handler) DeleteDocumentBranch(w http.ResponseWriter, r *http.Request) { return } + h.searchTrigger.Trigger() + httpserver.Respond( h.log, w, diff --git a/server/core/internal/server/internal/document/branch_http_test.go b/server/core/internal/server/internal/document/branch_http_test.go index cdc6e021..ccfe419f 100644 --- a/server/core/internal/server/internal/document/branch_http_test.go +++ b/server/core/internal/server/internal/document/branch_http_test.go @@ -5,7 +5,6 @@ import ( "errors" "net/http" "net/http/httptest" - "strings" "testing" "github.com/guregu/null/v5" @@ -227,7 +226,7 @@ func Test_Handler_UpdateDocumentBranchByIDUnsafe(t *testing.T) { FetchDocumentMaintainersFunc: func(context.Context, xid.ID, string) ([]string, error) { return []string{"u1", "u9"}, nil }, - InsertDocumentSearchJobFunc: func(context.Context, search.BlocksDifference) error { + InsertSearchJobFunc: func(context.Context, search.Job) error { return errors.New("boom") }, }, @@ -307,18 +306,14 @@ func Test_Handler_UpdateDocumentBranchByIDUnsafe(t *testing.T) { assert.Len(t, c.Tx.CommitCalls(), c.Committed) assert.Equal(t, c.Metadata, cnt.metadata) assert.Equal(t, c.Maintainers, cnt.maintainers) - assert.Len(t, c.Tx.InsertDocumentSearchJobCalls(), c.SearchJobs) + assert.Len(t, c.Tx.InsertSearchJobCalls(), c.SearchJobs) - // the diff is scoped to the persisted branch: entries are keyed - // by its id, whichever branch it is. + // the job is scoped to the persisted branch, whichever branch + // it is. if !c.BranchID.IsZero() { - diff := c.Tx.InsertDocumentSearchJobCalls()[0].Diff - require.NotEmpty(t, diff.Updated) - - for _, b := range diff.Updated { - assert.Equal(t, c.BranchID, b.BranchID) - assert.True(t, strings.HasPrefix(b.ID, c.BranchID.String()+"-")) - } + job := c.Tx.InsertSearchJobCalls()[0].Job + assert.Equal(t, c.BranchID, job.BranchID.V) + assert.True(t, job.DocumentID.Valid) } }) } @@ -782,7 +777,7 @@ func Test_Handler_CreateDocumentBranch(t *testing.T) { }, }, Tx: &TxMock{ - InsertDocumentSearchJobFunc: func(context.Context, search.BlocksDifference) error { + InsertSearchJobFunc: func(context.Context, search.Job) error { return errors.New("boom") }, }, @@ -846,16 +841,10 @@ func Test_Handler_CreateDocumentBranch(t *testing.T) { assert.Equal(t, _branchID, c.Tx.CopyBranchTagsCalls()[0].FromBranchID) assert.Equal(t, forked.BranchID, c.Tx.CopyBranchTagsCalls()[0].ToBranchID) - // the fork's entries are added under its own branch id before - // the commit, so the branch is searchable without an edit. - require.Len(t, c.Tx.InsertDocumentSearchJobCalls(), 1) - diff := c.Tx.InsertDocumentSearchJobCalls()[0].Diff - require.NotEmpty(t, diff.Added) - - for _, b := range diff.Added { - assert.Equal(t, forked.BranchID, b.BranchID) - assert.True(t, strings.HasPrefix(b.ID, forked.BranchID.String()+"-")) - } + // the fork is queued under its own branch id before the + // commit, so the branch is searchable without an edit. + require.Len(t, c.Tx.InsertSearchJobCalls(), 1) + assert.Equal(t, search.BranchScope("org1", forked.ID, forked.BranchID), c.Tx.InsertSearchJobCalls()[0].Job) } if len(c.CopiedHooks) == 0 { @@ -978,7 +967,7 @@ func Test_Handler_DeleteDocumentBranch(t *testing.T) { }, }, Tx: &TxMock{ - InsertDocumentSearchJobFunc: func(context.Context, search.BlocksDifference) error { + InsertSearchJobFunc: func(context.Context, search.Job) error { return errors.New("boom") }, }, @@ -1024,13 +1013,11 @@ func Test_Handler_DeleteDocumentBranch(t *testing.T) { assert.Len(t, tx.DeleteDocumentBranchByIDCalls(), c.Deleted) assert.Len(t, tx.CommitCalls(), c.Committed) - // the branch row is gone with its content, so the index is - // cleared by branch id. + // the branch row is gone with its content, so the worker finds + // nothing under the scope and clears it. if c.RespCode == http.StatusNoContent { - require.Len(t, tx.InsertDocumentSearchJobCalls(), 1) - assert.Equal(t, search.BlocksDifference{ - RemovedBranches: []search.BranchRemoval{{DocumentID: _documentID, BranchID: _branchID}}, - }, tx.InsertDocumentSearchJobCalls()[0].Diff) + require.Len(t, tx.InsertSearchJobCalls(), 1) + assert.Equal(t, search.BranchScope("org1", _documentID, _branchID), tx.InsertSearchJobCalls()[0].Job) } }) } @@ -1203,7 +1190,7 @@ func Test_Handler_UpdateDocumentBranch(t *testing.T) { }, }, Tx: &TxMock{ - InsertDocumentSearchJobFunc: func(context.Context, search.BlocksDifference) error { + InsertSearchJobFunc: func(context.Context, search.Job) error { return errors.New("boom") }, }, @@ -1268,7 +1255,7 @@ func Test_Handler_UpdateDocumentBranch(t *testing.T) { assert.Equal(t, c.RespCode, rec.Code) assert.Len(t, tx.UpdateDocumentBranchMetadataCalls(), c.Updated) - assert.Len(t, tx.InsertDocumentSearchJobCalls(), c.Jobs) + assert.Len(t, tx.InsertSearchJobCalls(), c.Jobs) assert.Equal(t, c.Metadata, cnt.metadata) if c.RespCode == http.StatusOK { @@ -1279,13 +1266,10 @@ func Test_Handler_UpdateDocumentBranch(t *testing.T) { assert.Len(t, tx.CommitCalls(), 1) } - // a rename rewrites every entry of the branch, since each one - // carries the branch name. + // a rename resyncs the branch, since every entry carries the + // branch name. if c.Jobs == 1 && c.RespCode == http.StatusOK { - diff := tx.InsertDocumentSearchJobCalls()[0].Diff - require.Len(t, diff.Updated, 1) - assert.Equal(t, _branchID.String()+"-docname", diff.Updated[0].ID) - assert.Equal(t, "Renamed", diff.Updated[0].BranchName) + assert.Equal(t, search.BranchScope("org1", _documentID, _branchID), tx.InsertSearchJobCalls()[0].Job) } }) } diff --git a/server/core/internal/server/internal/document/document_http.go b/server/core/internal/server/internal/document/document_http.go index 065c556f..452d048f 100644 --- a/server/core/internal/server/internal/document/document_http.go +++ b/server/core/internal/server/internal/document/document_http.go @@ -7,6 +7,7 @@ import ( "net/http" "net/url" "path" + "unicode/utf8" "github.com/guregu/null/v5" "github.com/oxynote/oxynote/server/core/internal/apps/github" @@ -24,6 +25,11 @@ import ( "github.com/rs/xid" ) +// _searchQueryMaxLength caps a search query in characters. Every term +// expands to a dictionary walk inside the process, so the query size +// bounds the work one request can ask for. +const _searchQueryMaxLength = 200 + // ErrInvalidSearchQuery is returned when the search query is invalid. var ErrInvalidSearchQuery = errutil.New(http.StatusBadRequest, "document.invalid_search_query", "invalid search query") @@ -44,8 +50,8 @@ type Handler struct { db DB githubMan *github.Manager webchangeClient *webchange.Client - searchGateway SearchGateway - searchJobs *search.Jobs + searcher Searcher + searchTrigger SearchTrigger notifPub notification.Publisher storer Storer @@ -72,8 +78,8 @@ func NewHandler( db DB, githubMan *github.Manager, webchangeClient *webchange.Client, - searchGateway SearchGateway, - searchJobs *search.Jobs, + searcher Searcher, + searchTrigger SearchTrigger, notifPub notification.Publisher, storer Storer, ) *Handler { @@ -82,8 +88,8 @@ func NewHandler( db: db, githubMan: githubMan, webchangeClient: webchangeClient, - searchGateway: searchGateway, - searchJobs: searchJobs, + searcher: searcher, + searchTrigger: searchTrigger, notifPub: notifPub, storer: storer, } @@ -515,7 +521,7 @@ func (h *Handler) SearchDocuments(w http.ResponseWriter, r *http.Request) { } q := r.URL.Query().Get("q") - if q == "" { + if q == "" || utf8.RuneCountInString(q) > _searchQueryMaxLength { httpserver.RespondError( h.log, w, @@ -525,7 +531,7 @@ func (h *Handler) SearchDocuments(w http.ResponseWriter, r *http.Request) { return } - data, err := h.searchGateway.SearchDocuments(r.Context(), session.ActiveOrganizationID, q) + data, err := h.searcher.SearchDocuments(r.Context(), session.ActiveOrganizationID, q) if err != nil { httpserver.RespondError(h.log, w, err) return @@ -691,10 +697,8 @@ func (h *Handler) DeleteDocument(w http.ResponseWriter, r *http.Request) { return } - if len(ids) != 0 { - if err = h.searchJobs.Enqueue(r.Context(), tx, search.BlocksDifference{ - RemovedDocuments: ids, - }); err != nil { + for _, id := range ids { + if err = tx.InsertSearchJob(r.Context(), search.DocumentScope(session.ActiveOrganizationID, id)); err != nil { httpserver.RespondError(h.log, w, err) return } @@ -706,6 +710,8 @@ func (h *Handler) DeleteDocument(w http.ResponseWriter, r *http.Request) { return } + h.searchTrigger.Trigger() + if h.tree.changeCallback != nil { h.tree.changeCallback(session.ActiveOrganizationID, doc.ParentID) } @@ -903,7 +909,7 @@ func (h *Handler) insertDocumentTx( return err } - if err := h.searchJobs.Enqueue(ctx, tx, search.BlocksDiff(nil, doc.Search())); err != nil { + if err := tx.InsertSearchJob(ctx, search.BranchScope(session.ActiveOrganizationID, doc.ID, doc.BranchID)); err != nil { return err } @@ -921,7 +927,13 @@ func (h *Handler) insertDocumentTx( return err } - return tx.Commit() + if err = tx.Commit(); err != nil { + return err + } + + h.searchTrigger.Trigger() + + return nil } // DB is an interface that combines sqlutil.DB and DBAgent. @@ -979,8 +991,8 @@ type DocumentsDBAgent interface { // InsertDocument should insert the document. InsertDocument(ctx context.Context, doc documentCore.Document) error - // InsertDocumentSearchJob should insert the document search job. - InsertDocumentSearchJob(ctx context.Context, diff search.BlocksDifference) error + // InsertSearchJob should queue the search job's scope. + InsertSearchJob(ctx context.Context, job search.Job) error // CheckDocumentExists returns nil if the document exists and belongs to the given organization. CheckDocumentExists(ctx context.Context, id xid.ID, organizationID string) error @@ -1112,14 +1124,19 @@ type Storer interface { Copy(ctx context.Context, srcFolder, srcID, dstFolder, dstID string) error } -// SearchGateway is an interface that handles communication with the search engine. +// SearchTrigger runs the search-job worker once a job has committed. // -//go:generate ../../../../scripts/codegen/mock -t internal SearchGateway -type SearchGateway interface { - // Configured should report whether search is configured on this - // deployment. - Configured() bool +//go:generate ../../../../scripts/codegen/mock -t internal SearchTrigger search_trigger +type SearchTrigger interface { + // Trigger should run a search-job pass right away. + Trigger() +} +// Searcher is the full-text search surface the search endpoint answers +// from. +// +//go:generate ../../../../scripts/codegen/mock -t internal Searcher searcher +type Searcher interface { // SearchDocuments should find the documents matching the query. SearchDocuments(ctx context.Context, organizationID, query string) ([]byte, error) } diff --git a/server/core/internal/server/internal/document/document_http_test.go b/server/core/internal/server/internal/document/document_http_test.go index 064e4076..c06c99b8 100644 --- a/server/core/internal/server/internal/document/document_http_test.go +++ b/server/core/internal/server/internal/document/document_http_test.go @@ -27,7 +27,7 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, testutil.IgnoreBleveWorkers()) } // fixed IDs used across test requests. @@ -70,7 +70,7 @@ func newTestHandler(db DB, pub *fakePublisher) (*Handler, *callbackCounts) { notifPub: pub, storer: &StorerMock{}, webchangeClient: webchange.NewClient("", ""), - searchJobs: search.NewJobs(true), + searchTrigger: &SearchTriggerMock{}, } hdl.tree.changeCallback = func(string, null.Value[xid.ID]) { cnt.tree++ } @@ -152,17 +152,17 @@ func Test_NewHandler(t *testing.T) { t.Parallel() db := &DBMock{} - gw := &SearchGatewayMock{} - jobs := search.NewJobs(true) + searcher := &SearcherMock{} + trigger := &SearchTriggerMock{} pub := &fakePublisher{} st := &StorerMock{} - hdl := NewHandler(slog.New(slog.DiscardHandler), db, nil, nil, gw, jobs, pub, st) + hdl := NewHandler(slog.New(slog.DiscardHandler), db, nil, nil, searcher, trigger, pub, st) require.NotNil(t, hdl) assert.NotNil(t, hdl.log) assert.Same(t, db, hdl.db) - assert.Same(t, gw, hdl.searchGateway) - assert.Same(t, jobs, hdl.searchJobs) + assert.Same(t, searcher, hdl.searcher) + assert.Same(t, trigger, hdl.searchTrigger) assert.Same(t, pub, hdl.notifPub) assert.Same(t, st, hdl.storer) assert.Nil(t, hdl.githubMan) @@ -1168,24 +1168,29 @@ func Test_Handler_UpdateDocumentTree(t *testing.T) { func Test_Handler_SearchDocuments(t *testing.T) { cc := map[string]struct { - Gateway *SearchGatewayMock + Searcher *SearcherMock NoSession bool Query string RespCode int RespBody string }{ "No session in context": { - Gateway: &SearchGatewayMock{}, + Searcher: &SearcherMock{}, NoSession: true, Query: "?q=test", RespCode: http.StatusUnauthorized, }, "Empty search query": { - Gateway: &SearchGatewayMock{}, + Searcher: &SearcherMock{}, RespCode: http.StatusBadRequest, }, - "Search gateway error": { - Gateway: &SearchGatewayMock{ + "Overlong search query": { + Searcher: &SearcherMock{}, + Query: "?q=" + strings.Repeat("a", _searchQueryMaxLength+1), + RespCode: http.StatusBadRequest, + }, + "Searcher error": { + Searcher: &SearcherMock{ SearchDocumentsFunc: func(context.Context, string, string) ([]byte, error) { return nil, errors.New("boom") }, @@ -1193,18 +1198,8 @@ func Test_Handler_SearchDocuments(t *testing.T) { Query: "?q=test", RespCode: http.StatusInternalServerError, }, - "Search not configured": { - Gateway: &SearchGatewayMock{ - SearchDocumentsFunc: func(context.Context, string, string) ([]byte, error) { - return nil, search.ErrNotConfigured - }, - }, - Query: "?q=test", - RespCode: http.StatusConflict, - RespBody: `{"code":"search.not_configured","message":"search is not configured"}`, - }, "Successful search": { - Gateway: &SearchGatewayMock{ + Searcher: &SearcherMock{ SearchDocumentsFunc: func(context.Context, string, string) ([]byte, error) { return []byte(`{"hits":[]}`), nil }, @@ -1220,7 +1215,7 @@ func Test_Handler_SearchDocuments(t *testing.T) { t.Parallel() hdl, _ := newTestHandler(&DBMock{}, &fakePublisher{}) - hdl.searchGateway = c.Gateway + hdl.searcher = c.Searcher req := httptest.NewRequest(http.MethodGet, "http://test.com/"+c.Query, http.NoBody) @@ -1315,7 +1310,7 @@ func Test_Handler_CreateDocument(t *testing.T) { }, "Search job insertion error": { Tx: &TxMock{ - InsertDocumentSearchJobFunc: func(context.Context, search.BlocksDifference) error { + InsertSearchJobFunc: func(context.Context, search.Job) error { return errors.New("boom") }, }, @@ -1469,7 +1464,7 @@ func Test_Handler_DeleteDocument(t *testing.T) { DeleteDocumentFunc: func(context.Context, xid.ID, string) ([]xid.ID, error) { return []xid.ID{_documentID}, nil }, - InsertDocumentSearchJobFunc: func(context.Context, search.BlocksDifference) error { + InsertSearchJobFunc: func(context.Context, search.Job) error { return errors.New("boom") }, }, @@ -1521,11 +1516,11 @@ func Test_Handler_DeleteDocument(t *testing.T) { require.Len(t, c.Tx.DeleteDocumentCalls(), 1) assert.Equal(t, _documentID, c.Tx.DeleteDocumentCalls()[0].ID) - // the removal of the returned subtree ids rides the same + // the resync of the returned subtree ids rides the same // transaction as the delete. - ff := c.Tx.InsertDocumentSearchJobCalls() + ff := c.Tx.InsertSearchJobCalls() require.Len(t, ff, 1) - assert.Equal(t, []xid.ID{_documentID}, ff[0].Diff.RemovedDocuments) + assert.Equal(t, search.DocumentScope("org1", _documentID), ff[0].Job) } }) } diff --git a/server/core/internal/server/internal/mcp/http_test.go b/server/core/internal/server/internal/mcp/http_test.go index 9394a9cd..58984170 100644 --- a/server/core/internal/server/internal/mcp/http_test.go +++ b/server/core/internal/server/internal/mcp/http_test.go @@ -12,7 +12,6 @@ import ( "github.com/jarcoal/httpmock" "github.com/oxynote/oxynote/server/core/internal/assistant/tools" toolsMock "github.com/oxynote/oxynote/server/core/internal/assistant/tools/_mock" - "github.com/oxynote/oxynote/server/core/internal/search" "github.com/oxynote/oxynote/server/core/pkg/testutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -20,7 +19,7 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, testutil.IgnoreBleveWorkers()) } // _testSessionURL is the internal MCP session endpoint the mocked @@ -35,6 +34,11 @@ func discardLog() *slog.Logger { return slog.New(slog.DiscardHandler) } +// stubSearchTrigger satisfies the tools' SearchTrigger with a no-op. +type stubSearchTrigger struct{} + +func (stubSearchTrigger) Trigger() {} + // stubToolsDB builds the tools-package DB mock every test tool set // runs against. func stubToolsDB() *toolsMock.DB { @@ -47,10 +51,8 @@ func stubSet(db *toolsMock.DB) *tools.Set { return tools.New(tools.NewDeps( discardLog(), db, - &toolsMock.Searcher{ - ConfiguredFunc: func() bool { return true }, - }, - search.NewJobs(true), + &toolsMock.Searcher{}, + stubSearchTrigger{}, nil, nil, nil, diff --git a/server/core/internal/server/internal/org/0mock_db_test.go b/server/core/internal/server/internal/org/0mock_db_test.go index 760ca596..42d4220e 100644 --- a/server/core/internal/server/internal/org/0mock_db_test.go +++ b/server/core/internal/server/internal/org/0mock_db_test.go @@ -49,8 +49,8 @@ var _ DB = &DBMock{} // InsertDocumentFunc: func(ctx context.Context, doc document.Document) error { // panic("mock out the InsertDocument method") // }, -// InsertDocumentSearchJobFunc: func(ctx context.Context, diff search.BlocksDifference) error { -// panic("mock out the InsertDocumentSearchJob method") +// InsertSearchJobFunc: func(ctx context.Context, job search.Job) error { +// panic("mock out the InsertSearchJob method") // }, // InsertTagFunc: func(ctx context.Context, t tag.Tag) error { // panic("mock out the InsertTag method") @@ -92,8 +92,8 @@ type DBMock struct { // InsertDocumentFunc mocks the InsertDocument method. InsertDocumentFunc func(ctx context.Context, doc document.Document) error - // InsertDocumentSearchJobFunc mocks the InsertDocumentSearchJob method. - InsertDocumentSearchJobFunc func(ctx context.Context, diff search.BlocksDifference) error + // InsertSearchJobFunc mocks the InsertSearchJob method. + InsertSearchJobFunc func(ctx context.Context, job search.Job) error // InsertTagFunc mocks the InsertTag method. InsertTagFunc func(ctx context.Context, t tag.Tag) error @@ -168,12 +168,12 @@ type DBMock struct { // Doc is the doc argument value. Doc document.Document } - // InsertDocumentSearchJob holds details about calls to the InsertDocumentSearchJob method. - InsertDocumentSearchJob []struct { + // InsertSearchJob holds details about calls to the InsertSearchJob method. + InsertSearchJob []struct { // Ctx is the ctx argument value. Ctx context.Context - // Diff is the diff argument value. - Diff search.BlocksDifference + // Job is the job argument value. + Job search.Job } // InsertTag holds details about calls to the InsertTag method. InsertTag []struct { @@ -211,7 +211,7 @@ type DBMock struct { lockFetchOrganizationMembers sync.RWMutex lockInsertDataSource sync.RWMutex lockInsertDocument sync.RWMutex - lockInsertDocumentSearchJob sync.RWMutex + lockInsertSearchJob sync.RWMutex lockInsertTag sync.RWMutex lockUpdateOrganizationLogo sync.RWMutex lockUpsertDocumentMaintainers sync.RWMutex @@ -541,42 +541,42 @@ func (mock *DBMock) InsertDocumentCalls() []struct { return calls } -// InsertDocumentSearchJob calls InsertDocumentSearchJobFunc. -func (mock *DBMock) InsertDocumentSearchJob(ctx context.Context, diff search.BlocksDifference) error { +// InsertSearchJob calls InsertSearchJobFunc. +func (mock *DBMock) InsertSearchJob(ctx context.Context, job search.Job) error { callInfo := struct { - Ctx context.Context - Diff search.BlocksDifference + Ctx context.Context + Job search.Job }{ - Ctx: ctx, - Diff: diff, + Ctx: ctx, + Job: job, } - mock.lockInsertDocumentSearchJob.Lock() - mock.calls.InsertDocumentSearchJob = append(mock.calls.InsertDocumentSearchJob, callInfo) - mock.lockInsertDocumentSearchJob.Unlock() - if mock.InsertDocumentSearchJobFunc == nil { + mock.lockInsertSearchJob.Lock() + mock.calls.InsertSearchJob = append(mock.calls.InsertSearchJob, callInfo) + mock.lockInsertSearchJob.Unlock() + if mock.InsertSearchJobFunc == nil { var ( errOut error ) return errOut } - return mock.InsertDocumentSearchJobFunc(ctx, diff) + return mock.InsertSearchJobFunc(ctx, job) } -// InsertDocumentSearchJobCalls gets all the calls that were made to InsertDocumentSearchJob. +// InsertSearchJobCalls gets all the calls that were made to InsertSearchJob. // Check the length with: // -// len(mockedDB.InsertDocumentSearchJobCalls()) -func (mock *DBMock) InsertDocumentSearchJobCalls() []struct { - Ctx context.Context - Diff search.BlocksDifference +// len(mockedDB.InsertSearchJobCalls()) +func (mock *DBMock) InsertSearchJobCalls() []struct { + Ctx context.Context + Job search.Job } { var calls []struct { - Ctx context.Context - Diff search.BlocksDifference + Ctx context.Context + Job search.Job } - mock.lockInsertDocumentSearchJob.RLock() - calls = mock.calls.InsertDocumentSearchJob - mock.lockInsertDocumentSearchJob.RUnlock() + mock.lockInsertSearchJob.RLock() + calls = mock.calls.InsertSearchJob + mock.lockInsertSearchJob.RUnlock() return calls } diff --git a/server/core/internal/server/internal/org/0mock_search_trigger_test.go b/server/core/internal/server/internal/org/0mock_search_trigger_test.go new file mode 100644 index 00000000..633effe8 --- /dev/null +++ b/server/core/internal/server/internal/org/0mock_search_trigger_test.go @@ -0,0 +1,67 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package org + +import ( + "sync" +) + +// Ensure, that SearchTriggerMock does implement SearchTrigger. +// If this is not the case, regenerate this file with moq. +var _ SearchTrigger = &SearchTriggerMock{} + +// SearchTriggerMock is a mock implementation of SearchTrigger. +// +// func TestSomethingThatUsesSearchTrigger(t *testing.T) { +// +// // make and configure a mocked SearchTrigger +// mockedSearchTrigger := &SearchTriggerMock{ +// TriggerFunc: func() { +// panic("mock out the Trigger method") +// }, +// } +// +// // use mockedSearchTrigger in code that requires SearchTrigger +// // and then make assertions. +// +// } +type SearchTriggerMock struct { + // TriggerFunc mocks the Trigger method. + TriggerFunc func() + + // calls tracks calls to the methods. + calls struct { + // Trigger holds details about calls to the Trigger method. + Trigger []struct { + } + } + lockTrigger sync.RWMutex +} + +// Trigger calls TriggerFunc. +func (mock *SearchTriggerMock) Trigger() { + callInfo := struct { + }{} + mock.lockTrigger.Lock() + mock.calls.Trigger = append(mock.calls.Trigger, callInfo) + mock.lockTrigger.Unlock() + if mock.TriggerFunc == nil { + return + } + mock.TriggerFunc() +} + +// TriggerCalls gets all the calls that were made to Trigger. +// Check the length with: +// +// len(mockedSearchTrigger.TriggerCalls()) +func (mock *SearchTriggerMock) TriggerCalls() []struct { +} { + var calls []struct { + } + mock.lockTrigger.RLock() + calls = mock.calls.Trigger + mock.lockTrigger.RUnlock() + return calls +} diff --git a/server/core/internal/server/internal/org/0mock_tx_test.go b/server/core/internal/server/internal/org/0mock_tx_test.go index ffdfe4c6..a50f39d2 100644 --- a/server/core/internal/server/internal/org/0mock_tx_test.go +++ b/server/core/internal/server/internal/org/0mock_tx_test.go @@ -49,8 +49,8 @@ var _ Tx = &TxMock{} // InsertDocumentFunc: func(ctx context.Context, doc document.Document) error { // panic("mock out the InsertDocument method") // }, -// InsertDocumentSearchJobFunc: func(ctx context.Context, diff search.BlocksDifference) error { -// panic("mock out the InsertDocumentSearchJob method") +// InsertSearchJobFunc: func(ctx context.Context, job search.Job) error { +// panic("mock out the InsertSearchJob method") // }, // InsertTagFunc: func(ctx context.Context, t tag.Tag) error { // panic("mock out the InsertTag method") @@ -95,8 +95,8 @@ type TxMock struct { // InsertDocumentFunc mocks the InsertDocument method. InsertDocumentFunc func(ctx context.Context, doc document.Document) error - // InsertDocumentSearchJobFunc mocks the InsertDocumentSearchJob method. - InsertDocumentSearchJobFunc func(ctx context.Context, diff search.BlocksDifference) error + // InsertSearchJobFunc mocks the InsertSearchJob method. + InsertSearchJobFunc func(ctx context.Context, job search.Job) error // InsertTagFunc mocks the InsertTag method. InsertTagFunc func(ctx context.Context, t tag.Tag) error @@ -170,12 +170,12 @@ type TxMock struct { // Doc is the doc argument value. Doc document.Document } - // InsertDocumentSearchJob holds details about calls to the InsertDocumentSearchJob method. - InsertDocumentSearchJob []struct { + // InsertSearchJob holds details about calls to the InsertSearchJob method. + InsertSearchJob []struct { // Ctx is the ctx argument value. Ctx context.Context - // Diff is the diff argument value. - Diff search.BlocksDifference + // Job is the job argument value. + Job search.Job } // InsertTag holds details about calls to the InsertTag method. InsertTag []struct { @@ -216,7 +216,7 @@ type TxMock struct { lockFetchOrganizationMembers sync.RWMutex lockInsertDataSource sync.RWMutex lockInsertDocument sync.RWMutex - lockInsertDocumentSearchJob sync.RWMutex + lockInsertSearchJob sync.RWMutex lockInsertTag sync.RWMutex lockRollback sync.RWMutex lockUpdateOrganizationLogo sync.RWMutex @@ -538,42 +538,42 @@ func (mock *TxMock) InsertDocumentCalls() []struct { return calls } -// InsertDocumentSearchJob calls InsertDocumentSearchJobFunc. -func (mock *TxMock) InsertDocumentSearchJob(ctx context.Context, diff search.BlocksDifference) error { +// InsertSearchJob calls InsertSearchJobFunc. +func (mock *TxMock) InsertSearchJob(ctx context.Context, job search.Job) error { callInfo := struct { - Ctx context.Context - Diff search.BlocksDifference + Ctx context.Context + Job search.Job }{ - Ctx: ctx, - Diff: diff, + Ctx: ctx, + Job: job, } - mock.lockInsertDocumentSearchJob.Lock() - mock.calls.InsertDocumentSearchJob = append(mock.calls.InsertDocumentSearchJob, callInfo) - mock.lockInsertDocumentSearchJob.Unlock() - if mock.InsertDocumentSearchJobFunc == nil { + mock.lockInsertSearchJob.Lock() + mock.calls.InsertSearchJob = append(mock.calls.InsertSearchJob, callInfo) + mock.lockInsertSearchJob.Unlock() + if mock.InsertSearchJobFunc == nil { var ( errOut error ) return errOut } - return mock.InsertDocumentSearchJobFunc(ctx, diff) + return mock.InsertSearchJobFunc(ctx, job) } -// InsertDocumentSearchJobCalls gets all the calls that were made to InsertDocumentSearchJob. +// InsertSearchJobCalls gets all the calls that were made to InsertSearchJob. // Check the length with: // -// len(mockedTx.InsertDocumentSearchJobCalls()) -func (mock *TxMock) InsertDocumentSearchJobCalls() []struct { - Ctx context.Context - Diff search.BlocksDifference +// len(mockedTx.InsertSearchJobCalls()) +func (mock *TxMock) InsertSearchJobCalls() []struct { + Ctx context.Context + Job search.Job } { var calls []struct { - Ctx context.Context - Diff search.BlocksDifference + Ctx context.Context + Job search.Job } - mock.lockInsertDocumentSearchJob.RLock() - calls = mock.calls.InsertDocumentSearchJob - mock.lockInsertDocumentSearchJob.RUnlock() + mock.lockInsertSearchJob.RLock() + calls = mock.calls.InsertSearchJob + mock.lockInsertSearchJob.RUnlock() return calls } diff --git a/server/core/internal/server/internal/org/http.go b/server/core/internal/server/internal/org/http.go index d0eab14d..4cd9b740 100644 --- a/server/core/internal/server/internal/org/http.go +++ b/server/core/internal/server/internal/org/http.go @@ -47,7 +47,7 @@ type Handler struct { storer Storer githubMan *github.Manager webchangeClient *webchange.Client - searchJobs *search.Jobs + searchTrigger SearchTrigger logoLocation string } @@ -58,7 +58,7 @@ func NewHandler( storer Storer, githubMan *github.Manager, webchangeClient *webchange.Client, - searchJobs *search.Jobs, + searchTrigger SearchTrigger, logoLocationFormat string, ) *Handler { return &Handler{ @@ -67,7 +67,7 @@ func NewHandler( storer: storer, githubMan: githubMan, webchangeClient: webchangeClient, - searchJobs: searchJobs, + searchTrigger: searchTrigger, logoLocation: logoLocationFormat, } } @@ -151,7 +151,7 @@ func (h *Handler) InitializeOrganization(w http.ResponseWriter, r *http.Request) return } - if err = h.searchJobs.Enqueue(r.Context(), tx, search.BlocksDiff(nil, doc.Search())); err != nil { + if err = tx.InsertSearchJob(r.Context(), search.BranchScope(id, doc.ID, doc.BranchID)); err != nil { httpserver.RespondError(h.log, w, err) return } @@ -162,6 +162,8 @@ func (h *Handler) InitializeOrganization(w http.ResponseWriter, r *http.Request) return } + h.searchTrigger.Trigger() + httpserver.Respond( h.log, w, @@ -291,9 +293,7 @@ func (h *Handler) TeardownOrganization(w http.ResponseWriter, r *http.Request) { defer tx.Rollback() //nolint:errcheck // error provides no meaningful info - if err = h.searchJobs.Enqueue(r.Context(), tx, search.BlocksDifference{ - RemovedOrganizations: []string{id}, - }); err != nil { + if err = tx.InsertSearchJob(r.Context(), search.OrganizationScope(id)); err != nil { httpserver.RespondError(h.log, w, err) return } @@ -314,6 +314,8 @@ func (h *Handler) TeardownOrganization(w http.ResponseWriter, r *http.Request) { return } + h.searchTrigger.Trigger() + // the logo is the organization's own object; the documents' files are // left to the file manager, which reclaims them once the cascade nulls // their foreign keys. @@ -364,6 +366,14 @@ type DB interface { DBAgent } +// SearchTrigger runs the search-job worker once a job has committed. +// +//go:generate ../../../../scripts/codegen/mock -t internal SearchTrigger search_trigger +type SearchTrigger interface { + // Trigger should run a search-job pass right away. + Trigger() +} + // Tx is an interface that combines sqlutil.Tx and DBAgent. // //go:generate ../../../../scripts/codegen/mock -t internal Tx tx @@ -382,8 +392,8 @@ type DBAgent interface { // InsertDocument should insert the document. InsertDocument(ctx context.Context, doc document.Document) error - // InsertDocumentSearchJob should insert the document search job. - InsertDocumentSearchJob(ctx context.Context, diff search.BlocksDifference) error + // InsertSearchJob should queue the search job's scope. + InsertSearchJob(ctx context.Context, job search.Job) error // FetchDocumentHooksByOrganizationID should return every hook of the // organization. diff --git a/server/core/internal/server/internal/org/http_test.go b/server/core/internal/server/internal/org/http_test.go index 04aacf99..b9d36932 100644 --- a/server/core/internal/server/internal/org/http_test.go +++ b/server/core/internal/server/internal/org/http_test.go @@ -32,7 +32,7 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain(m, testutil.IgnoreBleveWorkers()) } // addSession stores a test session on the request context. @@ -89,7 +89,7 @@ func Test_NewHandler(t *testing.T) { githubMan := &github.Manager{} webchangeClient := &webchange.Client{} - searchJobs := search.NewJobs(true) + searchTrigger := &SearchTriggerMock{} hdl := NewHandler( slog.New(slog.DiscardHandler), @@ -97,7 +97,7 @@ func Test_NewHandler(t *testing.T) { storer, githubMan, webchangeClient, - searchJobs, + searchTrigger, "loc", ) require.NotNil(t, hdl) @@ -106,7 +106,7 @@ func Test_NewHandler(t *testing.T) { assert.Same(t, storer, hdl.storer) assert.Same(t, githubMan, hdl.githubMan) assert.Same(t, webchangeClient, hdl.webchangeClient) - assert.Same(t, searchJobs, hdl.searchJobs) + assert.Same(t, searchTrigger, hdl.searchTrigger) assert.Equal(t, "loc", hdl.logoLocation) } @@ -233,7 +233,7 @@ func Test_Handler_InitializeOrganization(t *testing.T) { wasSearchJobInserted := func(count int) check { return func(t *testing.T, _ *DBMock, tx *TxMock, _ *httptest.ResponseRecorder) { - assert.Len(t, tx.InsertDocumentSearchJobCalls(), count) + assert.Len(t, tx.InsertSearchJobCalls(), count) } } @@ -374,7 +374,7 @@ func Test_Handler_InitializeOrganization(t *testing.T) { "Search job insertion error": { Members: []string{"member1"}, Tx: &TxMock{ - InsertDocumentSearchJobFunc: func(context.Context, search.BlocksDifference) error { + InsertSearchJobFunc: func(context.Context, search.Job) error { return errors.New("boom") }, }, @@ -433,9 +433,9 @@ func Test_Handler_InitializeOrganization(t *testing.T) { } hdl := Handler{ - log: slog.New(slog.DiscardHandler), - db: withTx(db, c.Tx, c.BeginErr), - searchJobs: search.NewJobs(true), + log: slog.New(slog.DiscardHandler), + db: withTx(db, c.Tx, c.BeginErr), + searchTrigger: &SearchTriggerMock{}, } req := httptest.NewRequest(http.MethodPost, "http://test.com/", http.NoBody) @@ -811,14 +811,14 @@ func Test_Handler_TeardownOrganization(t *testing.T) { wasSearchJobInserted := func(count int) check { return func(t *testing.T, _ *DBMock, tx *TxMock, _ *StorerMock, _ *httptest.ResponseRecorder) { - ff := tx.InsertDocumentSearchJobCalls() + ff := tx.InsertSearchJobCalls() require.Len(t, ff, count) if count == 0 { return } - assert.Equal(t, []string{"org2"}, ff[0].Diff.RemovedOrganizations) + assert.Equal(t, search.OrganizationScope("org2"), ff[0].Job) } } @@ -928,7 +928,7 @@ func Test_Handler_TeardownOrganization(t *testing.T) { "Search job insertion error": { DB: &DBMock{}, Tx: &TxMock{ - InsertDocumentSearchJobFunc: func(context.Context, search.BlocksDifference) error { + InsertSearchJobFunc: func(context.Context, search.Job) error { return errors.New("boom") }, }, @@ -1014,10 +1014,10 @@ func Test_Handler_TeardownOrganization(t *testing.T) { } hdl := Handler{ - log: slog.New(slog.DiscardHandler), - db: withTx(c.DB, c.Tx, c.BeginErr), - storer: storer, - searchJobs: search.NewJobs(true), + log: slog.New(slog.DiscardHandler), + db: withTx(c.DB, c.Tx, c.BeginErr), + storer: storer, + searchTrigger: &SearchTriggerMock{}, } req := httptest.NewRequest(http.MethodPost, "http://test.com/", http.NoBody) diff --git a/server/core/internal/server/server.go b/server/core/internal/server/server.go index b23fe939..fa8e4966 100644 --- a/server/core/internal/server/server.go +++ b/server/core/internal/server/server.go @@ -19,7 +19,6 @@ import ( "github.com/oxynote/oxynote/server/core/internal/buildinfo" datasourceCore "github.com/oxynote/oxynote/server/core/internal/datasource" notificationCore "github.com/oxynote/oxynote/server/core/internal/notification" - "github.com/oxynote/oxynote/server/core/internal/search" "github.com/oxynote/oxynote/server/core/internal/server/internal/assistant" "github.com/oxynote/oxynote/server/core/internal/server/internal/auth" "github.com/oxynote/oxynote/server/core/internal/server/internal/block" @@ -143,8 +142,8 @@ func NewServer( githubMan *githubCore.Manager, slackMan *slackCore.Manager, webchangeClient *webchange.Client, - searchGateway document.SearchGateway, - searchJobs *search.Jobs, + searcher document.Searcher, + searchTrigger SearchTrigger, notifier Notifier, emailSender email.Sender, client *http.Client, @@ -163,7 +162,6 @@ func NewServer( Slack: slackMan.Configured(), AIAssistant: opts.Assistant, ChangeDetection: webchangeClient.Configured(), - Search: searchGateway.Configured(), }, } @@ -174,10 +172,10 @@ func NewServer( storageClient, githubMan, webchangeClient, - searchJobs, + searchTrigger, opts.PublicURL+_organizationLogoLocation, ) - srv.handlers.document = document.NewHandler(log, db, githubMan, webchangeClient, searchGateway, searchJobs, notifier, storageClient) + srv.handlers.document = document.NewHandler(log, db, githubMan, webchangeClient, searcher, searchTrigger, notifier, storageClient) srv.handlers.tag = tag.NewHandler(log, db) srv.handlers.comment = comment.NewHandler(log, db, notifier) srv.handlers.files = files.NewHandler(log, db, storageClient, opts.PublicURL) @@ -373,6 +371,15 @@ type Storer interface { document.Storer } +// SearchTrigger runs the search-job worker once a job has committed; the +// handlers call it after their commits. +// +//go:generate ../../scripts/codegen/mock -t internal SearchTrigger search_trigger +type SearchTrigger interface { + // Trigger should run a search-job pass right away. + Trigger() +} + // Notifier is an interface that combines notificationCore.Notifier and // notificationCore.Publisher. // diff --git a/server/core/internal/server/server_test.go b/server/core/internal/server/server_test.go index 945730af..5fffab39 100644 --- a/server/core/internal/server/server_test.go +++ b/server/core/internal/server/server_test.go @@ -17,7 +17,6 @@ import ( "github.com/oxynote/oxynote/server/core/internal/assistant/provider" "github.com/oxynote/oxynote/server/core/internal/buildinfo" datasourceCore "github.com/oxynote/oxynote/server/core/internal/datasource" - "github.com/oxynote/oxynote/server/core/internal/search" "github.com/oxynote/oxynote/server/core/pkg/metricutil" "github.com/oxynote/oxynote/server/core/pkg/testutil" wsMock "github.com/oxynote/wetsocks/wsserver/_mock" @@ -60,17 +59,15 @@ func Test_Options_validate(t *testing.T) { assert.EqualError(t, Options{}.validate(), "missing mcp session url") } -// stubSearchGateway satisfies the document handler's SearchGateway with a -// fixed configured flag. -type stubSearchGateway struct { - configured bool -} +// stubSearcher satisfies the document handler's Searcher. +type stubSearcher struct{} -func (g stubSearchGateway) Configured() bool { - return g.configured -} +// stubSearchTrigger satisfies SearchTrigger with a no-op. +type stubSearchTrigger struct{} -func (stubSearchGateway) SearchDocuments(context.Context, string, string) ([]byte, error) { +func (stubSearchTrigger) Trigger() {} + +func (stubSearcher) SearchDocuments(context.Context, string, string) ([]byte, error) { return nil, nil } @@ -83,7 +80,7 @@ func Test_NewServer(t *testing.T) { githubMan, err := github.NewManager(nil, github.Options{}) require.NoError(t, err) - assistantMan := assistantCore.NewManager(log, nil, &redis.Pool{}, nil, nil, fc, nil, nil, search.NewJobs(false), nil, githubMan, nil, "claude") + assistantMan := assistantCore.NewManager(log, nil, &redis.Pool{}, nil, nil, fc, nil, nil, stubSearchTrigger{}, nil, githubMan, nil, "claude") slackMan, err := slack.NewManager(log, nil, nil, nil, nil, slack.Options{}) require.NoError(t, err) @@ -107,8 +104,8 @@ func Test_NewServer(t *testing.T) { githubMan, slackMan, webchange.NewClient("", ""), - stubSearchGateway{}, - search.NewJobs(false), + stubSearcher{}, + stubSearchTrigger{}, notifier, nil, http.DefaultClient, @@ -135,14 +132,14 @@ func Test_NewServer(t *testing.T) { // a manager of this subtest's own: NewServer calls // SetTreeNotifier, which must not race the parallel // success case's identical call on a shared manager. - assistantCore.NewManager(log, nil, &redis.Pool{}, nil, nil, fc, nil, nil, search.NewJobs(false), nil, githubMan, nil, "claude"), + assistantCore.NewManager(log, nil, &redis.Pool{}, nil, nil, fc, nil, nil, stubSearchTrigger{}, nil, githubMan, nil, "claude"), datasourceCore.NewManager(log, nil), nil, githubMan, slackMan, webchange.NewClient("", ""), - stubSearchGateway{}, - search.NewJobs(false), + stubSearcher{}, + stubSearchTrigger{}, notifier, nil, http.DefaultClient, @@ -175,8 +172,8 @@ func Test_NewServer(t *testing.T) { githubMan, slackMan, webchange.NewClient("", ""), - stubSearchGateway{}, - search.NewJobs(false), + stubSearcher{}, + stubSearchTrigger{}, notifier, nil, http.DefaultClient, @@ -234,14 +231,14 @@ func Test_NewServer(t *testing.T) { db, fc, storer, - assistantCore.NewManager(log, nil, &redis.Pool{}, nil, nil, fc, nil, nil, search.NewJobs(false), nil, githubMan, nil, "claude"), + assistantCore.NewManager(log, nil, &redis.Pool{}, nil, nil, fc, nil, nil, stubSearchTrigger{}, nil, githubMan, nil, "claude"), datasourceCore.NewManager(log, nil), nil, githubMan, slackMan, webchange.NewClient("http://changedetection.test", ""), - stubSearchGateway{configured: true}, - search.NewJobs(true), + stubSearcher{}, + stubSearchTrigger{}, notifier, nil, http.DefaultClient, @@ -260,7 +257,6 @@ func Test_NewServer(t *testing.T) { Model: "claude-opus-5", }, ChangeDetection: true, - Search: true, }, srv.capabilities) }) } diff --git a/server/core/pkg/testutil/testutil.go b/server/core/pkg/testutil/testutil.go index fe86ab01..60593ba7 100644 --- a/server/core/pkg/testutil/testutil.go +++ b/server/core/pkg/testutil/testutil.go @@ -21,8 +21,16 @@ import ( "github.com/jarcoal/httpmock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/goleak" ) +// IgnoreBleveWorkers ignores the analysis workers bleve starts when it is +// loaded and never stops, for goleak.VerifyTestMain in every package that +// links the search index. +func IgnoreBleveWorkers() goleak.Option { + return goleak.IgnoreTopFunction("github.com/blevesearch/bleve_index_api.AnalysisWorker") +} + // AddChiCtx adds the provided URL parameter to the context's chi route // context, creating one when the context doesn't carry it yet. func AddChiCtx(ctx context.Context, key, value string) context.Context { diff --git a/server/core/pkg/testutil/testutil_test.go b/server/core/pkg/testutil/testutil_test.go index affb708c..81bf357e 100644 --- a/server/core/pkg/testutil/testutil_test.go +++ b/server/core/pkg/testutil/testutil_test.go @@ -187,3 +187,9 @@ func Test_Writer_Flush(t *testing.T) { require.NoError(t, w.Flush()) assert.Equal(t, "data", b.String()) } + +func Test_IgnoreBleveWorkers(t *testing.T) { + t.Parallel() + + assert.NotNil(t, IgnoreBleveWorkers()) +} diff --git a/server/core/pkg/timeutil/periodic.go b/server/core/pkg/timeutil/periodic.go index 18a295ca..c3ce7590 100644 --- a/server/core/pkg/timeutil/periodic.go +++ b/server/core/pkg/timeutil/periodic.go @@ -13,6 +13,7 @@ type PeriodicExec struct { fn func(ctx context.Context) recovery func(v any) immediate bool + trigger chan struct{} } // NewPeriodicExec creates a fresh periodic executor. @@ -35,6 +36,20 @@ func NewPeriodicExec( fn: fn, recovery: recovery, immediate: immediate, + // one pending trigger is enough: a run serves every trigger that + // arrived before it, so later ones that find the slot taken are + // already covered. + trigger: make(chan struct{}, 1), + } +} + +// Trigger runs the function at once, on top of the interval, which it +// does not reset. It never blocks and coalesces with a trigger already +// pending, so it is safe on a request path. +func (pe *PeriodicExec) Trigger() { + select { + case pe.trigger <- struct{}{}: + default: } } @@ -55,6 +70,8 @@ func (pe *PeriodicExec) Start(ctx context.Context) { case <-tm.C: pe.exec(ctx) tm.Reset(pe.interval) + case <-pe.trigger: + pe.exec(ctx) } } } diff --git a/server/core/pkg/timeutil/periodic_test.go b/server/core/pkg/timeutil/periodic_test.go index 164c03a1..37846b8f 100644 --- a/server/core/pkg/timeutil/periodic_test.go +++ b/server/core/pkg/timeutil/periodic_test.go @@ -22,6 +22,44 @@ func Test_NewPeriodicExec(t *testing.T) { assert.NotNil(t, pe.fn) assert.NotNil(t, pe.recovery) assert.True(t, pe.immediate) + assert.Equal(t, 1, cap(pe.trigger)) +} + +func Test_PeriodicExec_Trigger(t *testing.T) { + t.Parallel() + + // repeated triggers never block and collapse into one pending run. + pe := NewPeriodicExec(time.Hour, 0, func(context.Context) {}, nil, false) + pe.Trigger() + pe.Trigger() + assert.Len(t, pe.trigger, 1) + + // a trigger runs the function without waiting for the interval, and + // the interval keeps its schedule. + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + var runs int + + stopCh := make(chan struct{}) + + pe = NewPeriodicExec(time.Hour, 0, func(context.Context) { + runs++ + + cancel() + }, nil, false) + + go func() { + defer close(stopCh) + + pe.Start(ctx) + }() + + pe.Trigger() + + <-stopCh + + assert.Equal(t, 1, runs) } func Test_PeriodicExec_Start(t *testing.T) { diff --git a/web/app/components/test-helpers.ts b/web/app/components/test-helpers.ts index 5796c2c4..036e816d 100644 --- a/web/app/components/test-helpers.ts +++ b/web/app/components/test-helpers.ts @@ -78,7 +78,6 @@ export function seedCapabilities(capabilities: Partial = {}) { github: true, slack: true, changeDetection: true, - search: true, aiAssistant: { status: AssistantStatus.Active, model: "test-model" }, ...capabilities, }) diff --git a/web/app/composables/api/useCapabilitiesAPI.nuxt.test.ts b/web/app/composables/api/useCapabilitiesAPI.nuxt.test.ts index 33c07a77..52cb417c 100644 --- a/web/app/composables/api/useCapabilitiesAPI.nuxt.test.ts +++ b/web/app/composables/api/useCapabilitiesAPI.nuxt.test.ts @@ -17,7 +17,6 @@ function stubCapabilities(overrides: Partial = {}): Capabilities { github: true, slack: true, changeDetection: true, - search: true, aiAssistant: { status: AssistantStatus.Active, model: "claude-opus-5" }, ...overrides, } @@ -52,7 +51,6 @@ describe("useCapabilitiesAPI", { concurrent: false }, () => { github: true, slack: false, changeDetection: true, - search: false, }), ) const api = makeCapabilitiesAPI() @@ -62,7 +60,6 @@ describe("useCapabilitiesAPI", { concurrent: false }, () => { expect(api.isGithubEnabled.value).toBe(true) expect(api.isSlackEnabled.value).toBe(false) expect(api.isChangeDetectionEnabled.value).toBe(true) - expect(api.isSearchEnabled.value).toBe(false) }) it("reports every service enabled before the request resolves", ({ @@ -73,7 +70,6 @@ describe("useCapabilitiesAPI", { concurrent: false }, () => { expect(api.isGithubEnabled.value).toBe(true) expect(api.isSlackEnabled.value).toBe(true) expect(api.isChangeDetectionEnabled.value).toBe(true) - expect(api.isSearchEnabled.value).toBe(true) expect(api.isAssistantEnabled.value).toBe(true) }) @@ -93,7 +89,6 @@ describe("useCapabilitiesAPI", { concurrent: false }, () => { expect(api.isGithubEnabled.value).toBe(true) expect(api.isSlackEnabled.value).toBe(true) expect(api.isChangeDetectionEnabled.value).toBe(true) - expect(api.isSearchEnabled.value).toBe(true) expect(api.isAssistantEnabled.value).toBe(true) }) }) diff --git a/web/app/composables/api/useCapabilitiesAPI.ts b/web/app/composables/api/useCapabilitiesAPI.ts index 4cb5d0c2..208f932a 100644 --- a/web/app/composables/api/useCapabilitiesAPI.ts +++ b/web/app/composables/api/useCapabilitiesAPI.ts @@ -32,7 +32,6 @@ export default function () { // leaves nothing for the apps settings section to show const isAnyAppEnabled = enabled((c) => c.github || c.slack) const isChangeDetectionEnabled = enabled((c) => c.changeDetection) - const isSearchEnabled = enabled((c) => c.search) const assistantStatus = computed( () => fetchCapabilities.data.value?.aiAssistant.status ?? null, @@ -52,7 +51,6 @@ export default function () { isSlackEnabled, isAnyAppEnabled, isChangeDetectionEnabled, - isSearchEnabled, isAssistantEnabled, assistantStatus, assistantModel, diff --git a/web/app/utils/api/capabilities.ts b/web/app/utils/api/capabilities.ts index 27d97781..932789c9 100644 --- a/web/app/utils/api/capabilities.ts +++ b/web/app/utils/api/capabilities.ts @@ -17,5 +17,4 @@ export interface Capabilities { slack: boolean aiAssistant: AssistantCapability changeDetection: boolean - search: boolean }