Odonno / surrealdb-migrations

An awesome SurrealDB migration tool, with a user-friendly CLI and a versatile Rust library that enables seamless integration into any project.
https://crates.io/crates/surrealdb-migrations
MIT License
231 stars 20 forks source link

Issues with "Tokenizers" syntax #90

Open senpro-ingwersenk opened 2 months ago

senpro-ingwersenk commented 2 months ago

Describe the bug

I was getting started with the migrations for my app and ran into this issue:

> surrealdb-migrations.exe apply
Error:
   0: Parse error: Failed to parse query at line 92 column 16
   0:    |
   0: 92 | TOKENIZERS ascii
   0:    |            ^
   0:
   1: Parse error: Failed to parse query at line 92 column 16
   1:    |
   1: 92 | TOKENIZERS ascii
   1:    |            ^
   1:

Location:
   C:\Users\ingwersenk\.cargo\registry\src\index.crates.io-6f17d22bba15001f\surrealdb-migrations-1.5.0\src\surrealdb.rs:157

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

I eventually tracked it down to this snippet:

DEFINE ANALYZER description_autocomplete
    TOKENIZERS ascii
    FILTERS lowercase,edgengram(3,10);

However, this should be accurate with the docs: https://surrealdb.com/docs/surrealql/statements/define/analyzer

To Reproduce Here is a simplified version of the schema:

DEFINE TABLE process
    SCHEMAFULL;
DEFINE FIELD description ON process TYPE string;

DEFINE ANALYZER description_autocomplete
    TOKENIZERS ascii
    FILTERS lowercase,edgengram(3,10);

DEFINE INDEX title_search_idx
    ON TABLE process
    COLUMNS title
    SEARCH ANALYZER description_autocomplete
    BM25
    HIGHLIGHTS;

Expected behavior Aside from not seing which file caused the error, I had expected to pass, as it is documented.

Information

Additional context SurrealDB is running in a container and I use a .surrealdb file to point the tool towards the location of my schemas and alike. It totally sees them, but it then just ... kinda implodes? I am a little lost.

The output suggests to enable RUST_BACKTRACE - well, here goes:

> surrealdb-migrations.exe apply
Error:
   0: Parse error: Failed to parse query at line 92 column 16
   0:    |
   0: 92 | TOKENIZERS ascii
   0:    |            ^
   0:
   1: Parse error: Failed to parse query at line 92 column 16
   1:    |
   1: 92 | TOKENIZERS ascii
   1:    |            ^
   1:

Location:
   C:\Users\ingwersenk\.cargo\registry\src\index.crates.io-6f17d22bba15001f\surrealdb-migrations-1.5.0\src\surrealdb.rs:157

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: BaseThreadInitThunk<unknown>
      at <unknown source file>:<unknown line>
   2: RtlUserThreadStart<unknown>
      at <unknown source file>:<unknown line>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.

Setting the COLORBT_SHOW_HIDDEN env variable made no difference.

Kind regards!