dwaynefernandes05 commited on
Commit
e17d11b
·
1 Parent(s): a52f7b0

fix parquet column mismatch

Browse files
Files changed (1) hide show
  1. engine.py +20 -6
engine.py CHANGED
@@ -334,7 +334,10 @@ class HybridRetrievalEngine:
334
  mask = np.ones(len(self.product_df), dtype=bool)
335
 
336
  # Voltage
337
- if rfp_input.get('voltage_rating'):
 
 
 
338
  mask &= (
339
  self.product_df['voltage_rating']
340
  .astype(str)
@@ -344,7 +347,10 @@ class HybridRetrievalEngine:
344
  )
345
 
346
  # Core Count
347
- if rfp_input.get('core_count'):
 
 
 
348
  mask &= (
349
  self.product_df['core_count']
350
  .astype(str)
@@ -353,7 +359,10 @@ class HybridRetrievalEngine:
353
  )
354
 
355
  # Conductor
356
- if rfp_input.get('conductor_material'):
 
 
 
357
  mask &= (
358
  self.product_df['conductor_material']
359
  .astype(str)
@@ -363,7 +372,10 @@ class HybridRetrievalEngine:
363
  )
364
 
365
  # Insulation
366
- if rfp_input.get('insulation_type'):
 
 
 
367
  mask &= (
368
  self.product_df['insulation_type']
369
  .astype(str)
@@ -373,7 +385,10 @@ class HybridRetrievalEngine:
373
  )
374
 
375
  # Armouring
376
- if rfp_input.get('armouring_type'):
 
 
 
377
  mask &= (
378
  self.product_df['armouring_type']
379
  .astype(str)
@@ -384,7 +399,6 @@ class HybridRetrievalEngine:
384
 
385
  candidate_indices = np.where(mask)[0]
386
 
387
- # fallback if too strict
388
  if len(candidate_indices) == 0:
389
  candidate_indices = np.arange(len(self.product_df))
390
 
 
334
  mask = np.ones(len(self.product_df), dtype=bool)
335
 
336
  # Voltage
337
+ if (
338
+ 'voltage_rating' in self.product_df.columns
339
+ and rfp_input.get('voltage_rating')
340
+ ):
341
  mask &= (
342
  self.product_df['voltage_rating']
343
  .astype(str)
 
347
  )
348
 
349
  # Core Count
350
+ if (
351
+ 'core_count' in self.product_df.columns
352
+ and rfp_input.get('core_count')
353
+ ):
354
  mask &= (
355
  self.product_df['core_count']
356
  .astype(str)
 
359
  )
360
 
361
  # Conductor
362
+ if (
363
+ 'conductor_material' in self.product_df.columns
364
+ and rfp_input.get('conductor_material')
365
+ ):
366
  mask &= (
367
  self.product_df['conductor_material']
368
  .astype(str)
 
372
  )
373
 
374
  # Insulation
375
+ if (
376
+ 'insulation_type' in self.product_df.columns
377
+ and rfp_input.get('insulation_type')
378
+ ):
379
  mask &= (
380
  self.product_df['insulation_type']
381
  .astype(str)
 
385
  )
386
 
387
  # Armouring
388
+ if (
389
+ 'armouring_type' in self.product_df.columns
390
+ and rfp_input.get('armouring_type')
391
+ ):
392
  mask &= (
393
  self.product_df['armouring_type']
394
  .astype(str)
 
399
 
400
  candidate_indices = np.where(mask)[0]
401
 
 
402
  if len(candidate_indices) == 0:
403
  candidate_indices = np.arange(len(self.product_df))
404