Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
thesteve0 committed Apr 22, 2024
1 parent 14d14ea commit 27f1c05
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions query/db_query.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
from qdrant_client import QdrantClient
from qdrant_client.models import Distance, VectorParams
from qdrant_client.models import models

import psycopg
from pgvector.psycopg import register_vector

# @todo this whole class needs to be rewritten
class DBQuery:

def __init__(self, vector_size: int, collection_name: str):

self.client = QdrantClient(host="localhost", port=6333)
def __init__(self):

self.vector_size = vector_size
self.collection_name = collection_name
self.connect_string = f"host=localhost user=postgres password='letmein' dbname=geoimage"
self.conn = psycopg.connect(self.connect_string, autocommit=True)

# just a normal vector query
def query_vector(self, vector):
with self.conn.cursor() as cur:
cur.execute(SQL)

vector = vector[0]
search_result = self.client.search(
collection_name=self.collection_name,
Expand All @@ -21,6 +22,8 @@ def query_vector(self, vector):
)
return search_result

# this one includes spatial
# for the workshop we will hardcode the country to use
def query_geo_vector(self, vector):
vector = vector[0]
search_result = self.client.search(
Expand Down

0 comments on commit 27f1c05

Please # to comment.