@@ -26,7 +26,7 @@ import { asVector, searchAssetBuilder } from 'src/utils/database';
26
26
import { Instrumentation } from 'src/utils/instrumentation' ;
27
27
import { Paginated , PaginationResult , paginatedBuilder } from 'src/utils/pagination' ;
28
28
import { isValidInteger } from 'src/validation' ;
29
- import { Repository , SelectQueryBuilder } from 'typeorm' ;
29
+ import { Repository } from 'typeorm' ;
30
30
31
31
@Instrumentation ( )
32
32
@Injectable ( )
@@ -113,14 +113,6 @@ export class SearchRepository implements ISearchRepository {
113
113
return assets1 ;
114
114
}
115
115
116
- private createPersonFilter ( builder : SelectQueryBuilder < AssetFaceEntity > , personIds : string [ ] ) {
117
- return builder
118
- . select ( `${ builder . alias } ."assetId"` )
119
- . where ( `${ builder . alias } ."personId" IN (:...personIds)` , { personIds } )
120
- . groupBy ( `${ builder . alias } ."assetId"` )
121
- . having ( `COUNT(DISTINCT ${ builder . alias } ."personId") = :personCount` , { personCount : personIds . length } ) ;
122
- }
123
-
124
116
@GenerateSql ( {
125
117
params : [
126
118
{ page : 1 , size : 100 } ,
@@ -136,21 +128,12 @@ export class SearchRepository implements ISearchRepository {
136
128
} )
137
129
async searchSmart (
138
130
pagination : SearchPaginationOptions ,
139
- { embedding, userIds, personIds , ...options } : SmartSearchOptions ,
131
+ { embedding, userIds, ...options } : SmartSearchOptions ,
140
132
) : Paginated < AssetEntity > {
141
133
let results : PaginationResult < AssetEntity > = { items : [ ] , hasNextPage : false } ;
142
134
143
135
await this . assetRepository . manager . transaction ( async ( manager ) => {
144
136
let builder = manager . createQueryBuilder ( AssetEntity , 'asset' ) ;
145
-
146
- if ( personIds ?. length ) {
147
- const assetFaceBuilder = manager . createQueryBuilder ( AssetFaceEntity , 'asset_face' ) ;
148
- const cte = this . createPersonFilter ( assetFaceBuilder , personIds ) ;
149
- builder
150
- . addCommonTableExpression ( cte , 'asset_face_ids' )
151
- . innerJoin ( 'asset_face_ids' , 'a' , 'a."assetId" = asset.id' ) ;
152
- }
153
-
154
137
builder = searchAssetBuilder ( builder , options ) ;
155
138
builder
156
139
. innerJoin ( 'asset.smartSearch' , 'search' )
0 commit comments