Comments (5)
@kotolex @Zamion101 There is definitely some ambiguity regarding composite indexes applied to FTS.
In fact, the main usage of composite indexes is for unique indexes, when you want to ensure that there are not two records in the same table having the same composite content.
By extension, it is possible to build a composite index with FTS in SurrealDB, but that does not really make sense, as there is no possibility to query it. In a future release, we will clarify this behavior.
from surrealdb.
We apologise for the misleading documentation!
It is going to be updated: surrealdb/docs.surrealdb.com#394
from surrealdb.
I can confirm this is a relevant bug that I also encountered. What I experienced is that when I have a composite FTS index such as
DEFINE INDEX idx_search ON table FIELDS slug, name SEARCH ANALYZER analayzer_ngram BM25;
with analyzer defined as
DEFINE ANALYZER analayzer_ngram TOKENIZERS class FILTERS ascii,lowercase,ngram(3,5);
it returns a same exception
"There was no suitable index supporting the expression 'slug @0@ 'test''"
stated by author of this issue.
But when I try to create a single field index everything works fine.
from surrealdb.
Thanks for reporting the issue.
To query a field individually, you should create one index per field:
DEFINE INDEX book_idx_title ON book FIELDS title SEARCH ANALYZER custom_analyzer BM25;
DEFINE INDEX book_idx_content ON book FIELDS content SEARCH ANALYZER custom_analyzer BM25;
Now the search works:
SELECT * FROM book WHERE content @@ 'linux'
[
{
"author": "Ben",
"content": "we create linux",
"id": "book:t5el0ncq3omvlzwgent5",
"signup_at": "2024-03-07T10:01:18.896Z",
"title": "create linux-systems"
}
]
And you can also search on several fields:
SELECT * FROM book WHERE content @@ 'linux' OR title @@ 'linux';
from surrealdb.
The documentation has been updated
from surrealdb.
Related Issues (20)
- Feature: Omit in fetch
- Feature: Live Query WHERE clause should process Params HOT 6
- Bug: Delr is displayed in trace logs of releases HOT 1
- Bug: I upgraded my server surreal version and lost all my data HOT 9
- Bug: OPTION IMPORT causes bugs with FTS indexes
- Bug: subquery runs create twice
- Feature: Embedded replicas
- Bug: TIMEOUT not respected inside RETURN statement
- Bug: Rust fails to build surrealdb HOT 12
- Bug: Parser interpretes string id with starting with number followed by 'e' as exponenets HOT 2
- Bug: COMPOSITE INDEX does not work
- Bug: 'Unsupported value' in no-index WHERE condition, causes INDEX to not be used HOT 1
- Bug: The alphabetical order of the properties of an object-based Record ID is query-significant HOT 1
- Bug: HTTP CREATE not working when using TOKEN auth HOT 3
- Bug: Can't define a schema with flexible object keys HOT 3
- Bug: database fails and stop on attempt to delete namespace HOT 1
- Bug: the parse::url::port() does not work on https url
- Bug: Parse error when using RELATE query from docs
- Feature: NN Vector search and similarity masking (partial vector search)
- Bug: Floats treated as integers and duplicate records not checked when floats used as record id
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from surrealdb.