@@ -624,31 +624,31 @@ export class HanaDB extends VectorStore {
624
624
*/
625
625
private extractKeywordSearchColumns ( filter ?: this[ "FilterType" ] ) : string [ ] {
626
626
const keywordColumns = new Set < string > ( ) ;
627
+ this . recurseFiltersHelper ( keywordColumns , filter ) ;
628
+ return [ ...keywordColumns ] ;
629
+ }
630
+
631
+ private recurseFiltersHelper ( keywordColumns : Set < string > , filterObj ?: this[ "FilterType" ] , parentKey ?: string ) : void {
632
+ if ( ! filterObj || typeof filterObj !== "object" ) return ;
627
633
628
- const recurseFilters = ( filterObj ?: this[ "FilterType" ] , parentKey ?: string ) : void => {
629
- if ( ! filterObj || typeof filterObj !== "object" ) return ;
630
-
631
- Object . entries ( filterObj ) . forEach ( ( [ key , value ] ) => {
632
- if ( key === CONTAINS_OPERATOR ) {
633
- if (
634
- parentKey &&
635
- parentKey !== this . contentColumn &&
636
- ! this . specificMetadataColumns . includes ( parentKey )
637
- ) {
638
- keywordColumns . add ( parentKey ) ;
639
- }
640
- } else if ( key in LOGICAL_OPERATORS_TO_SQL ) {
641
- // Assume it's an array of filters
642
- ( value as this[ "FilterType" ] [ ] ) . forEach ( ( subfilter ) => recurseFilters ( subfilter ) ) ;
643
- } else if ( typeof value === "object" && value !== null ) {
644
- recurseFilters ( value as this[ "FilterType" ] , key ) ;
634
+ Object . entries ( filterObj ) . forEach ( ( [ key , value ] ) => {
635
+ if ( key === CONTAINS_OPERATOR ) {
636
+ if (
637
+ parentKey &&
638
+ parentKey !== this . contentColumn &&
639
+ ! this . specificMetadataColumns . includes ( parentKey )
640
+ ) {
641
+ keywordColumns . add ( parentKey ) ;
645
642
}
646
- } ) ;
647
- } ;
648
-
649
- recurseFilters ( filter ) ;
650
- return [ ...keywordColumns ] ;
643
+ } else if ( key in LOGICAL_OPERATORS_TO_SQL ) {
644
+ // Assume it's an array of filters
645
+ ( value as this[ "FilterType" ] [ ] ) . forEach ( ( subfilter ) => this . recurseFiltersHelper ( keywordColumns , subfilter ) ) ;
646
+ } else if ( typeof value === "object" && value !== null ) {
647
+ this . recurseFiltersHelper ( keywordColumns , value as this[ "FilterType" ] , key ) ;
648
+ }
649
+ } ) ;
651
650
}
651
+
652
652
653
653
/**
654
654
* Generate a SQL `WITH` clause to project metadata columns for keyword search.
0 commit comments