You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For local use, ngram cannot get anything when it starts with 1 and a single character is retrieved in full text.
Steps to reproduce
use serde::{Deserialize, Serialize};
use surrealdb::engine::local::Mem;
use surrealdb::sql::Thing;
use surrealdb::Surreal;
#[derive(Debug, Serialize)]
struct Person<'a> {
title: &'a str,
name: &'a str,
marketing: bool,
}
#[derive(Debug, Deserialize)]
struct Record {
#[allow(dead_code)]
id: Thing,
}
#[tokio::main]
async fn main() -> surrealdb::Result<()> {
// Connect to the server
let db = Surreal::new::(()).await?;
// Select a specific namespace / database
db.use_ns("test").use_db("test").await?;
db.query("DEFINE ANALYZER ngram_search TOKENIZERS blank, class, punct FILTERS lowercase, ngram(1,10)")
.query("DEFINE INDEX ngram_search_index ON person COLUMNS title SEARCH ANALYZER ngram_search BM25 HIGHLIGHTS").await?;
// Create a new person with a random id
let created: Vec = db
.create("person")
.content(Person {
title: "Founder & CEO",
name: "Morgan Hitchcock",
marketing: true,
})
.await?;
dbg!(created);
// Perform a custom advanced query
let groups = db
.query("SELECT title FROM person where title @@ 'f'")
.await?;
dbg!(groups);
Ok(())
}
Expected behaviour
response the title "Founder & CEO"
SurrealDB version
surreal 1.4.2 on windows 11
Contact Details
No response
Is there an existing issue for this?
I have searched the existing issues
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Describe the bug
For local use, ngram cannot get anything when it starts with 1 and a single character is retrieved in full text.
Steps to reproduce
use serde::{Deserialize, Serialize};
use surrealdb::engine::local::Mem;
use surrealdb::sql::Thing;
use surrealdb::Surreal;
#[derive(Debug, Serialize)]
struct Person<'a> {
title: &'a str,
name: &'a str,
marketing: bool,
}
#[derive(Debug, Deserialize)]
struct Record {
#[allow(dead_code)]
id: Thing,
}
#[tokio::main]
async fn main() -> surrealdb::Result<()> {
// Connect to the server
let db = Surreal::new::(()).await?;
// Select a specific namespace / database
db.use_ns("test").use_db("test").await?;
db.query("DEFINE ANALYZER ngram_search TOKENIZERS blank, class, punct FILTERS lowercase, ngram(1,10)")
.query("DEFINE INDEX ngram_search_index ON person COLUMNS title SEARCH ANALYZER ngram_search BM25 HIGHLIGHTS").await?;
// Create a new person with a random id
let created: Vec = db
.create("person")
.content(Person {
title: "Founder & CEO",
name: "Morgan Hitchcock",
marketing: true,
})
.await?;
dbg!(created);
// Perform a custom advanced query
let groups = db
.query("SELECT title FROM person where title @@ 'f'")
.await?;
dbg!(groups);
Ok(())
}
Expected behaviour
response the title "Founder & CEO"
SurrealDB version
surreal 1.4.2 on windows 11
Contact Details
No response
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: