mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	chore: optimize sql query to not concatenate (#5321)
This commit is contained in:
		
							parent
							
								
									7f4df19660
								
							
						
					
					
						commit
						00327c359d
					
				@ -562,13 +562,21 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
 | 
				
			|||||||
                ]);
 | 
					                ]);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (hasHalfTag) {
 | 
					            if (hasHalfTag) {
 | 
				
			||||||
                const tagParameter = normalizedHalfTag.map((tag) => `%${tag}%`);
 | 
					                const tagParameters = normalizedHalfTag.map(
 | 
				
			||||||
                tagQuery.orWhereRaw(
 | 
					                    (tag) => `%${tag}%`,
 | 
				
			||||||
                    `(?? || ':' || ??) ILIKE ANY (ARRAY[${tagParameter
 | 
					 | 
				
			||||||
                        .map(() => '?')
 | 
					 | 
				
			||||||
                        .join(',')}])`,
 | 
					 | 
				
			||||||
                    ['tag_type', 'tag_value', ...tagParameter],
 | 
					 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
 | 
					                const tagQueryParameters = normalizedHalfTag
 | 
				
			||||||
 | 
					                    .map(() => '?')
 | 
				
			||||||
 | 
					                    .join(',');
 | 
				
			||||||
 | 
					                tagQuery
 | 
				
			||||||
 | 
					                    .orWhereRaw(
 | 
				
			||||||
 | 
					                        `(??) ILIKE ANY (ARRAY[${tagQueryParameters}])`,
 | 
				
			||||||
 | 
					                        ['tag_type', ...tagParameters],
 | 
				
			||||||
 | 
					                    )
 | 
				
			||||||
 | 
					                    .orWhereRaw(
 | 
				
			||||||
 | 
					                        `(??) ILIKE ANY (ARRAY[${tagQueryParameters}])`,
 | 
				
			||||||
 | 
					                        ['tag_value', ...tagParameters],
 | 
				
			||||||
 | 
					                    );
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            query = query.where((builder) => {
 | 
					            query = query.where((builder) => {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user