db_vector_välja_muutmine.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Veeru laiuse muudatus
  2. docker exec -it postgres_postgis bash -c "
  3. export PGPASSWORD='osm' &&
  4. psql -U osm -h localhost -d pdf_research -c \"
  5. ALTER TABLE chunks
  6. ALTER COLUMN embedding TYPE vector(384);
  7. \"
  8. "
  9. docker exec -it postgres_postgis bash -c "
  10. export PGPASSWORD='osm' &&
  11. psql -U osm -h localhost -d pdf_research -c \"
  12. DROP INDEX IF EXISTS idx_chunks_embedding;
  13. CREATE INDEX idx_chunks_embedding ON chunks
  14. USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);
  15. \"
  16. "
  17. # Lisa raw_documents tabelisse täiendavad veerud weaviate baasist ülekandmiseks
  18. docker exec -it postgres_postgis bash -c "
  19. export PGPASSWORD='osm' &&
  20. psql -U osm -h localhost -d pdf_research -c \"
  21. ALTER TABLE raw_documents
  22. ADD COLUMN IF NOT EXISTS weaviate_article_id UUID,
  23. ADD COLUMN IF NOT EXISTS title TEXT,
  24. ADD COLUMN IF NOT EXISTS doi TEXT,
  25. ADD COLUMN IF NOT EXISTS journal TEXT,
  26. ADD COLUMN IF NOT EXISTS year REAL,
  27. ADD COLUMN IF NOT EXISTS authors TEXT[],
  28. ADD COLUMN IF NOT EXISTS key_concepts TEXT[],
  29. ADD COLUMN IF NOT EXISTS methods_used TEXT[],
  30. ADD COLUMN IF NOT EXISTS summary_et TEXT,
  31. ADD COLUMN IF NOT EXISTS abstract_en TEXT,
  32. ADD COLUMN IF NOT EXISTS transport_context JSONB,
  33. ADD COLUMN IF NOT EXISTS relevance_score REAL,
  34. ADD COLUMN IF NOT EXISTS processing_date TIMESTAMPTZ;
  35. CREATE INDEX idx_raw_weaviate_id ON raw_documents(weaviate_article_id);
  36. \"
  37. "
  38. # Kontrollli veeru olemasolu
  39. docker exec -it postgres_postgis bash -c "
  40. export PGPASSWORD='osm' &&
  41. psql -U osm -h localhost -d pdf_research -c \"
  42. SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'raw_documents' ORDER BY ordinal_position;
  43. \"
  44. "