@@ -43,7 +43,7 @@ public PostgresDbClient(PostgresConfig config, ILoggerFactory? loggerFactory = n
4343 this . _schema = config . Schema ;
4444 this . _tableNamePrefix = config . TableNamePrefix ;
4545 this . _textSearchLanguage = config . TextSearchLanguage ;
46- this . _rrf_K = config . RRFK ;
46+ this . _rrfK = config . RRFK ;
4747
4848 this . _colId = config . Columns [ PostgresConfig . ColumnId ] ;
4949 this . _colEmbedding = config . Columns [ PostgresConfig . ColumnEmbedding ] ;
@@ -431,7 +431,6 @@ DO UPDATE SET
431431 // Column names
432432 string columns = withEmbeddings ? this . _columnsListWithEmbeddings : this . _columnsListNoEmbeddings ;
433433
434-
435434 // Filtering logic, including filter by similarity
436435 //
437436 filterSql = filterSql ? . Trim ( ) . Replace ( PostgresSchema . PlaceholdersTags , this . _colTags , StringComparison . Ordinal ) ;
@@ -474,16 +473,16 @@ WITH semantic_search AS (
474473 LIMIT @limit
475474 ),
476475 keyword_search AS (
477- SELECT { this . _columnsListHybrid } , RANK () OVER (ORDER BY ts_rank_cd(to_tsvector('english ', { this . _colContent } ), query) DESC)
478- FROM { tableName } , plainto_tsquery('english ', @query) query
479- WHERE { filterSqlHybridText } AND to_tsvector('english ', { this . _colContent } ) @@ query
480- ORDER BY ts_rank_cd(to_tsvector('english ', { this . _colContent } ), query) DESC
476+ SELECT { this . _columnsListHybrid } , RANK () OVER (ORDER BY ts_rank_cd(to_tsvector('{ this . _textSearchLanguage } ', { this . _colContent } ), query) DESC)
477+ FROM { tableName } , plainto_tsquery('{ this . _textSearchLanguage } ', @query) query
478+ WHERE { filterSqlHybridText } AND to_tsvector('{ this . _textSearchLanguage } ', { this . _colContent } ) @@ query
479+ ORDER BY ts_rank_cd(to_tsvector('{ this . _textSearchLanguage } ', { this . _colContent } ), query) DESC
481480 LIMIT @limit
482481 )
483482 SELECT
484483 { this . _columnsListHybridCoalesce } ,
485- COALESCE(1.0 / ({ this . _rrf_K } + semantic_search.rank), 0.0) +
486- COALESCE(1.0 / ({ this . _rrf_K } + keyword_search.rank), 0.0) AS { colDistance }
484+ COALESCE(1.0 / ({ this . _rrfK } + semantic_search.rank), 0.0) +
485+ COALESCE(1.0 / ({ this . _rrfK } + keyword_search.rank), 0.0) AS { colDistance }
487486 FROM semantic_search
488487 FULL OUTER JOIN keyword_search ON semantic_search.{ this . _colId } = keyword_search.{ this . _colId }
489488 ORDER BY { colDistance } DESC
@@ -752,7 +751,7 @@ public async ValueTask DisposeAsync()
752751 private readonly string _columnsListHybridCoalesce ;
753752 private readonly bool _dbNamePresent ;
754753 private readonly string _textSearchLanguage ;
755- private readonly int _rrf_K ;
754+ private readonly int _rrfK ;
756755
757756 /// <summary>
758757 /// Try to connect to PG, handling exceptions in case the DB doesn't exist
0 commit comments