@voidwire/lore 0.1.9 → 0.1.10
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/lib/semantic.ts +3 -1
- package/package.json +1 -1
package/lib/semantic.ts
CHANGED
|
@@ -181,6 +181,8 @@ export async function semanticSearch(
|
|
|
181
181
|
const params: (Uint8Array | string | number)[] = [queryBlob];
|
|
182
182
|
|
|
183
183
|
if (options.source) {
|
|
184
|
+
// Filter by e.source (partition column) for KNN pre-filtering
|
|
185
|
+
// This filters BEFORE KNN, not after — critical for domain-specific search
|
|
184
186
|
sql = `
|
|
185
187
|
SELECT
|
|
186
188
|
s.source,
|
|
@@ -192,7 +194,7 @@ export async function semanticSearch(
|
|
|
192
194
|
JOIN search s ON e.doc_id = s.rowid
|
|
193
195
|
WHERE e.embedding MATCH ?
|
|
194
196
|
AND k = ?
|
|
195
|
-
AND
|
|
197
|
+
AND e.source = ?
|
|
196
198
|
ORDER BY e.distance
|
|
197
199
|
LIMIT ?
|
|
198
200
|
`;
|