add selectai
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
set long 999999
|
||||
set pages 1000
|
||||
set lines 200
|
||||
set pagesize 1000
|
||||
set linesize 200
|
||||
|
||||
/* --------------------------------
|
||||
|
||||
@@ -9,8 +9,6 @@ HNSW INDEX
|
||||
-------------------------------- */
|
||||
|
||||
-- crear indice HNSW para busquedas vectoriales aproximadas
|
||||
DROP INDEX IF EXISTS markdown_chunks_hnsw_idx;
|
||||
|
||||
CREATE VECTOR INDEX markdown_chunks_hnsw_idx
|
||||
ON markdown_chunks (embedding)
|
||||
ORGANIZATION INMEMORY NEIGHBOR GRAPH
|
||||
@@ -22,6 +20,7 @@ PARAMETERS (
|
||||
EFCONSTRUCTION 200
|
||||
);
|
||||
|
||||
DROP INDEX IF EXISTS markdown_chunks_hnsw_idx;
|
||||
|
||||
/* --------------------------------
|
||||
|
||||
@@ -30,8 +29,6 @@ IVF INDEX
|
||||
-------------------------------- */
|
||||
|
||||
-- crear indice IVF con DOC_ID incluido para filtros por documento
|
||||
DROP INDEX IF EXISTS markdown_chunks_ivf_idx;
|
||||
|
||||
CREATE VECTOR INDEX markdown_chunks_ivf_idx
|
||||
ON markdown_chunks (embedding)
|
||||
INCLUDE (doc_id)
|
||||
@@ -44,7 +41,7 @@ PARAMETERS (
|
||||
MIN_VECTORS_PER_PARTITION 1
|
||||
);
|
||||
|
||||
|
||||
DROP INDEX IF EXISTS markdown_chunks_ivf_idx;
|
||||
/* --------------------------------
|
||||
|
||||
TEXT INDEX + VECTOR SEARCH
|
||||
@@ -63,24 +60,22 @@ select
|
||||
SCORE(1) as text_score,
|
||||
VECTOR_DISTANCE(embedding,
|
||||
VECTOR_EMBEDDING(MULTILINGUAL_E5_BASE
|
||||
USING 'estaciones de servicio' as DATA
|
||||
USING 'Sucursales adheridas' as DATA
|
||||
)
|
||||
) as vector_distance,
|
||||
chunk_text
|
||||
from markdown_chunks
|
||||
where contains(chunk_text, 'Beneficio
|
||||
AND FUZZY(Benefcio)
|
||||
AND ABOUT(estaciones)
|
||||
AND (Visa accum Mastercard)
|
||||
AND (Clásica OR Oro)
|
||||
AND (crédito NOT débito)
|
||||
AND NEAR((POS, Infonet), 5)
|
||||
AND NEAR((App, Premmia, Petrobras), 1)
|
||||
AND (consumo AND personal)', 1) > 0
|
||||
where contains(chunk_text, '(Mastercard ACCUM NEAR((Dúo,Clásica),1))', 1) > 0
|
||||
order by vector_distance
|
||||
fetch first 3 rows only;
|
||||
|
||||
|
||||
-- Promoción
|
||||
-- FUZZY(Promción)
|
||||
-- ABOUT(Promoción)
|
||||
-- NEAR((tarjetas, físicas, billeteras, electrónicas), 5)
|
||||
-- Black OR Albirroja
|
||||
-- BENDITA ACCUM STYLE
|
||||
-- (Mastercard ACCUM NEAR((Dúo,Clásica),1))
|
||||
|
||||
/* --------------------------------
|
||||
|
||||
@@ -103,14 +98,15 @@ PARALLEL 2;
|
||||
SELECT JSON_SERIALIZE(
|
||||
DBMS_HYBRID_VECTOR.SEARCH(
|
||||
JSON('{
|
||||
"hybrid_index_name" : "markdown_chunks_hybrid_idx",
|
||||
"hybrid_index_name" : "markdown_chunks_hybrid_idx",
|
||||
"search_fusion" : "UNION",
|
||||
"search_scorer" : "rsf",
|
||||
"vector" : {
|
||||
"search_text" : "beneficios en estaciones de servicio",
|
||||
"search_mode" : "CHUNK"
|
||||
"search_text" : "Vigencia",
|
||||
"search_mode" : "CHUNK"
|
||||
},
|
||||
"text" : {
|
||||
"contains" : "estaciones AND Petrobras"
|
||||
"contains" : "Shopping NEAR San NEAR Lorenzo"
|
||||
},
|
||||
"return" : {
|
||||
"values" : [
|
||||
@@ -135,8 +131,8 @@ FROM
|
||||
'hybrid_index_name' VALUE 'markdown_chunks_hybrid_idx',
|
||||
'search_fusion' VALUE 'INTERSECT',
|
||||
'search_scorer' VALUE 'rsf',
|
||||
'vector' VALUE json_object('search_text' VALUE 'beneficios en estaciones de servicio'),
|
||||
'text' VALUE json_object('contains' VALUE 'estaciones AND Petrobras'),
|
||||
'vector' VALUE json_object('search_text' VALUE 'COMERCIOS ADHERIDOS'),
|
||||
'text' VALUE json_object('contains' VALUE 'BENDITA ACCUM STYLE'),
|
||||
'return' VALUE json_object(
|
||||
'values' VALUE json_array('rowid', 'score', 'vector_score', 'vector_rank', 'text_score', 'text_rank', 'chunk_text'),
|
||||
'topN' VALUE 3
|
||||
|
||||
Reference in New Issue
Block a user