chore: rename workspace settings disable indexing to disable search indexing in database queries
This commit is contained in:
parent
3e019eef3a
commit
ef27a148b9
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n select c.workspace_id, c.oid, c.partition_key\n from af_collab c\n where not exists (\n select 1\n from af_collab_embeddings em\n where em.oid = c.oid and em.partition_key = 0)",
|
||||
"query": "\n select c.workspace_id, c.oid, c.partition_key\n from af_collab c\n join af_workspace w on c.workspace_id = w.workspace_id\n where not coalesce(w.settings['disable_search_indexding']::boolean, false)\n and not exists (\n select 1\n from af_collab_embeddings em\n where em.oid = c.oid and em.partition_key = 0)",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
|
|
@ -28,5 +28,5 @@
|
|||
false
|
||||
]
|
||||
},
|
||||
"hash": "ff77d2a038e3130bf57d055e26b37ea61f37167a21cefb4b8480bd511ce2a878"
|
||||
"hash": "26f293af01281f6f4a99fd69d3a4acc1a556dd3628873fa3ce3e8eaa18ccda1b"
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\nSELECT\n w.settings['disable_search_indexing']::boolean as disable_search_indexing,\n CASE\n WHEN w.settings['disable_search_indexing']::boolean THEN\n FALSE\n ELSE\n EXISTS (SELECT 1 FROM af_collab_embeddings m WHERE m.partition_key = c.partition_key AND m.oid = c.oid)\n END as has_index\nFROM af_collab c\nJOIN af_workspace w ON c.workspace_id = w.workspace_id\nWHERE c.oid = $1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "disable_search_indexing",
|
||||
"type_info": "Bool"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "has_index",
|
||||
"type_info": "Bool"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
null,
|
||||
null
|
||||
]
|
||||
},
|
||||
"hash": "7c0d6de28d557d83cf94faceef1216ea932ffe1bf29f8ed3dafeb6ddeea437fb"
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\nSELECT\n w.settings['disable_indexing']::boolean as disable_indexing,\n CASE\n WHEN w.settings['disable_indexing']::boolean THEN\n FALSE\n ELSE\n EXISTS (SELECT 1 FROM af_collab_embeddings m WHERE m.partition_key = c.partition_key AND m.oid = c.oid)\n END as has_index\nFROM af_collab c\nJOIN af_workspace w ON c.workspace_id = w.workspace_id\nWHERE c.oid = $1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "disable_indexing",
|
||||
"type_info": "Bool"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "has_index",
|
||||
"type_info": "Bool"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
null,
|
||||
null
|
||||
]
|
||||
},
|
||||
"hash": "e6105ace4f5b9b71a7edc30f80c6f06877f5a8c49830a4126ee61f7c2e9db03a"
|
||||
}
|
||||
|
|
@ -14,9 +14,9 @@ pub async fn get_index_status(
|
|||
let result = sqlx::query!(
|
||||
r#"
|
||||
SELECT
|
||||
w.settings['disable_indexing']::boolean as disable_indexing,
|
||||
w.settings['disable_search_indexing']::boolean as disable_search_indexing,
|
||||
CASE
|
||||
WHEN w.settings['disable_indexing']::boolean THEN
|
||||
WHEN w.settings['disable_search_indexing']::boolean THEN
|
||||
FALSE
|
||||
ELSE
|
||||
EXISTS (SELECT 1 FROM af_collab_embeddings m WHERE m.partition_key = c.partition_key AND m.oid = c.oid)
|
||||
|
|
@ -28,7 +28,7 @@ WHERE c.oid = $1"#,
|
|||
)
|
||||
.fetch_one(tx.deref_mut())
|
||||
.await?;
|
||||
if result.disable_indexing.unwrap_or(false) {
|
||||
if result.disable_search_indexing.unwrap_or(false) {
|
||||
return Ok(None);
|
||||
}
|
||||
Ok(Some(result.has_index.unwrap_or(false)))
|
||||
|
|
@ -94,7 +94,9 @@ where
|
|||
r#"
|
||||
select c.workspace_id, c.oid, c.partition_key
|
||||
from af_collab c
|
||||
where not exists (
|
||||
join af_workspace w on c.workspace_id = w.workspace_id
|
||||
where not coalesce(w.settings['disable_search_indexding']::boolean, false)
|
||||
and not exists (
|
||||
select 1
|
||||
from af_collab_embeddings em
|
||||
where em.oid = c.oid and em.partition_key = 0)"# // atm. get only documents
|
||||
|
|
|
|||
|
|
@ -534,8 +534,8 @@ pub async fn update_workspace_settings(
|
|||
let mut setting = select_workspace_settings(tx.deref_mut(), workspace_id)
|
||||
.await?
|
||||
.unwrap_or_default();
|
||||
if let Some(disable_indexing) = change.disable_search_indexing {
|
||||
setting.disable_search_indexing = disable_indexing;
|
||||
if let Some(disable_search_indexing) = change.disable_search_indexing {
|
||||
setting.disable_search_indexing = disable_search_indexing;
|
||||
}
|
||||
|
||||
if let Some(ai_model) = change.ai_model {
|
||||
|
|
|
|||
Loading…
Reference in New Issue