File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
extensions/Postgres/Postgres/Internals Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -416,13 +416,13 @@ DO UPDATE SET
416416
417417 // Filtering logic, including filter by similarity
418418 filterSql = filterSql ? . Trim ( ) . Replace ( PostgresSchema . PlaceholdersTags , this . _colTags , StringComparison . Ordinal ) ;
419- if ( string . IsNullOrWhiteSpace ( filterSql ) )
420- {
421- filterSql = "TRUE" ;
422- }
423419
424420 var maxDistance = 1 - minSimilarity ;
425- filterSql += $ " AND { this . _colEmbedding } <=> @embedding < @maxDistance";
421+ var distanceFilter = $ "{ this . _colEmbedding } <=> @embedding < @maxDistance";
422+
423+ filterSql = string . IsNullOrWhiteSpace ( filterSql ) ?
424+ distanceFilter :
425+ $ "({ filterSql } ) AND { distanceFilter } ";
426426
427427 if ( sqlUserValues == null ) { sqlUserValues = [ ] ; }
428428
You can’t perform that action at this time.
0 commit comments