@o-lang/semantic-doc-search 1.0.14 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o-lang/semantic-doc-search",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "O-lang Semantic Document Search Resolver with hybrid search, embeddings, rerank, and streaming.",
5
5
  "main": "src/index.js",
6
6
  "type": "commonjs",
@@ -13,35 +13,26 @@ class PgVectorAdapter {
13
13
  });
14
14
  }
15
15
 
16
- // Convert JavaScript array to PostgreSQL array format
17
- // [1.0, 2.0, 3.0] -> {1.0,2.0,3.0}
18
- arrayToPgArray(arr) {
19
- return `{${arr.join(',')}}`;
20
- }
21
-
22
16
  async upsert({ id, vector, content, source, metadata = {} }) {
23
- // Convert to PostgreSQL array format (NOT JSON)
24
- const pgVector = this.arrayToPgArray(vector);
25
-
17
+ // Pass vector as array parameter - let pg handle conversion
26
18
  await this.pool.query(
27
19
  `INSERT INTO doc_embeddings (id, embedding, content, source, metadata)
28
20
  VALUES ($1, $2::vector, $3, $4, $5::jsonb)
29
21
  ON CONFLICT (id) DO UPDATE
30
22
  SET embedding = $2::vector, content = $3, source = $4, metadata = $5::jsonb, updated_at = NOW()`,
31
- [id, pgVector, content, source, JSON.stringify(metadata)]
23
+ [id, vector, content, source, JSON.stringify(metadata)]
32
24
  );
33
25
  }
34
26
 
35
27
  async query(vector, topK = 5) {
36
- const pgVector = this.arrayToPgArray(vector);
37
-
28
+ // Pass vector as array parameter - let pg handle conversion
38
29
  const res = await this.pool.query(
39
30
  `SELECT id, content, source, metadata,
40
31
  1 - (embedding <=> $1::vector) AS score
41
32
  FROM doc_embeddings
42
33
  ORDER BY embedding <=> $1::vector
43
34
  LIMIT $2`,
44
- [pgVector, topK]
35
+ [vector, topK]
45
36
  );
46
37
 
47
38
  return res.rows.map(row => ({